Skip to content

Instantly share code, notes, and snippets.

View boopathi's full-sized avatar
💭
I may be slow to respond.

Boopathi Rajaa boopathi

💭
I may be slow to respond.
View GitHub Profile
@boopathi
boopathi / radix_sort.py
Created November 26, 2011 09:19 — forked from hiroshi-manabe/radix_sort.py
Radix sort
base = 10
def radix_sort(x, max):
radix = 1
while radix < max:
x = counting_sort(x, radix)
radix *= base
return x
def counting_sort(a, radix):
@boopathi
boopathi / dict.txt
Created May 28, 2012 04:53
Wordament - Solution cpp
This file has been truncated, but you can view the full file.
aron
aaronic
aarp
aasvogel
abac
abacate
abacaxi
abacay
abacinate
abacination
@boopathi
boopathi / logger.rb
Created July 11, 2012 11:05
Access Log parser
#!/usr/bin/ruby
#require "rubygems"
#require "gruff"
db={}
#g = Gruff::Bar.new("600x480")
#g.minimum_value=0
#g.maximum_value=20000
class Module
def subclasses
classes = []
ObjectSpace.each_object do |klass|
next unless Module === klass
classes << klass if self > klass
end
classes
end
end
@boopathi
boopathi / adauth.rb
Created October 15, 2012 09:45
Ruby AD Authentication
# Usage:
# user = ActiveDirectoryUser.authenticate('boopathi','password')
# user.first_name # => "Boopathi"
# user.flanderized_first_name # => "Boopathi Rajaa"
# user.groups # => ["Mac Users", "Geeks", "Ruby Coders", ... ]
require 'net/ldap' # gem install ruby-net-ldap
class ActiveDirectoryUser
### BEGIN CONFIGURATION ###
@boopathi
boopathi / tssh.py
Created November 9, 2012 16:41
tssh - Threaded ssh
#!/usr/bin/python
# This doesn't mean threading in ssh. What it means is, every thread
# that this program spawns, creates a new subprocess to perform the
# system "ssh" command.
# Sample Usages
# =============
#
# 1.
@boopathi
boopathi / server_main.js
Created November 11, 2012 23:42 — forked from nmorse/server_main.js
basic nowJS on connect and disconnect methods
var node_static = require('node-static');
var node_static_file = new(node_static.Server)('./client');
var http = require('http'),
players = {},
server = http.createServer(function(req, res) {
// static file server
req.addListener('end', function () {
node_static_file.serve(req, res);
});
}).listen(80);
@boopathi
boopathi / gist:4386980
Last active December 10, 2015 05:18 — forked from seekshiva/gist:4386309
upstream thin {
server unix:/tmp/thin.0.sock;
server unix:/tmp/thin.1.sock;
server unix:/tmp/thin.2.sock;
}
server {
listen 80;
server_name my-domain-name.com
@boopathi
boopathi / jscompile.py
Last active December 13, 2015 16:59
A python based build tool that uses Google Closure Compiler and Coffee-script compiler to build our JavaScript code and CoffeeScript code. For more info, check http://boopathi.in/blog/writing-your-own-javascript-build-system/
#!/usr/bin/python2.7
import httplib, urllib
from os import chdir, path
from subprocess import Popen, PIPE
# Change the script's working directory to
# the script's own directory
chdir(path.dirname(path.abspath(__FILE__)))
import os
import os.path
import sys
from graphite.render.hashing import ConsistentHashRing
## Settings
# Absolute path to the Graphite Data Directory
DATA_DIR = '/data/graphite/whisper/'
## You need not modify anything below this