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
@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 -
}
@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() {
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active July 21, 2024 01:20
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
@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);
@hrldcpr
hrldcpr / tree.md
Last active June 8, 2024 18:11
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!

@utsengar
utsengar / Sync_Async_loading_handlebars.js
Created April 2, 2012 20:41
synchronous and asynchronous loading of handlebars templates
/*
* This decorates Handlebars.js with the ability to load
* templates from an external source, with light caching.
*
* To render a template, pass a closure that will receive the
* template as a function parameter, eg,
* T.render('templateName', function(t) {
* $('#somediv').html( t() );
* });
* Source: https://github.com/wycats/handlebars.js/issues/82
@jboner
jboner / latency.txt
Last active July 24, 2024 06:44
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@afair
afair / gist:3803895
Last active August 7, 2023 07:43
PostgreSQL and Pgpool Architecture

Hey! I saw this has been indexed by the search engines. It is a first draft of a post I ended up publishing on my blog at: Scaling PostgreSQL With Pgpool and PgBouncer

Thanks for stopping by!

PostgreSQL and Pgpool Architecture

@caniszczyk
caniszczyk / clone-all-twitter-github-repos.sh
Created October 9, 2012 04:25
Clone all repos from a GitHub organization
curl -s https://api.github.com/orgs/twitter/repos?per_page=200 | ruby -rubygems -e 'require "json"; JSON.load(STDIN.read).each { |repo| %x[git clone #{repo["ssh_url"]} ]}'
@dlamichhane
dlamichhane / Solution to native gems on windows
Last active May 20, 2022 16:48
Installing Native gems on windows
I Copied from the following URL:
1) http://rubyonwindowsguides.github.io/book/ch02-05.html
Now we are fully equipped for Ruby development on Windows. Yet problem of installing native gems requires our attention and better explanation. DevKit’s smoke test passed without problem but does it mean we can install any gem written in C/C++? Unfortunately the answer is no.
Native gems might depend on other libraries which are hard, or sometimes, impossible to build on Windows. Example of such a gem is Nokogiri, HTML and XML parser for Ruby, built upon Libxml2 library. Libxml2 is XML parser and toolkit written in C. If you want to know how to deal, at least partially, with such a libraries you should continue reading this chapter. Otherwise you can freely skip to the section “Installing Ruby On Rails”.
c:\>gem install nokogiri --platform=ruby