Skip to content

Instantly share code, notes, and snippets.

View migrate.py
# 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')
View .inputrc
set keymap vi
set editing-mode vi
set completion-ignore-case on
"\eOC": forward-word
"\eOD": backward-word
" ": clear-screen
View .editrc
bind -v
bind ^l ed-clear-screen
View magic-enter.zsh
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
}
View xelatex
\usepackage{fontspec}
\usepackage{xeCJK}
\setCJKmainfont {微软雅黑}
View cjk
\documentclass{article}
\usepackage{CJK}
\begin{document}
\begin{CJK}{UTF8}{gbsn}
你好
You can mix latin letters and chinese.
\end{CJK}
@amzyang
amzyang / gist:5962988
Created Jul 10, 2013
修正 readthedocs.org 下的 html 文件本地浏览
View gist:5962988
# 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 Mar 29, 2012
use :Dactyl command to control pentadactyl directly in vim
View control_pentadactyl.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 Nov 29, 2011
create pentadactyl commandline options
View createshortcut.js
// createshortcut.js -- ++pentadactyl
// @Author: eric.zou (frederick.zou@gmail.com)
// @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 Aug 19, 2011
按住 ctrl/shift时, 不执行鼠标手势
View mouse_gesture.js
"use strict";
XML.ignoreWhitespace = false;
XML.prettyPrinting = false;
var MESSAGES = {
"en-US": [],
"zh-CN": []
};
var STATE_READY = 0;