Skip to content

Instantly share code, notes, and snippets.

View xshyamx's full-sized avatar
🎯
Life before death, strength before weakness, journey before destination

shyam xshyamx

🎯
Life before death, strength before weakness, journey before destination
View GitHub Profile
@xshyamx
xshyamx / gist:958853
Created May 6, 2011 12:20
Delete unversioned files in mercurial
hg st -nu | xargs rm
@xshyamx
xshyamx / gist:4722338
Last active December 12, 2015 05:29
Get public key from private key file
ssh-keygen -y -f ~/.ssh/xshyamx-keys.pem
@xshyamx
xshyamx / stackoverflow-tags-wordle.js
Created March 15, 2013 06:01
Create a wordle from stackoverflow.com/tags
fm = document.createElement('form');
fm.action = 'http://www.wordle.net/compose';
fm.method = 'post';
document.body.appendChild(fm);
ta = document.createElement('textarea');
ta.name = 'wordcounts';
fm.appendChild(ta);
ta.appendChild(document.createTextNode(
[].map.call(
document.querySelectorAll('.tag-cell'),
@xshyamx
xshyamx / Readme.md
Created April 9, 2013 08:29
Recipe 2: Preload Metadata

Recipe 2: Preload Metadata

Metadata that will be used across the application in various places can be cached using the application cache by using the JSON format and storing them as a javascript resource. Additional javascript code can be used while loading pages to include metadata from the javascript files and populate the combo boxes.

@xshyamx
xshyamx / Readme.md
Created April 9, 2013 08:40
Recipe 2: User Data/Preferences

Recipe 2: User Data/Preferences

Instead of the user scrolling through the entire list the most recently used items are promoted to the top, so the user can simply choose from his/her MRU list. We can attach a listener to the submit event of the form containing the combo box that requires the MRU functionality and store the values on each submit. When the form/page is reloaded the data stored in the HTML5 storage can be read back to construct an MRU list of items that can be appended to the top of the combo box.

@xshyamx
xshyamx / gav.py
Created July 4, 2013 13:06
Simple python script to generate a maven pom.xml file from a list of jars in a directory (with proxy support but, remember urllib2 proxy does not work for https)
import os
import json
import urllib2
import hashlib
import argparse
import urlparse
import traceback
# configurable parameters
@xshyamx
xshyamx / clrs.js
Last active January 3, 2016 20:49
Side by side comparison of the new colors defined in http://clrs.cc/
function colorMap(selectors) {
var a = [].map.call(document.querySelectorAll(selectors), function(v) { return v.innerHTML; });
var cmap = {};
a.reduce(function(p,c) { if ( c.indexOf('#') == 0 ) {cmap[p.toLowerCase()] = c;} return c; });
return cmap;
}
var oldColors = colorMap('.cf div h1.f3,.cf div h2.f3'),
newColors = colorMap('.pvfl div h1,.pvfl div h2'),
colors = {};
@xshyamx
xshyamx / names.js
Created March 6, 2014 13:42
For Better names in Chance.jshttp://chancejs.com/#todo
/*
* For http://chancejs.com/#todo - Better names
* Get national data from http://www.ssa.gov/oact/babynames/limits.html
* extract names.zip
* cat yob*.txt > all.csv
*/
var fs = require('fs');
var filename = 'all.csv', males = {}, females = {};
@xshyamx
xshyamx / git.sh
Created March 16, 2014 07:12
Tell git to ignore changes in a particular file
git update-index --assume-unchanged [files]
@xshyamx
xshyamx / ec2-public-hostname.sh
Created March 16, 2014 07:14
Get the public hostname in ec2 from within the instance
curl http://169.254.169.254/latest/meta-data/public-hostname