Skip to content

Instantly share code, notes, and snippets.


Gaurav Vaidya gaurav

View GitHub Profile
gaurav / gist:41182
Created Dec 29, 2008
A quick command to list all the files modified by an author in a repository
View gist:41182
git log --name-status --pretty=format:'' --author=authorname | sort | uniq
View gist:49959
perl -ne 'lc; $total = length; s/[^l]//g; print "Total: $total\tLs: " . length($_) . "\n";'
gaurav / gist:110333
Created May 12, 2009
A Perl one-liner to check that $seconds_since_the_house % $NO will distribute correctly across $NO machines.
View gist:110333
# A one-liner to ensure that $seconds_since_the_hour % $NO will distribute equally.
perl -Mstrict -e 'my $NO = 6; my @a = (); push @a, int rand(60) for(1 .. 1_000); my %b = (); $b{$_ % $NO}++ for(@a); print "$_ => $b{$_}\n" for sort { $a <=> $b } keys %b;'
gaurav / perldoc-server for non-installed modules.diff
Created Sep 4, 2009
A first step to getting Perldoc-Server to work on local folders.
View perldoc-server for non-installed modules.diff
--- perldoc-server.original 2009-09-04 14:23:55.000000000 +0800
+++ perldoc-server 2009-09-04 14:35:57.000000000 +0800
@@ -31,6 +31,7 @@
+ 'search|l=s@',
'help|h|?' => sub{pod2usage(1)},
gaurav /
Last active Sep 4, 2015
A small cookbook program showing how to upload files with Perl
use strict;
use warnings;
# This is intended as an easy-to-use cookbook example to getting started
# uploading files on Perl. Please let me (gaurav at ggvaidya dot com) know
# if you have any comments or suggestions for this example.
# It is made available under the same license terms as the Perl interpreter.
gaurav / Nature Precedings, partial fix.patch
Created Jul 18, 2010
Nature Preceedings plugin for CiteULike, partial fix
View Nature Precedings, partial fix.patch
Index: plugins/python/
--- plugins/python/ (revision 581)
+++ plugins/python/ (working copy)
@@ -107,7 +107,7 @@
abs = abstract.renderContents().strip()
abs = re.sub(r'<[^>]+>','',abs)
abs = unescape(abs)
- print "abstract\t%s" % abs
+ print "abstract\t%s" % abs.encode('utf-8')
gaurav / .vimrc
Last active Apr 29, 2017
My .vimrc file
View .vimrc
" Activate pathogen.
call pathogen#infect()
call pathogen#helptags()
" These are a few of my favourite settings.
syntax on
set background=dark
set hlsearch
set incsearch
set smartindent
# This is the program I wrote to crack this fun little cipher:
# The clue clearly indicates that this is just a simple substitution cipher [1]; even better, it looks like ROT13 [2],
# except that you clearly don't move every letter along by exactly 13 places. So how many letters do you need to move
# it along by? There's only 26 letters in the English alphabet: let's try every possible value!
# [1]
# [2]
gaurav / AtomZombieLog_Apr30.txt
Created Apr 29, 2011
A log of my first complete Atom Zombie Smasher game. At last!
View AtomZombieLog_Apr30.txt
Atom Zombie Smasher
Commander: Gaurav
Start date: April 26, 2011
Zeppelin: Five Howling Zeppelin
Codename: OperationProngLightning135
Shorter daytime.
gaurav /
Created Jun 14, 2011 Reading a GenBank file with BioPerl
use 5.0100;
use strict;
use warnings;
# Load the SeqIO module.
use Bio::SeqIO;