Skip to content

Instantly share code, notes, and snippets.

View kwokhou's full-sized avatar
🎯
Focusing

Andy Yong kwokhou

🎯
Focusing
View GitHub Profile
@kwokhou
kwokhou / better-defaults.sh
Last active August 10, 2018 21:21
Better macOS defaults
#!/bin/bash
# Turn on / off the no so "natural" mouse scroll direction
defaults write -g com.apple.swipescrolldirection -bool NO
# Auto hide dock
defaults write com.apple.dock autohide -bool YES
# Use `sudo mdutil -i off "/Volumes/foo"` to stop indexing any volume.
sudo defaults write /.Spotlight-V100/VolumeConfiguration Exclusions -array "/Volumes"
@kwokhou
kwokhou / .zshrc
Created August 2, 2018 01:06
Zsh Config
# User configuration
# export MANPATH="/usr/local/man:$MANPATH"
# You may need to manually set your language environment
# export LANG=en_US.UTF-8
# Preferred editor for local and remote sessions
if [[ -n $SSH_CONNECTION ]]; then
export EDITOR='vim'
else
export EDITOR='nvim'
@kwokhou
kwokhou / .tmux.conf
Created August 2, 2018 01:03
Tmux config
# 0 is too far from ` ;)
set -g base-index 1
# Automatically set window title
set-window-option -g automatic-rename on
# Titles (window number, program name, active (or not)
set-option -g set-titles on
set-option -g set-titles-string '#H:#S.#I.#P #W #T'
#set -g default-terminal screen-256color
@kwokhou
kwokhou / nvim.vim
Last active July 5, 2019 13:30
neovim config
"""""""""""""""""""""""""""""""""""""
" => General
"""""""""""""""""""""""""""""""""""""
" Let VIM remember more history
set history=500
" Enable filetype detection, plugin & indenting
filetype plugin indent on
set autoread
@kwokhou
kwokhou / basic2.vim
Last active July 18, 2018 03:06
basic2.vim
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Maintainer:
" Amir Salihefendic — @amix3k
"
" Awesome_version:
" Get this config, nice color schemes and lots of plugins!
"
" Install the awesome version from:
"
" https://github.com/amix/vimrc
@kwokhou
kwokhou / psqlback.sh
Last active March 12, 2018 04:03
PostgreSQL Daily Backup script
#!/bin/bash
#
# Daily PostgreSQL maintenance: vacuuming and backuping.
# From: https://luxagraf.net/src/automatic-offsite-postgresql-backups
##
set -e
for DB in $(psql -l -t -U postgres -hlocalhost |awk '{ print $1}' |grep -vE '^-|:|^List|^Name|template[0|1]|postgres|\|'); do
echo "[`date`] Maintaining $DB"
echo 'VACUUM' | psql -U postgres -hlocalhost -d $DB
DUMP="/path/to/backup/dir/$DB.`date '+%Y%m%d'`.sql.gz"
@kwokhou
kwokhou / launch.json
Created January 18, 2018 02:27
vscode-ruby rbenv
{
"name": "Rails server",
"type": "Ruby",
"request": "launch",
"cwd": "${workspaceRoot}",
"program": "${workspaceRoot}/bin/rails",
"useBundler": false,
"showDebuggerOutput": true,
"pathToRDebugIDE": "/Users/andy/.rbenv/shims/rdebug-ide",
"args": [
@kwokhou
kwokhou / .eslintrc
Created June 25, 2017 01:29
Basic Eslint config for React using Airbnb style rules
{
"parser": "babel-eslint",
"env": {
"browser": true
},
"ecmaFeatures": {
"jsx": true
},
"extends": [
"airbnb"
@kwokhou
kwokhou / AndroidManifest.xml
Created May 5, 2017 02:56
RN Release AndroidManifest (put under ./android/app/src/release/)
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.myco.myapp"
android:versionCode="1"
android:versionName="1.0">
<uses-permission android:name="android.permission.READ_PHONE_STATE" tools:node="remove" />
</manifest>
@kwokhou
kwokhou / config.fish
Created May 3, 2017 14:18
Fish Prompt with Git integration
function fish_prompt --description 'Write out the prompt'
# Just calculate these once, to save a few cycles when displaying the prompt
if not set -q __fish_prompt_hostname
set -g __fish_prompt_hostname (hostname|cut -d . -f 1)
end
if not set -q __fish_prompt_normal
set -g __fish_prompt_normal (set_color normal)
end