,

Author: Gugu Ncube

  • pgadmin3 – installation – latest version

    Version 1.14 – OLD stable version sudo apt-get install -y pgadmin3 1.18 and latest version The latest version is available from the pgadmin git server. Only disadvantage: it has to be build from scatch. Depending on your machine capabilities, this can take several minutes. # Prepare sudo apt-get install -y build-essential automake libwxgtk2.8-dev libwxgtk2.8-dbg libxml2-dev…

  • Disk space – using du to analyse tree and file sizes in Linux

    Size Of Directory and Disk Space du -s .archived/ du -sk k: result in KB x: expands but only on the local file system (does not follow NFS Links) du -xh | egrep “^[0-9\.]+[GT]” # Using root dir to start du -xh / |egrep “^[0-9\.]+[GT]” # Flat @directory level du -Sh |egrep “^[0-9\.]+[GT]” du -x…

  • Python – Using the Bing Search API

    Introduction Bing is a great search engine with very generous API volumes for developers. Currently 5.000 queries per month can be called for free. Compare with Google: 100 per day * 30 = 3.000 per month. There a couple of Python libraries which used to work with Bing API. I tried pybing but the the…

  • Ubuntu – Add International Language Locales

    Adding additional locales can be necessary to read date information in available in certain languages only. Support for international dates # check all available locales locale -a # check if the german locale is available cat /usr/share/i18n/SUPPORTED|grep de_DE.UTF-8 # de_DE.UTF-8 # add german locale sudo locale-gen de_DE sudo locale-gen de_DE.UTF-8 # update server locale information…

  • Python – Spynner – Test Scripts

    Spynner is a stateful programmatic web browser module for Python based on PyQT and WebKit. How to install Spynner – easy 🙂 > cat spynner-test.py # -*- coding: utf-8 -*- import spynner import pyquery import os os.environ[‘DISPLAY’] = ‘:0.0’ def main(): browse_via_jquery() browse_using_xpath() browse_via_webkit() download_image() def browse_via_jquery(): browser = spynner.Browser(debug_level=spynner.DEBUG) browser.create_webview() browser.show() #browser.hide() browser.load(“http://www.wordreference.com”) browser.load_jquery(True)…

  • Unix – Rename Files recursively using a for-loop and find command

    find . -name “*.flv.mp4” | while read file; do echo “$file”; mv “$file” “${file%.flv.mp4}.mp4” #mv “$file” “$(expr “$file” : ‘\(.*\)\.flv.mp4’).mp4″ done; Notes: rename rename does not work: “$rename .html .txt *.html” results in… syntax error at (eval 1) line 1, near “.” basename basename does not work – only renames the filename and strip path!…

  • Python – Simple Websockets Example using Flask and gevent

    Below is a simple Websockets Echo Server using Flask and gevent 🙂 Installation requirements.txt – easily build all depencies cat > requirements.txt

  • Python – Spynner Installation in Ubuntu

    Spynner is a stateful programmatic web browser module for Python with Javascript/AJAX support based upon the QtWebKit framework. Quick Install # build LibQt4 dependencies sudo apt-get build-dep -y libqt4-dev # install python Qt4 library sudo apt-get install -y python-qt4 # x11 sudo apt-get install -y libxtst-dev xvfb x11-xkb-utils # fonts sudo apt-get install -y xfonts-100dpi…

  • WordPress – Change the number of latest blog posts

    Steps to change the number of recent posts in WordPress Blog Dashboard -> Appearance > Widgets > Recent Posts > Edit > [Set desired number of posts] Tried this as well – didn’t quite work: Dashboard > Settings > Reading > Blog pages show at most References 1. Increase the number of recent posts shown…

  • Unix – Collection of useful bash aliases

    The following aliases have made my unix life 10x easier 🙂 cat ~/.bash_aliases alias pj=’ps -fA|grep java’ # pdf viewer alias v=’qpdfview’ # open browser alias b=’x-www-browser’ # check space left in drives alias space=’df -h’ # open password gorilla alias pw=’password-gorilla’ # Show hidden files alias l.=’ls -d .* –color=auto’ # cd .. aliases…