,

Author: Gugu Ncube

  • Python – String to Number Hash

    def string2numeric_hash(text): import hashlib return int(hashlib.md5(text).hexdigest()[:8], 16) # test >>print string2numeric_hash(‘this is a nice string’) 1962341389 References 1. http://stackoverflow.com/questions/2511058/persistent-hashing-of-strings-in-python

  • Ubuntu – Installation of Firefox, Chrome, Opera Internet Browsers in Ubuntu 12.04, 12.10, 13.10, 14.04, 14.10

    1. Mozilla Firefox Firefox in often pre-installed in most Ubuntu derivatives. If not, it can be easily installed from the standard repository. sudo apt-get install -y firefox 2. Google Chrome wget -q -O- https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add – sudo sh -c ‘echo “deb http://dl.google.com/linux/chrome/deb/ stable main” > /etc/apt/sources.list.d/google.list’ sudo apt-get update sudo apt-get install…

  • Ubuntu – Dia – Open Source diagramming Software

    sudo apt-get install -y dia References Home: https://live.gnome.org/Dia Related Links: http://en.wikipedia.org/wiki/Dia_(software) Manual Installer: http://sourceforge.net/projects/dia-installer/ Linux Installation: http://dia-installer.de/download/linux.html 1. Samples and Examples: https://live.gnome.org/Dia/Examples 2. Additional Stensils Repository: http://dia-installer.de/shapes/index.html.en 3. Gnome Icons: http://gnomediaicons.sourceforge.net/screenshots.html 4. Dia Installation under Windows http://dia-installer.de/download/index.html.en http://download.cnet.com/Dia/3000-2075_4-10833704.html 5. Alternatives: http://www.yworks.com/en/products_yed_about.html

  • Linux – recursively find the newest files in a subdirectory

    find . -type f -printf “%C@ %p\n” | sort -rn | head -n 10 References 1. http://stackoverflow.com/questions/10575665/linux-find-command-find-10-latest-files-recursively-regardless-of-time-span

  • Apple iTunes – Add Folder to Library instead of File by File

    1. Open iTunes 2. Press Ctrl + B 3. Select “File” for the Menu bar (top left) 4. Select “Add Folder ” 5. Select Folder 6. Go 🙂 References tdb.

  • Linux – multi-hop ssh via jump server

    this is how to multi-hop servers in one command ssh -A -t @ ssh -A -X # example to go directly to far-away-server via jump.server: ssh -A -t jump-user@jump.server.net ssh -A -X far-user@far-away-server.net Using a bash alias a@a:~$ head -1 ~/.bash_aliases alias go=’ssh -A -t base@main.app.farm.net ssh -A -X’ a@a:~$ go farm3 Last login: Thu…

  • ncdu – analysing disk usage in linux

    # installation sudo apt-get install -y ncdu Usage ncdu -x / #Since scanning a large directory may take a while, you can scan a directory and export the results for later viewing: ncdu -1xo- / | gzip > /tmp/export.gz # …some time later: zcat /tmp/export.gz | ncdu -f- # To export from a cron job,…

  • wget – Recursive GET – download and crawl websites

    recursively download and crawl web pages using wget wget -erobots=off -r http://www.guguncube.com in case downloading hangs due to missing/incorrect robots.txt, just use “-erobots=off”. This skips downloading robots.txt altogether. Multiple URLs wget -erobots=off -i url-list.txt References 1. http://skeena.net/kb/wget%20ignore%20robots.txt

  • Ubuntu – set default text editor

    sudo update-alternatives –config editor #There are 5 choices for the alternative editor (providing /usr/bin/editor). # # Selection Path Priority Status #———————————————————— #* 0 /bin/nano 40 auto mode # 1 /bin/ed -100 manual mode # 2 /bin/nano 40 manual mode # 3 /usr/bin/mcedit 25 manual mode # 4 /usr/bin/vim.basic 30 manual mode # 5 /usr/bin/vim.tiny 10…

  • VMWare Player Installation in Ubuntu 11.04/12.04/12.10/13.10

    Installation 1. Prepare sudo apt-get install build-essential linux-headers-`uname -r` -y sudo apt-get install make -y sudo apt-get install gcc -y 2. Download vmware player a@a:~$ cd Downloads a@a:~/Downloads$ ls VMware-Player-4.0.2-591240.i386.bundle a@a:~/Downloads$ sudo sh VMware-Player-4.0.2-591240.i386.bundle ???? sudo sh vmware-installer -u vmware-player The installed application can be found under: Applications -> System Tools -> VMWare Player Deinstallation…