Skip to content

Instantly share code, notes, and snippets.

@ngsankha
ngsankha / client.js
Created May 25, 2013 19:04
A minimal chat client based on Redis pub/sub
var redis = require('redis'),
util = require('util'),
client1 = redis.createClient(),
client2 = redis.createClient();
channel = 'chatroom';
process.stdin.resume();
client1.on('error', function(err) {
console.log("Error: " + err);
@ngsankha
ngsankha / github-scrape.py
Last active December 11, 2015 01:18
Collect data from Github
import csv, httplib, json
from string import ascii_lowercase
con = httplib.HTTPSConnection('api.github.com')
languages = ['java', 'c', 'ruby', 'python', 'javascript']
for lang in languages:
with open(lang + '.csv', 'wb') as csvfile:
csvwriter = csv.writer(csvfile, delimiter = ',', quotechar='"', quoting = csv.QUOTE_MINIMAL)
for ch in ascii_lowercase:
print("Processing repos with " + ch + " for language " + lang)
@ngsankha
ngsankha / fit.R
Last active December 11, 2015 01:18
Computing trends in programming languages
# Read all the collected data
java = read.csv(file = "java.csv", header = F, sep = ",")
javascript = read.csv(file = "javascript.csv", header = F, sep = ",")
python = read.csv(file = "python.csv", header = F, sep = ",")
ruby = read.csv(file = "ruby.csv", header = F, sep = ",")
# Sort the data by watchers/forks to format them
java_sorted = java[order(java$V4),]
javascript_sorted = javascript[order(javascript$V4),]
python_sorted = python[order(python$V4),]
@ngsankha
ngsankha / mozbuild.sh
Created December 15, 2012 11:27
Mozilla build completion notifier. Uses Coocoo - https://github.com/sankha93/coocoo
cd oss/nightly/mozilla-central
./mach build
cd ../../..
python coocoo-notifier.py 127.0.0.1 "buildbot" "mozilla-central build complete"
@ngsankha
ngsankha / README.md
Created June 2, 2012 09:08
Creates an archive of tweets as a git repo

This Python script creates a git repo with your tweets. Obviously its limited by Twitter API limitations as you cannot retrieve more than 3200 tweets at a time.

Given the fact that Twitter doesn't give a fuck about our data, you may not find your old tweets ever again. So nothing is better than keeping an archive of tweets as a Git repo.

This is inspired by @holman's tweets repo. But this doesn't have a dependency on Madrox. Just plain Python and Git.

Usage

To create an archive of tweets initiate a git repo in a directory with git init. Then put the script in the directory and execute: