Skip to content

Instantly share code, notes, and snippets.

@harit-sunrun
harit-sunrun / _.md
Created June 10, 2013 21:35
Tributary inlet
@harit-sunrun
harit-sunrun / _.md
Created June 10, 2013 19:53
D3 Test
@harit-sunrun
harit-sunrun / flask blueprint.py
Created March 23, 2013 14:11
Registering multiple modules with flask blueprints. This will help to separate a project into multiple modules
# Project Structure
facebook/
runserver.py
feed/
__init__.py
views.py
chat/
__init__.py
views.py
@harit-sunrun
harit-sunrun / Sublime: Preferences.sublime-settings
Last active December 11, 2015 18:39
Make you Sublime look beautiful
Install this theme http://buymeasoda.github.com/soda-theme/
and http://www.levien.com/type/myfonts/Inconsolata.otf font
then make changes in your Sublime Text -> Preferences -> Settings - User as following
{
"color_scheme": "Packages/Color Scheme - Default/Solarized (Dark).tmTheme",
"font_face": "Inconsolata-dz",
"font_size": 12.0,
"ignored_packages":
@harit-sunrun
harit-sunrun / PackageYourApp.xslt
Created September 18, 2012 21:12
Package Java Module as jar with dependencies included
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<archive>
<addMavenDescriptor>false</addMavenDescriptor>
<manifest>
@harit-sunrun
harit-sunrun / MapReduceBaseTemplate.java
Created August 2, 2012 22:37
This is basic template you would usually need to write a Map reduce program. Most part would remain same, except Job related inputs and input/output type classes
import org.apache.hadoop.conf.Configured;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.Reducer;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
import org.apache.hadoop.util.Tool;
@harit-sunrun
harit-sunrun / CitationHistogram.java
Created July 30, 2012 14:11
Build the count of counts for cited patents from patent dataset
package com.hadoop.patent;
/**
* This program collect data about how many times a patent has been cited
* input data - http://data.nber.org/patents/
* use the citation data set cite75_99.txt and the patent description data set apat63_99.txt.
*/
import org.apache.hadoop.conf.Configuration;
@harit-sunrun
harit-sunrun / InOrderPredecessor.java
Created June 27, 2012 21:50
Find inOrder successor and inOrder predecessor in binary search tree (BST)
Node predecessor(Node node) {
if ((node.left == null) && (node.right==null)) {
return node;
}
if (node.right != null) {
return predecessor(node.right);
}
if (node.left != null) {
return predecessor(node.left);
}
@harit-sunrun
harit-sunrun / cdyne_address_verifier_advanced.py
Created May 9, 2012 18:34
Query CDYNE Advanced Address Verification web service using Python
"""
This Gist will show you how to verify a postal address using CDYNE advanced address verification web service
The following code assumes that you have a valid license key
Document Reference : http://pav3.cdyne.com/Pavservice.svc/help/operations/VerifyAddressAdvanced
"""
import json
import urllib2
import urllib
var ajaxSuggest = false
function submitSuggestion() {
url = '/suggest/'
ajaxSuggest = false;
if (window.XMLHttpRequest) { // if we're on Gecko (Firefox etc.), KHTML/WebKit (Safari/Konqueror) and IE7
ajaxSuggest = new XMLHttpRequest(); // create our new Ajax object
if (ajaxSuggest.overrideMimeType) { // older Mozilla-based browsers need some extra help
ajaxSuggest.overrideMimeType('text/xml');
}
}