Skip to content

Instantly share code, notes, and snippets.

View asimihsan's full-sized avatar

Asim Ihsan asimihsan

View GitHub Profile
@asimihsan
asimihsan / python_resources.md
Last active April 18, 2017 15:37
Python resources

Python resources

  • "Courses" are intended for learning Python via an online interactive course.
  • "Learning books" are intended for learning Python by reading them cover-to-cover.
  • "Reference books" are intended for dipping into randomly as you face particular problems in Python or in general.

All material are specified in order of preference (most to least); all of these

@asimihsan
asimihsan / CodingForInterviewsBitManipulation.java
Created December 14, 2013 22:31
Coding for Interviews - Bit Manipulation
class CodingForInterviewsBitManipulation {
public static int setBit(int number, int index, boolean set) {
if (set)
return number | (1 << index);
else
return number & (~(1 << index));
}
public static boolean getBit(int number, int index) {
int result = (number & (1 << index)) >> index;
@asimihsan
asimihsan / !stdout
Last active September 2, 2018 21:25
NSA codeword generator.
HOMOGENAKA
SPALLYILL
ENEUCHSTROKY
BOBACHUELESS
SYNAPTEPIERAGE
HUMBLEENCRATY
EMITTERSOMEDAY
BUGLETINNLESS
BEAUPAINTER
TOXEMIASHALLOW
@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 / !resuilts.md
Created February 28, 2014 17:29
HTML5 canvas drawing tabular data for massive (50k+) coloured, interactive, tables.

With click handlers

  • 5k rows takes <1s.330MB!
  • 10k rows takes <2s, 700MB!!
@asimihsan
asimihsan / keybase.md
Last active January 12, 2020 23:19
Keybase proof

Keybase proof

I hereby claim:

  • I am asimihsan on github.
  • I am asim (https://keybase.io/asim) on keybase.
  • I have a public key ASC1eY06tt4EdWUNAMm3y4cLwYpmMBwlwkmphjRX7-CB9Ao

To claim this, I am signing this object:

@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