Skip to content

Instantly share code, notes, and snippets.

View lichray's full-sized avatar

Zhihao Yuan lichray

View GitHub Profile
@lichray
lichray / cplusplus.xml
Created April 28, 2012 21:55
C++ Reference OpenSearch Plugin
<SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/" xmlns:os="http://a9.com/-/spec/opensearch/1.1/">
<os:ShortName>C++ Reference</os:ShortName>
<os:Description>Reference of the C++ Language Library</os:Description>
<os:InputEncoding>ISO-8859-1</os:InputEncoding>
<os:Image width="16" height="16">data:image/x-icon;base64,
AAABAAEAEBAAAAAAAABoBQAAFgAAACgAAAAQAAAAIAAAAAEACAAAAAAAAAEAAAAAAAAAAAAAAAEA
AAABAAD/8/MA/9bYAP7v8gDZxskAy3t+AP/NzgD/5ukA/OTmAP/6+gD5jZIA94uQAP+5ugDnhooA
5oaJAOvS1QDVwMIA/8DBAGlJSgBOMTIA//v+AJxqagDxwsQA/vLzAP66vQC8cHMA/+nqAFowMQD/
+/sA/9zgAMN0dwBsUlEA9oyQAPz3+AD7oqYA7Y2RAOyNkAD/ursA8oiMAP3R1AD94+UA6+fnAP/1
+AD8vb8A287QAOXh4QD/0dMA/uztAOqHiwD86usA4IiLAP/+/wD4rrEA3dnZAP/8/wBtVVYA+8LF
@lichray
lichray / quote.c
Created April 13, 2012 06:18
Reliably quote a string as a single argument for /bin/sh.
#include <sys/param.h>
#include <sys/wait.h>
#include <ctype.h>
#include <paths.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
@lichray
lichray / fcitx_4.2.2_all_in_one.patch
Created April 6, 2012 07:30
Upgrade fcitx to 4.2.2
diff -ruN --exclude=CVS ../fcitx.orig/Makefile ./Makefile
--- ../fcitx.orig/Makefile 2012-02-07 14:57:07.000000000 -0600
+++ ./Makefile 2012-04-26 15:43:23.803360889 -0500
@@ -6,7 +6,7 @@
#
PORTNAME= fcitx
-PORTVERSION= 4.2.0
+PORTVERSION= 4.2.2
CATEGORIES= chinese x11
@lichray
lichray / sc.py
Created March 3, 2012 16:18
A simple screenshoter (python + ImageMagick)
#!/usr/bin/env python
# Zhihao Yuan <lichray at gmail.com>
SSCMD = 'import -quality 04 -border -frame png:-'
SSCMD_ALT = 'import -quality 04 png:-'
from cStringIO import StringIO
import sys, os
from getopt import getopt
import pygtk
@lichray
lichray / gnumeric_all_in_one.patch
Created February 17, 2012 02:14
Upgrade Gnumeric to 1.11.1
diff -ruN --exclude=CVS /usr/ports/devel/libgsf.orig/Makefile /usr/ports/devel/libgsf/Makefile
--- /usr/ports/devel/libgsf.orig/Makefile 2011-11-06 22:24:51.000000000 -0600
+++ /usr/ports/devel/libgsf/Makefile 2012-02-16 09:57:40.190157000 -0600
@@ -7,7 +7,7 @@
#
PORTNAME= libgsf
-PORTVERSION= 1.14.21
+PORTVERSION= 1.14.22
PORTREVISION?= 0
@lichray
lichray / fcitx_all_in_one_4.2.0.patch
Created February 6, 2012 10:23
Upgrade fcitx to 4.2.0
diff -ruN --exclude=CVS /usr/ports/chinese/fcitx.orig/Makefile /usr/ports/chinese/fcitx/Makefile
--- /usr/ports/chinese/fcitx.orig/Makefile 2011-11-11 00:36:12.000000000 -0600
+++ /usr/ports/chinese/fcitx/Makefile 2012-02-06 02:43:35.582174787 -0600
@@ -6,7 +6,7 @@
#
PORTNAME= fcitx
-PORTVERSION= 4.1.2
+PORTVERSION= 4.2.0
CATEGORIES= chinese x11
@lichray
lichray / pure_new_addons.shar
Created December 6, 2011 06:23
New ports after pure-0.51
# This is a shell archive. Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file". Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
# pure-mpfr
# pure-mpfr/pkg-descr
# pure-mpfr/distinfo
@lichray
lichray / pure_all_in_one_0.51.patch
Created December 6, 2011 06:22
Upgrade pure to 0.51
diff -ruN --exclude=CVS /usr/ports/lang/pure.orig/Makefile /usr/ports/lang/pure/Makefile
--- /usr/ports/lang/pure.orig/Makefile 2012-01-20 14:12:38.000000000 -0600
+++ /usr/ports/lang/pure/Makefile 2012-01-22 14:06:22.574870368 -0600
@@ -2,32 +2,31 @@
# Date created: 2011-03-17
# Whom: Zhihao Yuan <lichray@gmail.com>
#
-# $FreeBSD: ports/lang/pure/Makefile,v 1.3 2012/01/20 20:12:38 brooks Exp $
+# $FreeBSD: ports/lang/pure/Makefile,v 1.2 2011/04/09 19:21:47 makc Exp $
#
@lichray
lichray / netbsd_r1.4.patch
Created December 2, 2011 07:29
The NetBSD way to fix v_increment
Index: src/dist/nvi/vi/v_increment.c
diff -u src/dist/nvi/vi/v_increment.c:1.3 src/dist/nvi/vi/v_increment.c:1.4
--- src/dist/nvi/vi/v_increment.c:1.3 Sun Jan 18 03:45:50 2009
+++ src/dist/nvi/vi/v_increment.c Tue Aug 11 21:28:02 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: v_increment.c,v 1.3 2009/01/18 03:45:50 lukem Exp $ */
+/* $NetBSD: v_increment.c,v 1.4 2009/08/11 21:28:02 aymeric Exp $ */
/*-
* Copyright (c) 1992, 1993, 1994
@lichray
lichray / 13widechar_horrors.dpatch
Created December 2, 2011 07:28
The Debian way to fix v_increment
#! /bin/sh /usr/share/dpatch/dpatch-run
## 13widechar_horrors.dpatch by <hesso@pool.math.tu-berlin.de>
##
## DP: This patch tries to cope with the fact that widechar support
## DP: in nvi is at best rudimentary.
## DP: Hunk 1)
## DP: * Due to "ch = *t", this code is not wide-char aware, so
## DP: cast the value to a proper type so the KEY_ macros make
## DP: the right choice.
## DP: Hunk 2)