Skip to content

Instantly share code, notes, and snippets.

View banerRana's full-sized avatar

Rana Banerjee banerRana

  • Automated It Solutions
  • Washington, DC
View GitHub Profile
@hrldcpr
hrldcpr / tree.md
Last active January 24, 2026 21:18
one-line tree in python

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!

@rylan
rylan / gist:1285281
Created October 13, 2011 19:37
Get an ASTNode from an ICompilationUnit (Eclipse JDT)
import org.eclipse.jdt.core.dom.ASTNode;
import org.eclipse.jdt.core.dom.ASTParser;
import org.eclipse.jdt.core.dom.AST;
public ASTUtil {
public static ASTNode getASTNode(ICompilationUnit unit) {
ASTParser parser = ASTParser.newParser(AST.JLS3);
parser.setKind(ASTParser.K_COMPILATION_UNIT);
parser.setSource(unit);
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active March 1, 2026 06:00
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
@ydnar
ydnar / csspec.sample.js
Created January 3, 2010 19:47
CSSpec, BDD for CSS. Theoretical.
/* CSSpec: Theoretical BDD for CSS based on jQuery. Doesn’t exist yet. */
with(CSSpec) {
describe("all layouts", function() {
describe("body", function() {
it("has a white background", function() {
value(this.css("background-color")).should.be.color("#fff")
})
it("has black text", function() {
@troy
troy / save-redfin-listing-images-bashrc
Created September 10, 2009 13:22
Given a redfin.com house listing URL, save all full-size images
# usage: redfin-images "http://www.redfin.com/WA/Seattle/123-Home-Row-12345/home/1234567"
function redfin-images() {
wget -O - $1 | grep "full:" | awk -F \" '{print $4}' | xargs wget -
}