Skip to content

Instantly share code, notes, and snippets.

View kanru's full-sized avatar

Kan-Ru Chen kanru

View GitHub Profile
@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 / 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 / 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 / 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 / .userconfig
Last active October 11, 2015 03:48
B2G user config
# -*- mode: sh -*-
GECKO_PATH=/home/kanru/zone2/mozilla/b2g18
export REMOTE_DEBUGGER=1
#export B2G_DEBUG=y
#export B2G_NOOPT=y
#export B2G_PROFILING=1
GECKO_OBJDIR=${GECKO_OBJDIR}-`basename $GECKO_PATH`
@kanru
kanru / Makefile
Created September 28, 2012 11:08
X11 EGL
all: egl
egl: egl.cpp
g++ -lX11 -lEGL -lGLESv2 egl.cpp -o egl
@kanru
kanru / bench.c
Created November 7, 2012 07:59
Little benchmark
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*
* Compile using |gcc -O0 bench.c -o bench|
*/
#include <stdio.h>
#include <sys/time.h>
#define TIMES 10000000
@kanru
kanru / jschewing.js
Created January 17, 2013 02:07
npapi-chewing example
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- /
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
'use strict';
(function() {
var debugging = true;
var debug = function(str) {
if (!debugging)
(defun eshell-last-argument (n)
(let* ((input (substring-no-properties
(eshell-previous-input-string (1- n))))
(parse (with-temp-buffer
(insert input)
(car (reverse (eshell-parse-arguments
(point-min) (point-max)))))))
(eval parse)))
(defun eshell-insert-last-word (n)
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<selectfont>
<acceptfont>
<pattern>
<patelt name="family"><string>terminus</string></patelt>
</pattern>
</acceptfont>
<!-- we want the unicode version -->