Skip to content

Instantly share code, notes, and snippets.

@shantanusingh
shantanusingh / elasticsearch.sh
Created October 31, 2011 20:43 — forked from alkema/elasticsearch.sh
install elasticsearch on ubuntu
sudo apt-get install unzip
wget https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.17.4.zip
unzip elasticsearch-0.17.4.zip
sudo apt-get install python-software-properties
sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
sudo apt-get update
sudo apt-get install sun-java6-jre sun-java6-plugin
sudo mv elasticsearch-0.17.4 /usr/local/share
cd elasticsearch-servicewrapper
sudo mv service /usr/local/share/elasticsearch-0.17.4/bin
@shantanusingh
shantanusingh / redis_schema.txt
Created January 17, 2012 15:59 — forked from deepak/redis_schema.txt
how to name keys in redis for keyvalue stores
# how to name keys in redis for keyvalue stores
http://code.google.com/p/redis/wiki/TwitterAlikeExample
http://rediscookbook.org/introduction_to_storing_objects.html
http://www.slideshare.net/playnicelyapp/redis-schema-design-for-playnicely-redis-london-meetup
antirez has a book about keyvalue design in the pipeline
http://code.google.com/p/redis/wiki/IntroductionToRedisDataTypes
schema:
<namespace>:<globalObject>
@shantanusingh
shantanusingh / bolly_2012_json.js
Created January 20, 2012 11:28
Scrapes Wikipedia(http://en.wikipedia.org/wiki/Bollywood_films_of_2012) to compile a list of movies(2012) as a JSON string
(function(){
var movs = new Array();
$.fn.textNodes = function()
{
function textNodeFiler(){
return this.nodeType == 3 || this.nodeName == "BR" ;
}
return $(this).contents().filter(textNodeFiler).add($(this).find('*').contents().filter(textNodeFiler));
};
@shantanusingh
shantanusingh / gist:2272004
Created April 1, 2012 06:33 — forked from bihe/init.d play
init.d script to launch Play framework under Ubuntu
#!/bin/sh
### BEGIN INIT INFO
## END INIT INFO
# Path to play install folder
PLAY_HOME=/usr/share/play
PLAY=$PLAY_HOME/play
# Path to the JVM
JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk
@shantanusingh
shantanusingh / movingredistolinode.md
Created April 19, 2012 20:46 — forked from csanz/movingredistolinode.md
Moving your redis instance to linode

Move your redis instance to Linode!

create linode server instance

local:

<shell>$ssh root@(IP ADDRESS)

remote:

@shantanusingh
shantanusingh / deadlock-detection.md
Created June 28, 2012 20:01
Debugging Deadlocks in PostgreSQL

Queries For Deadlock Detection

select pg_class.relname,pg_locks.* from pg_class,pg_locks where pg_class.relfilenode=pg_locks.relation;

select * from pg_locks;

select * from pg_locks where granted = 'f' //the query that is waiting
select * from pg_locks where transactionid = 'xx' // queries running in a transaction
select * from pg_stat_activity

@shantanusingh
shantanusingh / writefiletosize.go
Created July 19, 2012 15:36
Writes an output file of desired size ( flags check pending)
package main
import(
"io"
"os"
"fmt"
"flag"
)
var size = flag.Int64("size", 1024, "Size of the file to create")
var oName = flag.String("filename", "C:\\output.txt", "Name of the file to create")
@shantanusingh
shantanusingh / gist:3162343
Created July 23, 2012 06:58
Sublime Text User Preferences
{
"color_scheme": "Packages/Color Scheme - Default/Solarized (Light).tmTheme",
"font_face": "Consolas",
"font_size": 11.0
}
@shantanusingh
shantanusingh / createemptyfile.bat
Created August 2, 2012 10:09
Create an empty file on windows
copy nul emptyfile.txt > nul
@shantanusingh
shantanusingh / gist:3274335
Created August 6, 2012 13:06 — forked from rolo/gist:1481128
Install Postgres 9.1, PostGIS and create PostGIS template on Ubuntu 11.10 Oneiric Ocelot
#!/bin/bash
#
# Install Postgres 9.1, PostGIS and create PostGIS template on a clean Ubuntu 11.10 Oneiric Ocelot box
# http://wildfish.com
# add the ubuntu gis ppa
sudo apt-get -y install python-software-properties
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt-get update