Skip to content

Instantly share code, notes, and snippets.

View liangzan's full-sized avatar

Wong Liang Zan liangzan

View GitHub Profile
@liangzan
liangzan / .Xresources
Created January 19, 2012 23:26
Xresources for configuring urxvt
! urxvt
URxvt*buffered: true
URxvt*cursorBlink: true
URxvt*underlineColor: yellow
URxvt*font: xft:inconsolata:size=10:antialias=true
URxvt*depth: 32
URxvt*borderless: 1
URxvt*scrollBar: false
URxvt*loginShell: true
Urxvt*secondaryScroll: true # Enable Shift-PageUp/Down in screen
@liangzan
liangzan / gmail_checker.rb
Created January 19, 2012 23:20
Gmail checker for Xmobar
# Gmail checker for Xmobar
#
# Install the ruby-gmail and mime gem to system
# Put the script under ~/path/to/gmail_checker.rb
# Make sure it is executable
require 'gmail'
gmail = Gmail.new('example@gmail.com', 'password')
mail_count = gmail.inbox.count(:unread)
@liangzan
liangzan / .xmobarrc
Created January 19, 2012 23:17
Xmobar configuration
Config { font = "xft:inconsolata:size=10:antialias=true"
, bgColor = "#002b36"
, fgColor = "#657b83"
, position = Top
, lowerOnStart = True
, commands = [ Run Network "wlan0" ["-L","0","-H","32","--normal","green","--high","red"] 10
, Run Cpu ["-L","3","-H","50","--normal","green","--high","red"] 10
, Run Memory ["-t","Mem: <usedratio>%"] 10
, Run Date "<fc=#93a1a1>%a %b %_d %Y %H:%M</fc>" "date" 10
, Run DiskIO [("/", "IO: <total>"), ("sda4", "<total>")] [] 10
@liangzan
liangzan / violate_each.rb
Created May 13, 2011 03:13
violating the each block
foo.items.each do |i|
i.do_whatever
break; # he really placed a semi colon
end
@liangzan
liangzan / .gitconfig
Created April 27, 2011 04:44
git configuration
[giggle]
compact-mode = false
main-window-geometry = 700x562+8+50
[user]
name = Wong Liang Zan
email = zan@liangzan.net
[color]
ui = auto
[color "branch"]
current = yellow reverse
@liangzan
liangzan / remove_magic_comment.diff
Created April 21, 2011 03:26
removes the magic comment for ruby mode
diff --git a/ruby-mode/ruby-mode.el b/ruby-mode/ruby-mode.el
index 94cb9ab..d810146 100644
--- a/ruby-mode/ruby-mode.el
+++ b/ruby-mode/ruby-mode.el
@@ -350,7 +350,7 @@ Also ignores spaces after parenthesis when 'space."
((forward-char)))))
(insert coding-system)))
((looking-at "\\s *#.*coding\\s *[:=]"))
- (t (insert "# -*- coding: " coding-system " -*-\n"))
+ (t (insert ""))
@liangzan
liangzan / gist:833370
Created February 18, 2011 07:15
sync.js profile
Statistical profiling result from profile-12980120047188966.log, (1058 ticks, 3 unaccounted, 0 excluded).
[Unknown]:
ticks total nonlib name
3 0.3%
[Shared libraries]:
ticks total nonlib name
59 5.6% 0.0% 00ada000-00adb000
@liangzan
liangzan / recursiveRemoveFiles.js
Created February 2, 2011 14:12
A Node.js script to remove all files in a directory recursively
var fs = require('fs')
, path = require('path')
, _ = require('underscore');
var rootPath = "/path/to/remove";
removeDirForce(rootPath);
// path should have trailing slash
function removeDirForce(dirPath) {
fs.readdir(dirPath, function(err, files) {
User.username_equals("ben")
User.send(:username_equals, "ben")