Skip to content

Instantly share code, notes, and snippets.

@ibrow
ibrow / gist:1751850
Created February 6, 2012 12:28
jQuery DOM index testing
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>jQuery DOM index testing</title>
<style type="text/css">
#wrap .rolloverlayer {
background: #eaeaea;
height: 100px;
width: 200px;
margin: 0 0 15px;
@ibrow
ibrow / greetings.js
Created September 30, 2011 20:25
Experimenting with Middle End
/**
* Simple module for greeting people
**/
var Tidy = require('./tidy');
var Greetings = function() { }
Greetings.prototype.hello = function(who) {
who = Tidy.trim(who);
return this.hello(who);
}
@ibrow
ibrow / gist:1042312
Created June 23, 2011 10:23
Benchmarking a VPS
# network download speed
wget http://cachefly.cachefly.net/100mb.test > /dev/null
# disk speed
dd if=/dev/zero of=test bs=64k count=16k conv=fdatasync
@ibrow
ibrow / gist:958723
Created May 6, 2011 10:14
Useful SVN Commands
# list only conflicts from a merge dry run
svn merge <SVN MERGE FROM> ./ --dry-run | grep -P '^(?=.{0,6}C)'
@ibrow
ibrow / vsftp-wk.sh
Created May 3, 2011 15:58
Number of unique users uploading to VSFTP
tail -n 100 /var/log/xferlog | awk '{print $14}' | sort -u | wc -l
@ibrow
ibrow / log-analysis.sh
Created April 2, 2011 23:34
Useful log analysis commands
# total non static pages a bot has scraped
awk '$7!~/css|png|jpeg|jpg|gif|js|ico/ {print $7}' /var/log/nginx/access.log | wc -l
# output error messages
awk '$3!~/notice|info/' error.log
@ibrow
ibrow / rc.lua
Created November 4, 2010 14:16
Snippet of my rc.lua file
-- Rob's Mods
awful.key({ modkey, "Shift" }, "z", function () awful.util.spawn("emacs") end),
-- awful.key({ modkey, "Shift" }, "e", function () awful.util.spawn("xfce4-terminal -x sup") end),
awful.key({ modkey, "Shift" }, "f", function () awful.util.spawn("firefox") end),
awful.key({ modkey, "Shift" }, "g", function () awful.util.spawn("chromium") end),
awful.key({ modkey, "Shift" }, "o", function () awful.util.spawn("opera") end),
awful.key({ modkey, "Shift" }, "m", function () awful.util.spawn("xterm mocp") end),
awful.key({ modkey, "Shift" }, "x", function () awful.util.spawn("thunar") end),
awful.key({ modkey }, "c", function () awful.util.spawn("gedit") end),
awful.key({ modkey, "Shift" }, "t", function () awful.util.spawn("xterm -fg AliceBlue -bg grey10") end),
@ibrow
ibrow / .emacs
Created October 25, 2010 11:39
My .emacs file
(add-to-list 'load-path "~/bin/emacs")
(setq-default indent-tabs-mode nil)
(setq standard-indent 4)
(setq tab-width 4)
(setq c-default-style "k&r" c-basic-offset 4)
; SUP email
(autoload 'post-mode "post.elc" "post-mode." t)
# When doing some heavy refactoring, you may need to update the package name
# within the code's docs. Snippet below can do this on bulk with grep and sed
grep "@package OldPackageName" ./* -lR --exclude-dir=".svn" | xargs sed -i 's/@package OldPackageName/@package NewPackageName/g'