Author: Gugu Ncube
-
Fat Ducks – Finding Disk Space Hogs Quickly in Unix
# install numfmt through coreutils sudo apt-get install -y coreutils alias ducks=’sudo du -cbs * | sort -rn| head -11|numfmt –field 1 –to=iec|column -t’ Add to .bash_aliases > cat ~/.bash_aliases alias ducks=’sudo du -cbs * | sort -rn| head -11|numfmt –field 1 –to=iec|column -t’ .. > ducks 10TB this 5GB is 2MB hello 10KB world…
-
Ubuntu – Install Skype 4.3 on Ubuntu 14.04
# remove and purge old skype versions sudo apt-get remove -y skype skype-bin:i386 skype:i386 sudo apt-get purge -y skype skype-bin:i386 skype:i386 # remove and purge old sni-qt versions sudo apt-get remove -y sni-qt:i386 sudo apt-get purge -y sni-qt:i386 # install new sni-qt version sudo apt-get install -y sni-qt:i386 # download and install latest skype version…
-
Python – Check if the internet works 🙂
Just check a google server import urllib2 def internet_on(): try: response=urllib2.urlopen(‘http://74.125.228.100’,timeout=1) return True except urllib2.URLError as err: pass return False 74.125.228.100 is one of the IP-addresses for google.com. Change http://74.125.228.100 to whatever site can be expected to respond quickly. Using a numerical IP-address avoids a DNS lookup, which may block the urllib2.urlopen call for more…
-
Requests per Second from Logfiles – Nginx, Apache
Requests per Second from Logfiles – Nginx, Apache http://stackoverflow.com/questions/4051555/how-do-i-get-the-number-of-requests-per-second-from-apache-log-between-2-dates-t while true; do tail -n0 -f /var/log/wowza/wowzamediaserver_access.log>/tmp/tmp.log & sleep 2; kill $! ; wc -l /tmp/tmp.log | cut -c-2; done 2>/dev/null As a bash function/alias rqs /var/log/access.log function requests_per_second(log_filepath){ # http://stackoverflow.com/questions/4051555/how-do-i-get-the-number-of-requests-per-second-from-apache-log-between-2-dates-t while true; do tail -n0 -f “${log_filepath}” > /tmp/tmp.log & sleep 2; kill $!; wc…
-
Python – Headless Selenium Performance Tests with Google Chrome, Browsermob-Proxy and Xvfb
# -*- coding: utf-8 -*- “”” # Install xvfb sudo apt-get install -y xvfb # create build directory mkdir -p ~/build/selenium cd ~/build/selenium # Install API for browsermob-proxy and selenium sudo pip install selenium browsermob-proxy –upgrade # download browsermob proxy wget https://github.com/downloads/webmetrics/browsermob-proxy/browsermob-proxy-2.0-beta-6-bin.zip unzip browsermob-proxy-2.0-beta-6-bin.zip # copy browsermob-proxy to /var/lib sudo cp -r browsermob-proxy /var/lib/ sudo…
-
Python – Testing Selenium with Google Chrome
# use a custom directory for download and installation mkdir -p ~/build/selenium cd ~/build/selenium # Install 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 -y google-chrome-stable # Download Selenium wget http://selenium-release.storage.googleapis.com/2.41/selenium-server-standalone-2.41.0.jar # Download Chrome Driver Selenium…
-
Ubuntu – Resolving Package Problems
One of the many ways to resolve package issues in ubuntu 🙂 sudo apt-get -f install sudo apt-get update # to update your package list. sudo apt-get autoclean # to clean up any partial packages. sudo apt-get clean # to clean up the apt cache. sudo apt-get autoremove # will clean up any unneeded dependencies.…
-
monit – FTP checks
check host ftp.redhat.com with address ftp.redhat.com if failed icmp type echo with timeout 15 seconds then alert if failed port 21 protocol ftp then exec “/usr/X11R6/bin/xmessage -display :0 ftp connection failed” alert foo@bar.com References 1. https://mmonit.com/monit/documentation/monit.html
-
monit – URL, HTTP and Elasticsearch checks
1. Simple URL Check check host elastic_health_check with address 0.0.0.0 if failed url http://0.0.0.0:9200/_cluster/health for 2 cycles then alert 2. URL with Basic Authentification # http://stackoverflow.com/questions/1115816/monit-and-apache-site-behind-http-basic-auth # It seems to be possible to include the credentials in the URL, have you tried this?: # (from http://mmonit.com/monit/documentation/monit.html#connection_testing ) # If a username and password is included…
-
LevelDB – Installation and Performance Tests in Python
py-leveldb installation # http://code.google.com/p/py-leveldb/ # install subversion sudo apt-get install -y subversion # get source code from SVN mkdir -p ~/build/py-leveldb-read cd ~/build/py-leveldb-read svn checkout http://py-leveldb.googlecode.com/svn/trunk/ py-leveldb-read-only cd py-leveldb-read-only # build the leveldb library ./compile_leveldb.sh # build the Python extensions python setup.py build # install it sudo python setup.py install python -c ‘import leveldb; print…