Skip to content

Instantly share code, notes, and snippets.

View henrytseng's full-sized avatar

Henry Tseng henrytseng

View GitHub Profile
@henrytseng
henrytseng / .bash_profile
Last active September 27, 2019 14:19
Bash profile git branch
source $HOME/.bash_aliases
source $HOME/.ssh/iterm2-color.sh
# colors
PS1='\w\[\033[0;32m\]$( git branch 2> /dev/null | cut -f2 -d\* -s | sed "s/^ / [/" | sed "s/$/]/" )\[\033[0m\] \$ '
# Tell grep to highlight matches
export GREP_OPTIONS='--color=auto'
# Tell ls to be colourful
@henrytseng
henrytseng / .vimrc
Last active June 13, 2019 01:47
Vim configuration
set nocompatible " be iMproved, required
filetype plugin indent on
" Change indentation
set expandtab
set shiftwidth=2
set softtabstop=2
set modelines=0
set nomodeline
@henrytseng
henrytseng / ps-grep-kill.sh
Created December 26, 2017 18:46 — forked from itomg/ps-grep-kill.sh
ps grep awk xargs kill
ps aux|grep cron-14|awk '{print $2}'|xargs echo
ps aux|grep cron-14|awk '{print $2}'|xargs kill
ps aux|grep cron-14|awk '{print $2}'|xargs kill -9
# Aliases
#alias ls='ls -aF -G' # List files with symbols (/ * @) and colors
alias viprofile="vi ~/.bash_profile && source ~/.bash_profile"
alias vialias="vi ~/.bash_aliases && source ~/.bash_aliases"
alias less='less -r'
alias l='ls'
alias ll='ls -alF -G' # List files including hidden files, with symbols
alias diff='grc diff'
# K8s
@henrytseng
henrytseng / install_bundles
Last active October 23, 2023 02:11
Install vim bundles with pathogen
#!/bin/bash
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
mkdir -p ~/.vim/autoload ~/.vim/bundle
curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim
cd ~/.vim/bundle
git clone https://github.com/kien/ctrlp.vim
git clone https://github.com/vim-airline/vim-airline
@henrytseng
henrytseng / keycap.json
Created May 26, 2018 02:38
Atom Keymap
'atom-text-editor':
'ctrl-left': 'editor:move-to-previous-subword-boundary'
'ctrl-right': 'editor:move-to-next-subword-boundary'
'ctrl-shift-left': 'editor:select-to-previous-subword-boundary'
'ctrl-shift-right': 'editor:select-to-next-subword-boundary'
# Color the OSX Terminal app according the hostname used in ssh
# Assumes you log in with a simple "ssh myuserid@remotehost"
# Read the following posts, which gave me the inspiration/knowledge:
# http://toolsmiths.blogspot.com/2010/04/how-to-change-your-osx-terminal-color.html
# http://www.ict4g.net/adolfo/notes/2014/07/16/change-osx-terminal-settings-from-command-line.html
# Two themes I am going to be toggling back and forth
LOCAL="Homebrew"
REMOTE="Ocean"
# Changing iTerm2 color in MacOSX when SSHing (so you know at a glance that you're no longer in Kansas)
# Adapted from https://gist.github.com/porras/5856906
# 1. Create a theme in your terminal setting with the name "SSH" and the desired colors, background, etc.
# 2. Add this to your .bash_profile (or .bashrc, I always forget the difference ;))
# 3. Optional but useful: in the terminal, go to Settings > Startup and set "New tabs open with" to
# "default settings" (otherwise, if you open a new tab from the changed one, you get a local tab with
# the SSH colors)
function tabc() {
NAME=$1; if [ -z "$NAME" ]; then NAME="Default"; fi # if you have trouble with this, change
@henrytseng
henrytseng / create_table.sql
Created January 3, 2019 03:53
Quick SQL to build tables with example data
-- Creates list of bookings
create table bookings as
with
date_table as (select now()::date - generate_series(0, 7 * 10000) as date),
hour_table as (select generate_series(0, 24) as hour),
time_table as (
select
date_table.date::date as date,
extract(year from date_table.date) as year,
extract(month from date_table.date) as month,
@henrytseng
henrytseng / .tmux.conf
Last active September 27, 2019 14:19
.tmux.conf
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-resurrect'
#set -g default-terminal "screen-256color"
#set -ga terminal-overrides ",screen-256color:Tc"
# statusbar
# set -g status-style 'bg=colour235 fg=colour136'