Skip to content

Instantly share code, notes, and snippets.

View gaurav's full-sized avatar

Gaurav Vaidya gaurav

View GitHub Profile
@gaurav
gaurav / file-upload.pl
Last active September 4, 2015 02:55
A small cookbook program showing how to upload files with Perl
#!/usr/bin/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
gaurav / Nature Precedings, partial fix.patch
Created July 18, 2010 06:12
Nature Preceedings plugin for CiteULike, partial fix
Index: plugins/python/naturepreceedings.py
===================================================================
--- plugins/python/naturepreceedings.py (revision 581)
+++ plugins/python/naturepreceedings.py (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
gaurav / AtomZombieLog_Apr30.txt
Created April 29, 2011 20:20
A log of my first complete Atom Zombie Smasher game. At last!
Atom Zombie Smasher
Commander: Gaurav
Start date: April 26, 2011
Zeppelin: Five Howling Zeppelin
Codename: OperationProngLightning135
----------------------------------
JANUARY 1961: AURORA AUSTRALIS.
Shorter daytime.
@gaurav
gaurav / readgb.pl
Created June 14, 2011 10:37
ReadGB.pl: Reading a GenBank file with BioPerl
#!/usr/bin/perl
use 5.0100;
use strict;
use warnings;
# Load the SeqIO module.
use Bio::SeqIO;
@gaurav
gaurav / get_fusion_table.py
Created August 24, 2011 06:19
Simple code to download a Fusion Table which is being shared publically
#!/usr/bin/python
import urllib
tableid = 1344517 # A dummy but public fusion table I created
sql = "SELECT * FROM %d" % tableid
file = urllib.urlopen("https://www.google.com/fusiontables/api/query?sql=" + urllib.quote_plus(sql))
print file.read()
# Expected output:
@gaurav
gaurav / bulkloader-log-20110829.143822
Created August 29, 2011 21:06
Error output while uploading LayerIndex
[INFO 2011-08-29 14:38:22,517 bulkloader.py] Logging to bulkloader-log-20110829.143822
[INFO 2011-08-29 14:38:22,518 bulkloader.py] Throttling transfers:
[INFO 2011-08-29 14:38:22,518 bulkloader.py] Bandwidth: 250000 bytes/second
[INFO 2011-08-29 14:38:22,518 bulkloader.py] HTTP connections: 8/second
[INFO 2011-08-29 14:38:22,518 bulkloader.py] Entities inserted/fetched/modified: 20/second
[INFO 2011-08-29 14:38:22,518 bulkloader.py] Batch Size: 10
[INFO 2011-08-29 14:38:23,649 bulkloader.py] Opening database: bulkloader-progress-20110829.143822.sql3
[DEBUG 2011-08-29 14:38:23,656 adaptive_thread_pool.py] [WorkerThread-0] WorkerThread: started
[DEBUG 2011-08-29 14:38:23,657 adaptive_thread_pool.py] [WorkerThread-1] WorkerThread: started
[DEBUG 2011-08-29 14:38:23,657 adaptive_thread_pool.py] [WorkerThread-2] WorkerThread: started
@gaurav
gaurav / gist:1215190
Created September 13, 2011 21:10
Spotlight not functional
Machine:
PowerPC G5 Mac OS X 10.5.8
Symptoms:
1. Spotlight completely non-functional.
2. Running `sudo mdutil -i on /` results in error code -1.
3. No 'mds' or 'mdworker' running in Activity Manager.
Solution:
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist
@gaurav
gaurav / unicode.json
Created November 17, 2011 22:51
A GeoJSON file containing Unicode text.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Atom Zombie Smasher
Commander: Gaurav
Start date: November 19, 2011
Zeppelin: One Moon Zeppelin
Codename: OperationWakingHeron528
----------------------------------
JANUARY 1961: AURORA AUSTRALIS.
Shorter daytime.
@gaurav
gaurav / iucn.json
Created November 22, 2011 03:38
A bigger GeoJSON file
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.