Skip to content

Instantly share code, notes, and snippets.

View feifanzhou's full-sized avatar

Feifan Zhou feifanzhou

View GitHub Profile
[user]
name = "Feifan Zhou"
email = "feifan@me.com"
# http://haacked.com/archive/2014/07/28/github-flow-aliases/
# https://gist.github.com/mwhite/6887990
# https://stackoverflow.com/a/5188364/472768
[alias]
branches = branch --sort=-committerdate
count = count-objects -vH
{
"global": {
"check_for_updates_on_startup": false,
"show_in_menu_bar": false,
"show_profile_name_in_menu_bar": false
},
"profiles": [
{
"complex_modifications": {
"parameters": {
@feifanzhou
feifanzhou / hammerspoon — init.lua
Last active August 28, 2021 18:10
Hammerspoon config (window moving and resizing)
-- Inspired by Linux alt-drag or Better Touch Tools move/resize functionality
-- from https://gist.github.com/kizzx2/e542fa74b80b7563045a#gistcomment-2023593
-- Command-Ctrl-move: move window under mouse
-- Command-Control-Shift-move: resize window under mouse
function get_window_under_mouse()
local my_pos = hs.geometry.new(hs.mouse.getAbsolutePosition())
local my_screen = hs.mouse.getCurrentScreen()
return hs.fnutils.find(hs.window.orderedWindows(), function(w)
return my_screen == w:screen() and
w:isStandard() and
@feifanzhou
feifanzhou / .zshrc
Last active August 16, 2022 18:22
My ZSH config (modified from oh-my-zsh default)
export EDITOR=nano
export SHELL=/bin/zsh
# https://www.cyberciti.biz/faq/unix-linux-bash-history-display-date-time/
export HISTTIMEFORMAT="%d/%m/%y %T "
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
for file in ~/.{path,rbenvrc,bash_prompt,exports,aliases,functions,extra,stripe_profile}; do
[ -r "$file" ] && [ -f "$file" ] && source "$file";
@feifanzhou
feifanzhou / recommended_vscode_settings.json
Last active August 26, 2018 03:41
Recommended settings for VSCode for Trustwork engineers
@feifanzhou
feifanzhou / .bash_prompt
Last active August 22, 2019 21:52
Bash prompt
# Shell prompt based on the Solarized Dark theme.
# Screenshot: http://i.imgur.com/EkEtphC.png
# Heavily inspired by @necolas’s prompt: https://github.com/necolas/dotfiles
# iTerm → Profiles → Text → use 13pt Fira Code with 1.1 vertical spacing.
if [[ $COLORTERM = gnome-* && $TERM = xterm ]] && infocmp gnome-256color >/dev/null 2>&1; then
export TERM='gnome-256color';
elif infocmp xterm-256color >/dev/null 2>&1; then
export TERM='xterm-256color';
fi;
@feifanzhou
feifanzhou / .gitconfig
Last active August 21, 2019 14:14
Git settings I use
# http://haacked.com/archive/2014/07/28/github-flow-aliases/
# https://gist.github.com/mwhite/6887990
# https://stackoverflow.com/a/5188364/472768
[alias]
branches = branch --sort=-committerdate
count = count-objects -vH
co = checkout
col = checkout @{-1}
com = checkout master
newbr = checkout -b
@feifanzhou
feifanzhou / setup_dim.sh
Created March 19, 2017 20:33
Control external screen brightness from Terminal
#!/bin/bash
# Usage: dim <number 0 – 100>
# http://chopmo.dk/2017/01/12/control-monitor-brightness-from-osx.html
cd ~/Developer
git clone https://github.com/kfix/ddcctl.git && cd ddcctl
make install
echo -e "#!/bin/bash\nddcctl -d 1 -b $1 && ddcctl -d 2 -b $1" > /usr/local/bin/dim
chmod +x /usr/local/bin/dim
@feifanzhou
feifanzhou / setup_ruby
Created June 6, 2015 01:39
Install Ruby on DO Ubuntu
apt-get install git
git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_rc
echo 'eval "$(rbenv init -)"' >> ~/.bash_rc
exec bash
git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
apt-get install libssl-dev
apt-get install zlibc zlib1g zlib1g-dev
apt-get install bundler
@feifanzhou
feifanzhou / Default (OSX).sublime-keymap
Created February 8, 2015 17:31
Sublime keybindings
[
{ "keys": ["ctrl+tab"], "command": "next_view" }, // Make Ctrl+tab work the way you expect it to
{ "keys": ["ctrl+shift+tab"], "command": "prev_view" },
{ "keys": ["super+shift+g"], "command": "goto_definition" },
{ "keys": ["super+v"], "command": "paste_and_indent" }, // Make Paste-and-indent the default
{ "keys": ["super+shift+v"], "command": "paste" },
{ "keys": ["ctrl+x","o"], "command": "focus_neighboring_group" } // Copied from emacs
]