Skip to content

Instantly share code, notes, and snippets.

@du-song
du-song / Call Stack
Created December 17, 2012 12:12
QS Hang Issue
Sampling process 44336 for 3 seconds with 1 millisecond of run time between samples
Sampling completed, processing symbols...
Analysis of sampling Quicksilver (pid 44336) every 1 millisecond
Process: Quicksilver [44336]
Path: /Applications/Quicksilver.app/Contents/MacOS/Quicksilver
Load Address: 0x100000000
Identifier: com.blacktree.Quicksilver
Version: ß71 (3936)
Code Type: X86-64 (Native)
Parent Process: launchd [170]
# Uncrustify 0.59
#
# General options
#
# The type of line endings
newlines = auto # auto/lf/crlf/cr
# The original size of tabs in the input
@du-song
du-song / fack.py
Created August 2, 2012 06:09
fack - free from arguable code style
#!/usr/bin/python
import sys, re, subprocess
a = sys.argv[1].split("_")
subprocess.call("ack -i " + sys.argv[1] + "\\|" + (''.join(a) if (len(a)>1) else re.sub(r'([a-z]*)([A-Z])', r'\1_\2', a[0])), shell=True)
@du-song
du-song / gist:1842466
Created February 16, 2012 05:56
Calibre Chapter Detection Setting
//*[((name()='h1' or name()='h2') and re:test(., 'chapter|book|section|part\s+', 'i')) or @class = 'chapter' or re:test(., '^\s*.{0,2}[一二三四五六七八九十百千上中下序]+[部章节篇].{0,50}', '')]
@du-song
du-song / signipa.sh
Created January 24, 2012 11:13
Sign IPA with installed Apple developer license
#!/bin/sh
#
# detail in blog post: http://blog.rollingcode.org/2010/07/28/sign-ipa-with-installed-developer-license/
#
SAVEDIR=`pwd`
WORKDIR=/tmp/ipa_$RANDOM$RANDOM
WORKIPA=/tmp/ipa_$RANDOM$RANDOM.ipa
echo Unpacking $1 to $WORKDIR
mkdir -p $WORKDIR
@du-song
du-song / simple.pac
Created December 16, 2011 20:30
relatively short PAC file for bypassing GFW and blocking ads on iPhone.
function FindProxyForURL(url, host) {
var p = "PROXY example.server:1989";
if (shExpMatch(host, "*twitter.com*")) return p;
if (shExpMatch(host, "*t.co")) return p;
if (shExpMatch(host, "*bit.ly")) return p;
if (shExpMatch(host, "*j.mp")) return p;
if (shExpMatch(host, "*facebook.com*")) return p;
if (shExpMatch(host, "*facebook.net*")) return p;
if (shExpMatch(host, "*fbcdn.net")) return p;
if (shExpMatch(host, "*twimg.com")) return p;
@du-song
du-song / known_xauth_keys.yml
Created November 23, 2011 06:46
Known Weibo XAuth Keys
known_xauth_keys:
- name: "Air微博"
version: "1.8.4"
consumer_key: "313042886"
consumer_secret: "f52136f5036559b45e171f2e0335613d"
@du-song
du-song / RestartMail.applescript
Created July 25, 2011 01:42
Restart Mail everyday
--- Restart Mail everyday!
--- 12 12 * * * osascript /scripts/RestartMail.applescript >/tmp/Mail.log 2>&1 &
on run
try
tell application "System Events" to set MailRun to (count of (every process whose name is "Mail")) > 0
if MailRun then
tell application "Mail" to quit
do shell script "sleep 5"
tell application "Mail" to open
end if
@du-song
du-song / hosts
Created July 3, 2011 14:03
/etc/hosts for Google in China
203.208.46.178 googleusercontent.com webcache.googleusercontent.com themes.googleusercontent.com www.google.com.hk docs.google.com images.google.com encrypted.google.com groups.google.com clients2.google.com feedproxy.google.com spreadsheets.google.com picasaweb.google.com sites.google.com plus.google.com mail.google.com apis.google.com maps.google.com www.google.com gg.google.comencrypted-tbn1.google.com mts0.google.com mts1.google.com
tell application "FanRadio"
set s to current track
end tell
tell application "Adium"
go away with message s
end tell