Skip to content

Instantly share code, notes, and snippets.

Avatar
⛸️
Focusing

Chen Bin redguardtoo

⛸️
Focusing
View GitHub Profile
@redguardtoo
redguardtoo / .aspell.en.pws
Created Sep 6, 2020
aspell personal plain text English dictionary
View .aspell.en.pws
personal_ws-1.1 en 2544
ABN
ACC
ACN
ACT
AD
AES
AI
AJAX
ALT
@redguardtoo
redguardtoo / sort-chinese-word-list.el
Created May 24, 2020
Sort Chinese word list by pinyin
View sort-chinese-word-list.el
(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 Apr 10, 2020
Use Emacs in ediff to resolve vcs conflicts
View ediff.sh
#!/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 Nov 29, 2020
My bash configuration
View .bashrc
##
# 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 / init-git.el
Last active Dec 2, 2019
vs-msg and magit integration
View init-git.el
(eval-after-load 'vc-msg-git
'(progn
(push '("p" "[p]rint" (lambda () (message "commit info=%s" vc-msg-previous-commit-info))) vc-msg-git-extra)
(push '("h" "[h]ello" (lambda () (message "hello"))) vc-msg-git-extra)
(push '("m" "[m]agit-find-file" (lambda ()
(let* ((info vc-msg-previous-commit-info)
(git-dir (locate-dominating-file default-directory ".git")))
(magit-find-file-other-window (plist-get info :id )
(concat git-dir (plist-get info :filename))))))
vc-msg-git-extra)))
@redguardtoo
redguardtoo / git-log-L-20,20:README.txt
Created Nov 27, 2019
git log -L20,20:README.md` at Git repo (HEAD is d9f6f3b619)
View git-log-L-20,20:README.txt
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
@redguardtoo
redguardtoo / hello.org
Last active Nov 19, 2019
test ediff on org file
View hello.org

hello

world this is test

console.log('hello world');

this is another test this is another test this is another test this is another test

View .skhdrc
# 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
@redguardtoo
redguardtoo / config
Last active Jun 9, 2020
i3 tile windows manager setup (config)
View config
# This file has been auto-generated by i3-config-wizard(1).
# It will not be overwritten, so edit it as you like.
#
# Should you change your keyboard layout somewhen, delete
# this file and re-run i3-config-wizard(1).
#
# i3 config file (v4)
#
# Please see http://i3wm.org/docs/userguide.html for a complete reference!
@redguardtoo
redguardtoo / status.conf
Last active Jun 9, 2020
My tile window manager i3 setup (status.conf)
View status.conf
cpu_usage {
format = "CPU: %usage"
}
# [[ wireless
wireless enp2s0 {
format_up = "W: %ip %quality %essid"
format_down = "W: down"
}