Skip to content

Instantly share code, notes, and snippets.

View kanru's full-sized avatar

Kan-Ru Chen kanru

View GitHub Profile
@kanru
kanru / supl.diff
Created September 13, 2012 09:11
Patch to build supl-proxy and fallback to non-TLS connection
--- trunk.old/config.mk 2011-10-25 19:41:31.000000000 +0000
+++ trunk/config.mk 2012-06-07 02:37:28.000000000 +0000
@@ -1,10 +1,10 @@
-# Generated by ./configure script - Tue Oct 25 22:41:31 EEST 2011
+# Generated by ./configure script - Thu Jun 7 02:37:27 UTC 2012
# Modifications to this file are lost if ./configure is ran again.
CONF_VERSION = 1.0.5
-CONF_CFLAGS = -Wall -O2
+CONF_CFLAGS = -Wall -O2 -g
@kanru
kanru / irc.sh
Created September 4, 2012 02:58
irc connection script
#!/bin/sh
if ping -c1 -q kanru.info > /dev/null 2>&1; then
ssh -C -f -L 6667:localhost:6667 kanru.info sleep 10
weechat-curses
fi
@kanru
kanru / gist:3368424
Created August 16, 2012 08:33
Debian exim4 multiple smart host config
smarthost:
debug_print = "R: smarthost for $local_part@$domain"
driver = manualroute
domains = ! +local_domains
transport = remote_smtp_smarthost
route_data = ${if exists{CONFDIR/smarthosts}\
{${lookup{${domain:$h_from:}}lsearch{CONFDIR/smarthosts}\
{$value}{DCsmarthost}}}\
{DCsmarthost}}
host_find_failed = defer
@kanru
kanru / nasabackground.sh
Created July 9, 2012 02:51
Use NASA / NationalGeographic IOTD as background wallpaper
#!/bin/bash
# grabs the nasa image of the day by RSS feed and updates the gnome
# background. add this to your cron jobs to have this happen daily. this is,
# obviously, a hack, that is likely to break at the slightest change of NASA's
# RSS implementation. yay standards!
#EDITED FOR feh
rss=`wget -q -O - http://www.nasa.gov/rss/lg_image_of_the_day.rss`
@kanru
kanru / hgrep.py
Created March 15, 2012 05:47
hg grep
# from http://blog.axant.it/archives/283
import itertools, os, os.path
def hgrep(ui, repo, what, **opts):
files = []
status = repo.status(clean=True)
for f in itertools.chain(status[0], status[1], status[4], status[6]):
files.append(os.path.join(repo.root, f))
@kanru
kanru / gist:2027952
Created March 13, 2012 10:04
B2G build dependency for Debian Squeeze
# gecko
build-dep iceweasel
libnotify-dev
yasm (>= 1.0.0)
libcurl4-openssl-dev
mesa-common-dev
# gonk
gcc-multilib
g++-multilib
@kanru
kanru / gist:1975946
Created March 5, 2012 01:54
Trackpoint X11 auto config
Section "InputClass"
Identifier "Trackpoint Wheel Emulation"
MatchProduct "TrackPoint"
MatchDevicePath "/dev/input/event*"
Option "EmulateWheel" "true"
Option "EmulateWheelButton" "2"
Option "Emulate3Buttons" "false"
Option "XAxisMapping" "6 7"
Option "YAxisMapping" "4 5"
EndSection
@kanru
kanru / sudoku-test.lisp
Created March 4, 2012 15:51 — forked from hanshuebner/sudoku-test.lisp
Ruby book Sudoku solver in Common Lisp
(defmacro deftestpackage (package-name for-package &optional (test-library-package-name :unit-test))
"Define a new package PACKAGE-NAME used to test the package
designated by FOR-PACKAGE. The new package will import all symbols
from FOR-PACKAGE and :USE the package designated by
TEST-LIBRARY-PACKAGE-NAME which supposedly contains unit testing
functions and macros."
`(defpackage ,package-name
(:use ,test-library-package-name ,@(mapcar #'package-name (package-use-list for-package)))
(:import-from ,for-package
,@(let (symbols)
@kanru
kanru / plurk.lisp
Created March 4, 2012 15:05
Plurk Client
;;;; plurk.lisp --- Plurk Client
;;; Copyright (C) 2012 Kan-Ru Chen
;;; Author(s): Kan-Ru Chen <[email protected]>
;;; Permission is hereby granted, free of charge, to any person obtaining a
;;; copy of this software and associated documentation files (the "Software"),
;;; to deal in the Software without restriction, including without limitation
;;; the rights to use, copy, modify, merge, publish, distribute, sublicense,
@kanru
kanru / Generated table
Created March 4, 2012 14:54
Generate password lookup table
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
+----------------------------------------------------
A| U C " S a K n v } n : A n + s # ? @ _ d | 1 E { g J
B| W [ > F ^ i R k M N E < 3 d & L B s [ r l o u / w n
C| k c ] G G F ; Q O \ T G t X G = V 2 b ~ N [ 1 3 ^ O
D| x G A 0 ` Y v 6 2 y 3 w ~ ] b N ) 0 q ' ? J y + u Y
E| V j = c ^ ! R P z N c s R ? Z / K k c F J z \ ' J u
F| c 5 E q . K 6 F } z 9 = ( B = I 7 ( K H = \ + ' 0 Q
G| C ' : p % ~ q # 2 f { 7 | { { + [ z } p T 2 % l ( K
H| r v Z w m @ + k w S 0 ) J 7 + } ^ H ) t G ( f 9 A 3