Skip to content

Instantly share code, notes, and snippets.

View xupeng's full-sized avatar

Xupeng Yun xupeng

View GitHub Profile
@xupeng
xupeng / check_mDNSResponder.py
Created December 17, 2011 06:30
Restart mDNSResponder if it's not responsible (just for MacOS)
#!/usr/bin/env python
""" Restart mDNSResponder if it's not responsible (just for MacOS)
Run this script as root via cron.
* * * * * /Users/xupeng/bin/check_mDNSResponder.py
"""
import os
@xupeng
xupeng / free-buffer-cache.py
Created December 17, 2011 06:31
Utility script for setting access pattern of MySQL log files to recycle buffer cache
#!/usr/bin/env python
"""
Utility script for setting access pattern of MySQL log files to recycle
buffer cache
"""
import os
import sys
import glob
@xupeng
xupeng / gist:1577134
Created January 8, 2012 03:58
Embed subtitle into video
mencoder -o with-subtitle.mp4 -ovc lavc -lavcopts vcodec=mpeg4 -oac copy -sub subtitle.srt -utf8 -subfont-text-scale 2 -font "STHeiti" movie.mov
@xupeng
xupeng / embed-subtitle.sh
Created January 8, 2012 04:59
使用 mencoder 给视频内嵌字幕
#!/bin/bash
mencoder -o with-subtitle.avi -ovc lavc -lavcopts mbd=2:trell=yes:v4mv=yes:vbitrate=16000 -oac copy -sub subtitle.srt -utf8 -subfont-text-scale 2 -overlapsub -font "STHeiti" movie.mov
@xupeng
xupeng / gist:1851483
Created February 17, 2012 07:11
All kinds of agents
xupeng@homes ~ $ pgrep -fli agent
18815 /Library/ScriptingAdditions/SIMBL.osax/Contents/Resources/SIMBL Agent.app/Contents/MacOS/SIMBL Agent
16031 /System/Library/PrivateFrameworks/CommerceKit.framework/Versions/A/Resources/storeagent
15175 /System/Library/CoreServices/NetAuthAgent.app/Contents/MacOS/NetAuthAgent
15174 /System/Library/CoreServices/NetAuthAgent.app/Contents/MacOS/NetAuthSysAgent
901 /Applications/Day One.app/Contents/Library/LoginItems/Day One Agent.app/Contents/MacOS/Day One Agent -psn_0_241723
887 /Library/Parallels/Parallels Service.app/Contents/PlugIns/Parallels Desktop Control Agent.app/Contents/MacOS/prl_deskctl_agent
884 /System/Library/CoreServices/AirPort Base Station Agent.app/Contents/MacOS/AirPort Base Station Agent -launchd -allowquit
876 /usr/libexec/warmd_agent
874 /Applications/iPhoto.app/Contents/Library/LoginItems/PhotoStreamAgent.app/Contents/MacOS/PhotoStreamAgent
@xupeng
xupeng / gist:1851761
Created February 17, 2012 08:13
Book list
http://www.amazon.com/Freedom-TM-Daemon-ebook/dp/B002VUFKDY/ref=sr_1_3?s=digital-text&ie=UTF8&qid=1329465407&sr=1-3
http://www.amazon.com/Daemon-ebook/dp/B003QP4NPE/ref=sr_1_1?s=digital-text&ie=UTF8&qid=1329465407&sr=1-1
http://itunes.apple.com/us/book/high-performance-mysql-second/id396901665?mt=11
http://www.amazon.com/Understanding-MySQL-Internals-ebook/dp/B0043EWUIO/ref=sr_1_1?s=digital-text&ie=UTF8&qid=1329465489&sr=1-1
http://www.amazon.com/MySQL-Troubleshooting-What-Queries-ebook/dp/B0077F7T8W/ref=sr_1_1?s=digital-text&ie=UTF8&qid=1329465550&sr=1-1
@xupeng
xupeng / packages-on-openwrt.txt
Created February 26, 2012 10:37
packages on my OpenWrt
6in4 - 10-1
6to4 - 7-1
aria2 - 1.14.1-1
at - 3.1.13-1
base-files - 103-r30712
base-files-network - 3
bash - 4.2-2
blkid - 1.42-1
block-mount - 0.2.0-7
bridge - 1.5-1
@xupeng
xupeng / dm.py
Created March 6, 2012 23:35
Delete SMS from iPhone with Python
#!/usr/bin/env python
#coding=utf8
import os
from sqlite3 import dbapi2 as sqlite
def message_read(flags):
"""reimplementation of an sqlite user defined function called by a trigger
on the messages table.
the trigger checks the message flags to see if a message has been read to
@xupeng
xupeng / gist:2308292
Created April 5, 2012 05:46
Buffalo WZR-HP-AG300H
root@bazaar /root # free -m
total used free shared buffers
Mem: 126812 29844 96968 0 0
-/+ buffers: 29844 96968
Swap: 0 0 0
root@bazaar /root # df -h
Filesystem Size Used Available Use% Mounted on
rootfs 30.6M 19.8M 10.8M 65% /
/dev/root 30.6M 19.8M 10.8M 65% /
tmpfs 61.9M 2.1M 59.8M 3% /tmp
@xupeng
xupeng / gist:2728385
Created May 19, 2012 00:46
自动跳转到广播页
// ==UserScript==
// @name Hide someone
// @description Hide someone
// @author Xupeng
// @include http://www.douban.com
// @version 1.0
// ==/UserScript==
if (window.location.href == 'http://www.douban.com/') {
window.location.href = 'http://www.douban.com/update/';