Skip to content

Instantly share code, notes, and snippets.

View asimihsan's full-sized avatar

Asim Ihsan asimihsan

View GitHub Profile
@asimihsan
asimihsan / hook.rb
Created February 1, 2016 02:23
Hook for letsencrypt.sh to do DNS challenges
#!/usr/bin/env ruby
require 'aws-sdk'
require 'pry'
require 'awesome_print'
# ------------------------------------------------------------------------------
# Credentials
# ------------------------------------------------------------------------------
# pick up AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY by default from
import math
students = sc.parallelize([
[100, "Alice", 8.5, "Computer Science"],
[101, "Bob", 7.1, "Engineering"],
[102, "Carl", 6.2, "Engineering"],
])
def extract_degree_grade_count(row):
return (row[3], (row[2], row[2] ** 2, 1))
@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 {
@asimihsan
asimihsan / memory-usage.jira
Created July 24, 2014 16:38
Memory usage on Linux systems
Memory usage on Linux systems
(TODO I'm going to edit and refactor this article a bit)
h2. tl;dr
* The Proportional Set Size (PSS) of a process is the count of pages it
has in memory, where each page is divided by the number of processes
sharing it.
* The Unique Set Size (USS) of a process is the count of unshared pages.
@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 / tornadolog.py
Last active October 28, 2019 22:13
Tail a file over HTTP WebSockets with a Tornado server.
#!/usr/bin/env python
import logging
import tornado.httpserver
import tornado.ioloop
import tornado.web
import tornado.websocket
from tornado.options import define, options
from tornado.process import Subprocess
@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 / 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 / !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 / 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