Skip to content

Instantly share code, notes, and snippets.

View asimihsan's full-sized avatar

Asim Ihsan asimihsan

View GitHub Profile
@asimihsan
asimihsan / lessons-learned.md
Created February 14, 2014 16:33
Web administered test automation - lessons learned

Web-administered test automation - lessons learned

Summary

  • All processes require checklists.
  • Automate everything, and continuously test your automation.
  • Do not reinvent the wheel. Defer to idiomatic or popular solutions.
  • Everything fails. Anticipate this and offer degraded service.
  • Instrument everything.
### MATPLOTLIBRC FORMAT
# This is a sample matplotlib configuration file - you can find a copy
# of it on your system in
# site-packages/matplotlib/mpl-data/matplotlibrc. If you edit it
# there, please note that it will be overridden in your next install.
# If you want to keep a permanent local copy that will not be
# over-written, place it in HOME/.matplotlib/matplotlibrc (unix/linux
# like systems) and C:\Documents and Settings\yourname\.matplotlib
# (win32 systems).
@asimihsan
asimihsan / aadhaar_generated_mapper.py
Created February 18, 2014 15:57
Lesson 5 - MapReduce. Mapper and reducer with aadhaar data.
import csv
import sys
import string
def mapper(input=sys.stdin):
reader = csv.DictReader(input)
for row in reader: #cycle through lines of code
print "%s\t%s" % (row["District"], row["Aadhaar generated"])
mapper()
@asimihsan
asimihsan / bokeh-virtualenv-instructions.md
Last active August 29, 2015 13:56
Installing Bokeh in a virtualenv

You can't install Bokeh in a virtualenv without modifying /home/asim.ihsan/Programming/envs/default/lib/python2.7/site.py to add the getsitepackages() from the Python 2.7 version of the file in e.g. /usr/lib64/python2.7/site.py. This is because virtualenv uses a Python 2.6 version of this file. This is an open bug:

pypa/virtualenv#355

In your virtualenv site.py search for addsitepackages() and

@asimihsan
asimihsan / memory-monitor.py
Created April 8, 2014 12:14
Memory monitoring
#!/usr/bin/env python
import datetime
import logging
import logging.handlers
import os
import socket
import sys
import time
@asimihsan
asimihsan / .tmux.conf
Created July 24, 2014 14:00
.tmux.conf
# status bar
set-option -g status-utf8 on
set-option -g default-shell /bin/zsh
# https://github.com/seebi/tmux-colors-solarized/blob/master/tmuxcolors-256.conf
set-option -g status-bg colour235 #base02
set-option -g status-fg colour136 #yellow
set-option -g status-attr default
@asimihsan
asimihsan / Foo.java
Last active August 29, 2015 14:04
Running Python interactively on Mac and Linux. Trick is to attach a PTY to it using unbuffer or script.
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
class Foo {
public static void main(String[] args) throws IOException, InterruptedException {
# file: /home/ubuntu/.aws_keys
export AWS_ACCESS_KEY_ID=XXXXXXXXX
export AWS_ACCOUNT_ID=1111111111
export AWS_SECRET_ACCESS_KEY=fFjerT235Fj
# subsequently modify /home/ubuntu/.bash_profile and "dot this in" by using:
# . /home/ubuntu/.aws_keys
@asimihsan
asimihsan / haproxyd
Created April 20, 2011 12:06
/etc/init.d/haproxyd
#!/usr/bin/env bash
# haproxyd
# Script to start|stop|restart haproxy from /etc/init.d/
# By Gubatron.
HAPROXY_CONFIG_PATH=/home/ubuntu/canvas/src/loadbalancer/haproxy.conf
HAPROXY_DAEMON=/usr/local/sbin/haproxy
test -x $HAPROXY_DAEMON || exit 0
@asimihsan
asimihsan / gist:938983
Created April 23, 2011 21:12
Erlang on AWS - part 3
We couldn’t find that file to show.