Friday 14 November 2014

iwlist helper

This script filter helpful output from iwlist.
Use it this way:

# show-wifi wlan0 VOO_HOMESPOT last

#!/bin/sh

device=${1-wlan0}
essid=${2-}
last=${3}

filter()
{
    if [ -n "$essid" ] ; then
        grep -B 3 $essid | grep -v ^--
    else
        cat
    fi
}

iwlist $device scanning $last | egrep "ESSID:|Address:|Quality=|Channel:" | filter


linux: Autologin VOO_HOMESPOT free wifi


The goal is to connect to the VOO_HOMESPOT wifi network without login into the web browser.VOO_HOMESPOT the is the wifree wireless network of VOO in Belgium.

This should work with any linux using network-manager.

Just copy file below into /etc/NetworkManager/dispatcher.d/voo-homespot
make it executable and be sure root is the owner


chown root.root  /etc/NetworkManager/dispatcher.d/voo-homespot
chmod 700 /etc/NetworkManager/dispatcher.d/voo-homespot


Here is the script
#!/bin/sh

USERNAME=<YOUR VOO USERNAME>
PASSWORD=<YOUR VOO PASSWORD>

ESSID="VOO_HOMESPOT"
TARGET=http://www.google.com/
AUTH_URL=https://wifree.voo.be/authenticate.html

if iwconfig | grep -q $ESSID ; then
    wget -qO- --post-data="username=${USERNAME}&password=${PASSWORD}&rememberme=rememberme&accept=accept&target=${TARGET_URL}" $AUTH_URL | grep -q connected_success.png
   if [ $? -eq 0 ] ; then
       logger "connected to $ESSID "
   else
       logger "login to $ESSID failed"
   fi
else
   logger "not ${ESSID}, don't try to login"
fi

Tuesday 4 November 2014

Monospaced and fixed width fonts for programming and terminal

The best of all font ever for console and programming is the fixed size used in X windows :

  • 6x13 -Misc-Fixed-Medium-R-SemiCondensed--13-120-75-75-C-60-ISO10646-1
Here is how I get it in my Ubuntu 14.04, following the greate article from pts.org  ( http://ptspts.blogspot.co.uk/2010/06/how-to-enable-bitmap-fonts-on-ubuntu.html )


$ wget -q -O - http://pts-mini-gpl.googlecode.com/svn/trunk/fonts/fixedsc.tgz |
       (cd / && sudo tar xzv)
$ sudo rm -f /etc/fonts/conf.d/70-{yes,no,force}-bitmaps.conf
$ if test -f /etc/fonts/conf.avail/70-force-bitmaps.conf
  then sudo ln -s {../conf.avail,/etc/fonts/conf.d}/70-force-bitmaps.conf
  else sudo ln -s {../conf.avail,/etc/fonts/conf.d}/70-yes-bitmaps.conf
  fi
$ sudo rm -f /var/cache/fontconfig/*
$ rm -rf "$HOME/.fontconfig"
$ sudo fc-cache
$ fc-cache

Then I select FixedSc size 10 for all my x-terminal. This works great with low res screen, but become more difficult to read with high definition one. Then I choose INCONSOLATA font for these displays. This font works well in all size, hinting and sub-pixel order. Other font looks better but then you have to tune the font rendering and maybe reduce

$ sudo apt-get install fonts-inconsolata

See some other fonts here :