Skip to content

Instantly share code, notes, and snippets.

View s5unty's full-sized avatar

Sun Wuan s5unty

View GitHub Profile
@s5unty
s5unty / urxvt-scrollback-buffer-words.plugin.zsh
Created April 25, 2012 04:59
zsh-complete-words-from-urxvt-scrollback-buffer
# http://superuser.com/questions/117051/how-do-i-save-the-scrollback-buffer-in-urxvt
# http://blog.plenz.com/2012-01/zsh-complete-words-from-tmux-pane.html
_urxvt_scrollback_buffer_words() {
local expl
local -a w
# depends URxvt.print-pipe configuration
# insure the ~/.Xresources or ~/.Xdefaults:
# ...
# URxvt.print-pipe: cat > /tmp/xxx
#
@s5unty
s5unty / mutt-grep
Created September 11, 2011 13:47
wrapper around [mu|recoll], the [mail|file] indexing/searching utility
#! /bin/sh -
# inspiration from: http://www.zsh.org/mla/users/2007/msg01187.html
# require a POSIX sh, on those systems where the POSIX sh is not in /bin
# (like Solaris), you may need to adapt the shebang line above
# (/usr/xpg4/bin/sh on Solaris). You also need a terminfo aware "tput",
# ncurses one (the default on most systems) will do.
# wrapper around mu, the mail indexing/searching utility for mutt.
# in your ~/.muttrc:
@s5unty
s5unty / rword
Created July 12, 2011 09:45
将标准日本语单词文件中的随机一行输出到屏幕 osd
#!/bin/sh
# 添加 cron 调度时,在命令前必须添加 DISPLAY=:0,否则 osd 不能正常显示,例如
#
# # 每 5 分钟在第 15 课(616行开始)和第 16 课(707行结束)的单词中随机挑选一个显示:
# */5 * * * * env DISPLAY=:0 /sun/desktop/rword /sun/archive/japanese_word.txt 616 707 &
#
file=$1 # 字典文件绝对路径
from=$2 # 随机输出行数范围的最小值
till=$3 # 随机输出行数范围的最大值
@s5unty
s5unty / friendfeed.py
Created May 2, 2011 14:10
syncing friendfeed to follow5 using python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: set noexpandtab:
# digu 应该限制了经由 api 方式更新的频率(>5m),所以我无法保证每次都能正常更新。
# 不要手动删除 friendfeed 最近 n 条历史记录,否则会异常并导致重复发推
# 异常主要原因是前后两次获取到的 friendfeed 记录可能会不一致
import json
import urllib
import urllib2