Skip to content

Instantly share code, notes, and snippets.

View redguardtoo's full-sized avatar
⛸️
Focusing

Chen Bin redguardtoo

⛸️
Focusing
View GitHub Profile
For all major modes:
26854 13.38% winum-select-window-2 , 2, M-2
23086 11.50% winum-select-window-1 , 1, M-1
13787 6.87% evilmi-jump-items %, <visual-state> %, <normal-state> %
9807 4.89% my-switch-to-shell , x z, , x c
8410 4.19% evil-visualstar/begin-search-forward <visual-state> *
7888 3.93% my-counsel-recentf , r r
7442 3.71% my-multi-purpose-grep , q q
7429 3.70% winum-select-window-3 , 3, M-3
@redguardtoo
redguardtoo / sort-chinese-word-list.el
Created May 24, 2020 13:16
Sort Chinese word list by pinyin
(defconst my-chinese-pinyin-order-hash
#s(hash-table size 30 test equal data (
"" 375
"" 381
"" 81
"" 293
"" 72
"" 35
"" 264
"" 20
@redguardtoo
redguardtoo / ediff.sh
Created April 10, 2020 09:51
Use Emacs in ediff to resolve vcs conflicts
#!/bin/sh
[ -z "$MYEMACSCLIENT" ] && MYEMACSCLIENT="emacs"
# $1=$BASE, $2=$LOCAL, $3=$REMOTE, $4=$MERGED
if [ "$MYEMACSCLIENT" = "emacs" ]; then
$MYEMACSCLIENT -nw -Q --eval "(setq startup-now t)" -l "$HOME/.emacs.d/init.el" --eval "(progn (setq ediff-quit-hook 'kill-emacs) (if (file-readable-p \"$3\") (ediff-merge-files-with-ancestor \"$1\" \"$2\" \"$3\" nil \"$4\") (ediff-merge-files \"$2\" \"$3\" nil \"$4\")))"
else
$MYEMACSCLIENT -nw --eval "(progn (setq ediff-quit-hook 'kill-emacs) (if (file-readable-p \"$3\") (ediff-merge-files-with-ancestor \"$1\" \"$2\" \"$3\" nil \"$4\") (ediff-merge-files \"$2\" \"$3\" nil \"$4\")))"
fi
@redguardtoo
redguardtoo / .bashrc
Last active May 8, 2021 00:50
My bash configuration
##
# Bash 4+ required
# FROM,
# 1. http://tldp.org/LDP/abs/html/sample-bashrc.html
# 2. git://github.com/chenkaie/DotFiles.git
##
# If not running interactively, don't do anything
case $- in
*i*) ;;
@redguardtoo
redguardtoo / git-log-L-20,20:README.txt
Created November 27, 2019 13:29
git log -L20,20:README.md` at Git repo (HEAD is d9f6f3b619)
commit 6164972018ba3adbae2db1e7b286e2b811b3e7c2
Author: Matthieu Moy <git@matthieu-moy.fr>
Date: Thu Feb 25 09:37:27 2016 +0100
README.md: add hyperlinks on filenames
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff --git a/README.md b/README.md
# open terminal
cmd - return : ~/Applications/iTerm.app/Contents/MacOS/iTerm2 --single-instance -d ~
# focus window
cmd - h : yabai -m window --focus west
cmd - j : yabai -m window --focus south
cmd - k : yabai -m window --focus north
cmd - l : yabai -m window --focus east
# balance size of windows
[声母]
zh=V
ch=I
sh=U
[韵母]
iu=Q
ua=X
ia=X
uan=R
@redguardtoo
redguardtoo / sort-pyim-hanzi-order.el
Created June 14, 2019 12:18
sort chinese characters
(require 'cl-lib)
(defun my-read-file (file)
(with-temp-buffer
(insert-file-contents (file-truename file))
(buffer-string)))
;; (message "content=%s" (my-read-file))
(defun my-format-dictionary ()
(interactive)
(let* ((h (make-hash-table :size 1000))
@redguardtoo
redguardtoo / .emacs
Last active December 15, 2023 21:25
minimum emacs setup for Emacs plugin testing
;; A minimum .emacs to test Emacs plugins
(show-paren-mode 1)
(eval-when-compile (require 'cl))
;; test elisps download from internet here
(setq test-elisp-dir "~/test-elisp/")
(unless (file-exists-p (expand-file-name test-elisp-dir))
(make-directory (expand-file-name test-elisp-dir)))
(setq load-path
@redguardtoo
redguardtoo / install-emacs.sh
Last active June 23, 2022 03:50
Install emacs-nox on Linux
#!/bin/sh
[ -z "$EMACS_VERSION" ] && echo "Usage: EMACS_VERSION=25.1 install-emacs.sh or EMACS_VERSION=snapshot install-emacs.sh" && exit 1
[ -z "$EMACS_URL" ] && EMACS_URL="http://mirror.aarnet.edu.au/pub/gnu/emacs/"
# I've assign 12G memory to /tmp as ramdisk
[ -z "$EMACS_TMP" ] && EMACS_TMP="/tmp"
if [ "$EMACS_VERSION" != "snapshot" ]; then
echo "curl $EMACS_URL/emacs-$EMACS_VERSION.tar.gz"
curl $EMACS_URL/emacs-$EMACS_VERSION.tar.gz | tar xvz -C $EMACS_TMP
fi