Skip to content

Instantly share code, notes, and snippets.

# coding:utf8
import redis
import logging
import click
from itertools import izip_longest
# hosts = ('172.16.14.2', '172.16.14.4', '172.16.14.7', '172.16.14.16')
@amzyang
amzyang / .inputrc
Created February 12, 2014 02:49
readline
set keymap vi
set editing-mode vi
set completion-ignore-case on
"\eOC": forward-word
"\eOD": backward-word
" ": clear-screen
@amzyang
amzyang / .editrc
Created February 12, 2014 02:42
libedit
bind -v
bind ^l ed-clear-screen
magic-enter () {
if [[ -z $BUFFER ]]; then
if git rev-parse --is-inside-work-tree > /dev/null 2>&1; then
echo
git diff --minimal
echo
fi
fi
zle accept-line
}
\usepackage{fontspec}
\usepackage{xeCJK}
\setCJKmainfont {微软雅黑}
\documentclass{article}
\usepackage{CJK}
\begin{document}
\begin{CJK}{UTF8}{gbsn}
你好
You can mix latin letters and chinese.
\end{CJK}
@amzyang
amzyang / gist:5962988
Created July 10, 2013 02:28
修正 readthedocs.org 下的 html 文件本地浏览
# use at your own risk
sed -i 's#url(//#url(http://#g' **/*.html
sed -i 's#="//#="http://#g' **/*.html
@amzyang
amzyang / control_pentadactyl.vim
Created March 29, 2012 15:01
use :Dactyl command to control pentadactyl directly in vim
if (!exists('g:firefox_execute') || empty(g:firefox_execute))
let g:firefox_execute = 'firefox'
endif
fun! DactylComplete(A, L, P) "{{{
if (!exists('g:DactylCompleteLoaded'))
let l:tmp = tempname()
let l:getListCommands = 'js let hives = modules.commands.allHives;'
\ .'var names = [];'
\ .'Array.forEach(hives, function(hive) {'
\ .' let lists = hive._list;'
@amzyang
amzyang / createshortcut.js
Created November 29, 2011 07:03
create pentadactyl commandline options
// createshortcut.js -- ++pentadactyl
// @Author: eric.zou ([email protected])
// @License: GPL (see http://www.gnu.org/licenses/gpl.txt)
// @Created: Tue 29 Nov 2011 01:24:05 PM CST
// @Last Change: Tue 29 Nov 2011 02:23:36 PM CST
// @Revision: 41
// @Description:
// @Usage:
// @TODO:
// @CHANGES:
@amzyang
amzyang / mouse_gesture.js
Created August 19, 2011 12:46
按住 ctrl/shift时, 不执行鼠标手势
"use strict";
XML.ignoreWhitespace = false;
XML.prettyPrinting = false;
var MESSAGES = {
"en-US": [],
"zh-CN": []
};
var STATE_READY = 0;