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 :
Tag Archives: linux
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 …
Continue reading “Apache NetBeans – building and installation”
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. create a new file (es: /usr/local/bin/battery.sh) paste inside the new file the following code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
#!/bin/sh oDIR=$( pwd ) oIFS=$IFS IFS=$'\n' for BATTERY in $( find /sys -name "BAT*" -type d 2>/dev/null ); do cd $BATTERY PRESENT=$( grep 1 present 2>/dev/null) if [ "$PRESENT" != "" ]; then PRESENT="Yes" else PRESENT="No" fi MODEL="$(cat manufacturer 2>/dev/null) $(cat model_name 2>/dev/null) $(cat technology 2>/dev/null)" SERIAL=$(cat serial_number 2>/dev/null | sed -es/\ //g) [ "$SERIAL" != "" ] && MODEL="$MODEL - s/n: $SERIAL" CYCLES=$( cat cycle_count 2>/dev/null ) [ "$CYCLES" = "" ] && CYCLES="N.A." STATUS=$( cat status 2>/dev/null ) [ "$STATUS" = "" ] && STATUS="N.A." CAPACITY=$( cat capacity_level 2>/dev/null) [ "$CAPACITY" = "" ] && CAPACITY="N.A." CAPACITY_PCT=$( cat capacity 2>/dev/null) [ "$CAPACITY_PCT" != "" ] && CAPACITY="${CAPACITY_PCT}% - $CAPACITY" ENERGY=$( cat energy_full 2>/dev/null ) [ "$ENERGY" = "" ] && ENERGY="N.A." ENERGY_DESIGN=$( cat energy_full_design 2>/dev/null ) [ "$ENERGY_DESIGN" = "" ] && ENERGY_DESIGN="N.A." [[ "$ENERGY_DESIGN" != "N.A." && "$ENERGY" != "N.A." ]] && ENERGY=$(( 100*$ENERGY/$ENERGY_DESIGN )) VOLTAGE=$( cat voltage_now 2>/dev/null ) [ "$VOLTAGE" = "" ] && VOLTAGE="N.A." [ "$VOLTAGE" != "N.A." ] && VOLTAGE="$( echo $VOLTAGE | head -c2).$( echo $VOLTAGE | head -c4 | tail -c2)" VOLTAGE_MIN=$( cat voltage_min_design 2>/dev/null ) [ "$VOLTAGE_MIN" = "" ] && VOLTAGE_MIN="N.A." [ "$VOLTAGE_MIN" != "N.A." ] && VOLTAGE_MIN="$( echo $VOLTAGE_MIN | head -c2).$( echo $VOLTAGE_MIN | head -c4 | tail -c2)" echo "Battery $(basename $BATTERY)" echo "- Model: $MODEL" echo "- Present: $PRESENT" echo "- Status: $STATUS" echo "- Capacity: $CAPACITY" [[ "$CYCLES" != "N.A." && "$CYCLES" != "0" ]] && echo "- Cycles: $CYCLES" [[ "$ENERGY" != "N.A." ]] && echo "- Max Energy: ${ENERGY}% of original" echo "- Voltage: $VOLTAGE (Original min: $VOLTAGE_MIN)" echo "" done IFS=$oIFS cd $oDIR |
save the file make the file executable (es: chmod +x /usr/local/bin/battery.sh) 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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
#!/bin/sh WLAN=wlan0 DEAD=$(service wpa_supplicant status 2>/dev/null | grep -i dead) YESIP=$( ip addr show $WLAN | grep "inet\b" | awk '{print $2}' | cut -d/ -f1 ) CMD=$( ps -eo args | grep wpa_suppl | grep -v grep ) if [ "$YESIP" == "" ]; then DEAD="DEAD" else ping 8.8.8.8 -c 5 >/dev/null 2>/dev/null if [ "$?" != "0" ]; then DEAD="DEAD" else DEAD="" fi fi if [ "$DEAD" != "" ]; then pkill -9 wpa_supplicant $CMD & fi |
Remember to use a value for WLAN corresponding to you wifi …
Linux: change temporary directory for Android Studio
Using Android Studio the directory used by the system to store temporary files (the default one is /tmp) could be filled by many (big) files, in order to limit this behaviour you can choose another directory to be used by the IDE. To do so you could launch the IDE every time with the following commands (in …
Continue reading “Linux: change temporary directory for Android Studio”
Nextcloud client for Slackware64
Using cloud storage is a popular choice and creating a personal cloud is now a possibility many of us have. If you want to create your own cloud storage you can install OwnCloud or NextCloud on a webserver and connect to them usng a web browser or a client application. I’ll show how to install NextCloud …
Ipset : minimal version for old kernels
Use fail2ban is a good way to have active secuity checks in your system, but if you are limited to an old kernel how could you avoid probems due to incompatibility ? A solution could be using a fake ipset supporting only del and add actions.
Skype4Slackware : a Skype packager for Slackware
Microsoft makes packages of “Skype For Linux” only in .deb and .rpm format. If you want to use them on Slackware you have, every time, to download the file, convert it into a native package and install it. Can we execute this procedure using a tool that requires only to be launched ? The answer is simple : YES. See how to …
Continue reading “Skype4Slackware : a Skype packager for Slackware”
Install Mozilla Firefox portable on Linux
Installing an instance of Mozilla Firefox portable on Linux is pretty simple but this action could reserve you some trouble if you have to do it manually every time. Because of this i created a very simple script which does the dirty job and can create a portable installation of this the browser. Supported Firefox versions, …
Continue reading “Install Mozilla Firefox portable on Linux”
RFIDer: tool to get data from a rfid reader
For a home automation project i had to connect a rdif reader (this one) to a Raspberry Pi 3 and then have the system execute a program each time a token is read by the reader:RFIDer is the tool i developed to do this job. RFIDer sources (GPLv3 license) are available, but you can also find precompiled binaries for some platform. Once compiled …
Continue reading “RFIDer: tool to get data from a rfid reader”