Skip to content

Instantly share code, notes, and snippets.

Suresh Prajapati toddlers

Block or report user

Report or block toddlers

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:5442133
#!/usr/bin/env ruby
# A simply utility to show character counts for each line of input and
# highlight lines longer than 80 characters.
# Written as an example for
# Examples:
# $ hilong Gemfile

Follow these steps to install Graphite on a fresh Ubuntu 12.04 instance. Make sure you read and understand the commands because by the time you read this, things could be outdated.


Installing dependencies

# apt-get install libpq-dev
# apt-get install python-dev python-pip python-cairo python-psycopg2
# apt-get install python-django python-django-tagging
toddlers / remote_diff
Created May 6, 2013
remote_diff: grab a path from 2 websites and diff them a naive implementation, diffs the md5's if the files are not text
View remote_diff
path1=`echo $1 | awk -F, '{print $1}'`/$2
path2=`echo $1 | awk -F, '{print $2}'`/$2
if `curl -Ss $path1 | file - | grep text`; then
diff <(curl -Ss $path1) <(curl -Ss $path2)
diff <(curl -Ss $path1 | md5) <(curl -Ss $path2 | md5)
toddlers /
Created May 28, 2013
Simple YAML fine validation for syntax
#! /bin/bash
set -a
if [ -z "$file" ]; then
echo "need YAML file as first arg"
exit 2
if [ -f $file ]; then
use strict ;
use warnings ;
use constant DEBUG => 0 ;
my ($adjtimex) = grep { -f $_ } qw(/sbin/adjtimex ./adjtimex);
die "Need adjtimex - install or download from and put into current dir\n"
toddlers / ruby_calculator.rb
Created Jun 2, 2013
simple ruby calculator
View ruby_calculator.rb
class Calculator
def initialize
add: ->(a,b) { a + b },
subtract: ->(a,b) { a - b },
divide: ->(a,b) { a / b },
multiply: ->(a,b) { a * b },
power: ->(a,b) { a ** b }
View gitlog.txt
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
And every time you need to see your log, just type in
git lg
Or, if you want to see the lines that changed
git lg -p
toddlers / poweroftwo.rb
Last active Dec 18, 2015
Write A Function To Determine If A Number Is A Power Of 2
View poweroftwo.rb
def power_of_2?(number)
return false if number == 0
while(number % 2 == 0)
number = number / 2
return false if number > 1

Backend Architectures



ror, scala, jetty, erlang, thrift, mongrel, comet server, my-sql, memchached, varnish, kestrel(mq), starling, gizzard, cassandra, hadoop, vertica, munin, nagios, awstats

toddlers / password.rb
Last active Dec 18, 2015
passwd file parsing
View password.rb
# On a system the /etc/passwd has entries with duplicate uids, can you write a python program to print
# the users with duplicate uids.
# User x,y,z duplicate uid 10001 on line 4,7,8
# User x,x duplicate uid 10001 on line 4,10
# This is the initial need to update this
require 'pp'
z = {}
You can’t perform that action at this time.