Skip to content

Instantly share code, notes, and snippets.

@nodokodo
nodokodo / style_guide.md
Created April 18, 2012 02:22 — forked from dominictarr/style_guide.md
style guide

High level style in javascript.

Opinions are like assholes, every one has got one.

This one is mine.

Punctuation: who cares?

Punctuation is a bikeshed. Put your semicolons, whitespace, and commas where you like them.

@nodokodo
nodokodo / mv-script-to-body.sh
Created March 4, 2012 02:47
Move <script> tags to bottom of <body> using sed
#!/bin/sh
# warning: only tested on single line script tags, no doubt broken on multi-line
# useful for includes!
[ $# -eq 0 ] && { echo "Usage: ${0} file-name" ; exit 1; }
$FILE=$1
sed -in '/script/{h;d};/\/body/{H;g}' $FILE
@nodokodo
nodokodo / update-node.sh
Created February 26, 2012 16:43
Node.JS Update from Source
#!/bin/sh
[ $# -eq 0 ] && { echo "Usage: ${0} version-string" ; exit 1; }
VERSION=$1
BUILD_DIR=/usr/local/src/node
ARC="node-v${VERSION}.tar.gz"
mkdir -p $BUILD_DIR
cd $BUILD_DIR
# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
#
# Update 7 Oct 2010:
# - This example does *not* appear to work with Chrome >=6.0. Apparently,
# the WebSocket protocol implementation in the cramp gem does not work
# well with Chrome's (newer) WebSocket implementation.
#
# Requirements:
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby
@nodokodo
nodokodo / gist:1274870
Created October 10, 2011 08:33
node-canvas pre-requisites for ubuntu 11.04
sudo apt-get install libcairo2-dev libjpeg8-dev libgif-dev
@nodokodo
nodokodo / iptables-redirect-lo-hi.sh
Created August 27, 2011 01:24
IPTables: Redirect Privileged to Stealthed, Non-Privileged Port
#!/bin/sh
FW='/sbin/iptables'
IP='123.123.123.123' # public ip
LO=80 # privileged port
HI=8000 # non-privileged port
PM=0x2a # packet mark - 32bit integer
# allow input on both ports