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 / Boot2Docker.md
Created February 25, 2015 12:04
Boot2Docker Windows Proxy

Setup proxy on Boot2Docker Windows

  1. Start Boot2Docker
  2. Add HTTP_PROXY and HTTPS_PROXY variables in /var/lib/boot2docker/profile
  3. Restart docker daemon sudo /etc/init.d/docker restart
@xshyamx
xshyamx / cypher-mode.sh
Last active December 16, 2020 13:27
Extract Neo4j Cypher keywords, clauses & functions
#!/bin/sh
url=http://m2.neo4j.org/content/repositories/snapshots/org/neo4j/neo4j-cypher-compiler-2.2/2.2-SNAPSHOT/neo4j-cypher-compiler-2.2-2.2-20140807.002630-9-sources.jar
fn=$(echo $url | sed -re 's/^.*\/([^/]*)$/\1/')
curl -s -o $fn -L $url
jar xf $fn org/neo4j/cypher/internal/compiler/
echo Cypher Keywords
grep --no-filename -re 'keyword(' org/neo4j/cypher/internal/compiler/ \
| sed 's/keyword(/\n\0/g' \
| awk '/keyword\("/ { print tolower($0) }' \
@xshyamx
xshyamx / to-emacs
Created July 17, 2014 11:19
Pipe output of a shell command into a new emacs buffer from Git Bash
#!/bin/sh
fn="$RANDOM"
while read -r line
do
echo $line >> /tmp/$fn
done
/e/software/emacs-24.3/bin/emacsclientw -n /tmp/$fn
@xshyamx
xshyamx / emacs-sendto-shortcut
Last active August 29, 2015 13:58
Emacs target for shortcut to be placed in C:\Users\xshyamx\AppData\Roaming\Microsoft\Windows\SendTo
E:\software\emacs-24.2\bin\emacsclientw.exe -n -a e:\software\emacs-24.2\bin\runemacs.exe --server-file c:\Users\xshyamx\AppData\Roaming\.emacs.d\server\server
@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
@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 / 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 / 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 / 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 / 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.