WordPress – Plugin to manage robots.txt

To have a simple and quick management tool to edit robots.txt in a WordPress website i realized this plugin that allows you to:

  • add extra content to default robots.txt
  • totally overwrite default robots.txt

Plugin can be download from https://www.wordpress.org/plugins/robots-txt-quick-editor/

Linux: get UPS remaining battery time

If you have a UPS connected to your Linux box maybe you need some simple way to get how much power is left in the batteries, i’ve written a simple tool to get this information (note: you need Nut to be installed, configured and running).


# device to check using "nut" utilities

# chars to be added at the end of output
CHARS=" | "

# displays battery remaining %
# echo "$( LANG= upsc $UPSDEV | grep battery.charge: | awk '{print $2}' )${CHARS}"

displays battery time remaining, or "infinite" if battery is not discharging
STS=$(LANG= upsc $UPSDEV | grep ups.status: | awk '{print $2}' | grep -i DISCHRG )
SEC=$(LANG= upsc $UPSDEV | grep battery.runtime: | awk '{print $2}' )
if [ "$STS" = "" ]; then
echo "∞${CHARS}"
echo "$(date -d@$SEC -u +%Hh:%Mm)${CHARS}"

I saved (and set as executable) the script in /usr/local/bin/ups-status and then i used the script as source information for xfce4genmon-plugin to have data visible in my main Xfce panel.

Just a final note: do not forget to customize the code according to you needing (set ups identification in UPSDEV, set extra text to be displayed in CHARS and comment/decomment code to get the info you want – battery % or battery time – )

Walking Light

Walking in low light situations it may be necessary to make yourself more visible, for this reason a flashing light (with a color of your choice between 3 shades) can be really useful

With “Walking Light” you have at your disposal a simple and intuitive tool that allows you to have a flashing light in a color of your choice between red, orange and white.

Application can be downloaded from Google Play Store: https://play.google.com/store/apps/details?id=net.airaghi.walkinglight&hl=en

openSuse: Apache modules management from shell

To manage Apache Httpd on openSuse we have the classic command a2enmod, shared with many other distros, which allows to: 1) know if a module is enabled, 2) enable a module and 3) disable a module.

To extend what already present in a2enmod i have written a simple wrapper to a2enmod in order to have mote functionalities: 1) get the list of every module available on the system, 2) get the list of every module enabled, 3) check if a module has been enabled or not, 4) enable one or more modules and 5) disable one or more module.

Continue reading “openSuse: Apache modules management from shell”

Apache Netbeans for Linux: get latest build

After having seen how to build Apache Netbeans on a Linux box here you can find how to get the latest build (no more compiling!) from Apache servers.

It’a all in a couple of shell commands :

Apache NetBeans – building and installation

NetBeans is now an Apache Foundation project, but (as of today) we lost the possibility to download a specific release (Java only, PHP, C/C++, …), the standard version available (release 9+) is only built with Java support.
I have created a very simple script that build Apache NetBeans including support for various programming languages (PHP included), getting sources from the latest tree hosted on GitHub.

Continue reading “Apache NetBeans – building and installation”

PHP – file encryption/decryption

To have some sort of privacy while sending/receiving messages (or files) using encryption is the first choice.

Below you can find a very simple PHP web application that allows you to encrypt/decrypt a file using your web browser (and a web server hosting the page).

Linux: get info about notebook battery

Below you can find a very simple shell script that gets information about every battery present in your notebook and shows a summary.

  1. create a new file (es: /usr/local/bin/battery.sh)
  2.  paste inside the new file the following code
  3. save the file
  4. make the file executable (es: chmod +x /usr/local/bin/battery.sh)
  5. use the script (from a terminal  execute: /usr/local/bin/battery.sh)



Automatic Wpa Supplicant restart

If wifi connection used by your Linux box is not stable and goes up&down, with wpa_supplicant requiring some manual restart you could use a simple script that does it for you.

Below you can find a script i’m using on a RaspberryPi 3 with Raspian installed.

Remember to use a value for WLAN corresponding to you wifi interface.

The shell script alone doesn’t give you a fully automatic and periodic check&restart … to have it you should use crontab and schedule script invocation (user: root!) every 15 minutes (or every time you need it).

Slackware: keep Gradle up-to-date

Using AndroidStudio to develop mobile apps requires you to always have an updated installation of  Gradle, doing so on a Slackware system could lead to quite a lot of manual work.

To help me in the process i created a small tool that on its own downloads and makes a Gradle Slackware package (thanks to these SlackBuilds).

To use this tool you only have to execute the script, wait for it to finish and the upgrade Gradle using the packages created.

Continue reading “Slackware: keep Gradle up-to-date”