Skip to content

Instantly share code, notes, and snippets.

@hgwr
Last active February 11, 2021 20:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hgwr/e3814d60fc0b3b77407f795255feb7d7 to your computer and use it in GitHub Desktop.
Save hgwr/e3814d60fc0b3b77407f795255feb7d7 to your computer and use it in GitHub Desktop.
2021-02-12 hgwr's home settings
personal_repl-1.1 en 0
UI
WIP
jQuery
nokogiri
MVC
TODO
capistrano
boolean
Validator
updatable
# ~/.bash_profile: executed by bash(1) for login shells.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.
# the default umask is set in /etc/login.defs
#umask 022
export LANG=ja_JP.UTF-8
export LC_ALL=ja_JP.UTF-8
export LC_CTYPE=ja_JP.UTF-8
if which brew > /dev/null 2> /dev/null; then
eval $(brew shellenv)
fi
export PATH="$HOME/bin:/opt/homebrew/bin:/usr/local/bin:/usr/X11/bin:/usr/bin:/bin:/usr/sbin:/sbin"
export PATH='/opt/homebrew/postgresql@9.4/bin':$PATH
export PATH="/opt/homebrew/sqlite/bin:$PATH"
export PATH="/opt/homebrew/apr/bin:$PATH"
export PATH="/opt/homebrew/apr-util/bin:$PATH"
export PATH="/opt/homebrew/ruby/bin:$PATH"
# export PATH="/opt/homebrew/node@8/bin:$PATH"
export PATH=/usr/local/texlive/2019/bin/x86_64-darwin:$PATH
export PATH="$HOME/Library/Python/2.7/bin:$PATH"
export PATH=/usr/local/anaconda3/bin:$PATH
export PATH='/opt/homebrew/python@3.8/bin':$PATH
export PATH=/usr/local/var/nodebrew/current/bin:$PATH
export PATH=$HOME/.nodebrew/current/bin:$PATH
export PATH='/opt/homebrew/mysql@5.6/bin':$PATH
export PATH="/opt/homebrew/ncurses/bin:$PATH"
export PATH="/opt/homebrew/gnu-tar/libexec/gnubin:$PATH"
export PATH='/opt/homebrew/Cellar/openssl\@1.1/1.1.1i/bin':$PATH
export PATH="/opt/homebrew/opt/node@14/bin:$PATH"
# export LDFLAGS='-L/opt/homebrew/mysql@5.6/lib'
# export CPPFLAGS='-I/opt/homebrew/mysql@5.6/include'
# export PKG_CONFIG_PATH="/opt/homebrew/ncurses/lib/pkgconfig"
# export LDFLAGS='-L/opt/homebrew/Cellar/openssl\@1.1/1.1.1i/lib'
# export CPPFLAGS='-I/opt/homebrew/Cellar/openssl\@1.1/1.1.1i/include'
# export PKG_CONFIG_PATH='/opt/homebrew/Cellar/openssl\@1.1/1.1.1i/lib/pkgconfig'
# export CPPFLAGS="-I/opt/homebrew/opt/ruby@2.7/include"
# export PKG_CONFIG_PATH="/opt/homebrew/opt/ruby@2.7/lib/pkgconfig"
# if which pyenv > /dev/null 2> /dev/null; then
# eval "$(pyenv init -)"
# fi
if which rbenv > /dev/null 2> /dev/null; then
eval "$(rbenv init -)"
export PATH="$HOME/.rbenv/bin:$PATH"
fi
# This is temporary for passenger
# export PATH="/opt/homebrew/opt/ruby@2.7/bin:$PATH"
export EDITOR=/usr/bin/vi
export JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8
NETHACKOPTIONS='windowtype:tty,!autopickup'; export NETHACKOPTIONS
JNETHACKOPTIONS="$NETHACKOPTIONS"; export JNETHACKOPTIONS
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
source "$HOME/.bashrc"
export BASH_ENV="$HOME/.bashrc"
fi
if [ -f "$HOME/.homebreww_github_api_token_bashrc" ]; then
source "$HOME/.homebreww_github_api_token_bashrc"
fi
export BASH_SILENCE_DEPRECATION_WARNING=1
keychain id_rsa
. ~/.keychain/$HOSTNAME-sh
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# don't put duplicate lines in the history. See bash(1) for more options
export HISTCONTROL=ignoreboth
export HISTFILESIZE=1000000000
export HISTSIZE=1000000
export HISTTIMEFORMAT="%F %T "
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(lesspipe)"
# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007"'
;;
*)
;;
esac
# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
#if [ -f ~/.bash_aliases ]; then
# . ~/.bash_aliases
#fi
# enable color support of ls and also add handy aliases
if [ "$TERM" != "dumb" ]; then
# eval "`dircolors -b`"
alias ls='ls --color=auto'
#alias dir='ls --color=auto --format=vertical'
#alias vdir='ls --color=auto --format=long'
fi
if [ "$TERM" = "emacs" -o "$TERM" = "dumb" ]; then
export PAGER=/bin/cat
else
export PAGER=/usr/bin/less
fi
# source /Users/hgwr/bash_ruby_util.sh
# some more ls aliases
alias ls='/bin/ls -F'
alias ll='ls -l'
alias la='ls -A'
alias l='ls -C'
alias pu='pushd'
alias po='popd'
alias d='dirs'
alias rmbak='/bin/rm -f *~ .[0-9a-zA-Z]*~'
alias grpe=grep
alias egpe=egrep
alias s=screen
alias sr='screen -r'
alias sl='screen -ls'
alias t=tmux
alias tr='tmux attach'
alias td='tmux detach'
alias tl='tmux ls'
alias less='/usr/bin/less -X'
alias _gpf='git push --force-with-lease'
# unlimit stacksize for large aray in user mode
ulimit -c unlimited
eval "$(direnv hook bash)"
# http://thelucid.com/2012/01/04/naming-your-terminal-tabs-in-osx-lion/
function tabname {
printf "\e]1;$1\a"
}
# https://gist.github.com/trey/2722934
if [ -d /Applications/Xcode.app/Contents/Developer/usr/share/git-core ]; then
source /Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-completion.bash
source /Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-prompt.sh
GIT_PS1_SHOWDIRTYSTATE=true
fi
if [ -d /usr/local/etc/bash_completion.d ]; then
source /usr/local/etc/bash_completion.d/*
fi
if [ -f /etc/bash_completion ]; then
source /etc/bash_completion
fi
if [ -d /etc/bash_completion.d ]; then
source /etc/bash_completion.d/*
fi
if [ -f /etc/profile.d/bash_completion.sh ]; then
source /etc/profile.d/bash_completion.sh
fi
if command -v __git_ps1 1>/dev/null 2>&1; then
PS1='\t \u@\h:\w$(__git_ps1)$ '
else
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
PS1='\t \u@\h:\w$(parse_git_branch)$ '
fi
gem: --no-document
[user]
name = Shigeru Hagiwara
email = hgwrsgr@gmail.com
[alias]
st = status
co = checkout
b = branch
[push]
default = simple
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
[color]
diff = auto
status = auto
branch = auto
interactive = auto
ui = auto
pager = true
[color "status"]
added = green
changed = red bold
untracked = magenta bold
[color "branch"]
remote = yellow
[secrets]
providers = git secrets --aws-provider
patterns = (A3T[A-Z0-9]|AKIA|AGPA|AIDA|AROA|AIPA|ANPA|ANVA|ASIA)[A-Z0-9]{16}
patterns = (\"|')?(AWS|aws|Aws)?_?(SECRET|secret|Secret)?_?(ACCESS|access|Access)?_?(KEY|key|Key)(\"|')?\\s*(:|=>|=)\\s*(\"|')?[A-Za-z0-9/\\+=]{40}(\"|')?
patterns = (\"|')?(AWS|aws|Aws)?_?(ACCOUNT|account|Account)_?(ID|id|Id)?(\"|')?\\s*(:|=>|=)\\s*(\"|')?[0-9]{4}\\-?[0-9]{4}\\-?[0-9]{4}(\"|')?
allowed = AKIAIOSFODNN7EXAMPLE
allowed = wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
[init]
templateDir = /Users/hgwr/.git-templates/git-secrets
[core]
excludesfile = /Users/hgwr/.gitignore
scripts-prepend-node-path=true
export LANG=ja_JP.UTF-8
export LC_ALL=ja_JP.UTF-8
export LC_CTYPE=ja_JP.UTF-8
if [ -f ~/.bash_profile ]; then
. ~/.bash_profile
fi
term xterm-256color
# term screen
# term screen-256color
escape ^tt
pastefont on
defscrollback 1000
cjkwidth on
# tmux cheat sheet
#
# 新規セッション開始: tmux
# 名前をつけて新規セッション開始: tmux new -s <セッション名>
# セッションの一覧表示: tmux ls
# 接続クライアントの一覧表示: tmux lsc
# セッションを再開 ※-t <対象セッション名>でセッション名の指定も可能: tmux a
# セッションを終了 ※-t <対象セッション名>でセッション名の指定も可能: tmux kill-session
# tmux全体を終了: tmux kill-server
# その他コマンドを実行: tmux [command [flags]]
#
# tmux 起動後のショートカット
#
# ? キーバインド一覧
# : コマンドプロンプト
# s セッションの一覧選択
# d セッションから離脱(デタッチ)
# $ セッションの名前変更
#
# c 新規ウインドウ作成
# w ウインドウの一覧選択
# 0-9 指定番号のウインドウへ移動
# & ウインドウの破棄
# n 次のウインドウへ移動
# p 前のウインドウへ移動
# l 以前のウインドウへ移動
# C-t 以前のウインドウへ移動 (screen 互換)
# ' 入力番号のウインドウへ移動
# . 入力番号にウインドウ番号を変更
# , ウインドウの名前変更
# f ウインドウの検索
#
# J Pane と Window の移動
# S Pane と Window の移動
# B Pane の Window 化
# T Window の移動
#
# E キー入力を全てのpaneで同期する
# e キー入力を全てのpaneで同期終了
#
# % 左右にペイン分割
# " 上下にペイン分割
# q ペイン番号を表示
# カーソル 指定方向のペインへ移動 ※連続押しでプレフィックス継続
# Ctrl-カーソル ペインのサイズを変更 ※連続押しでプレフィックス継続
# ! ペインを解除してウインドウ化
# x ペインの破棄
# o ペインを順に移動
# ; 以前のペインへ移動
# z 現在のペインを最大化/復帰
# スペース レイアウトを変更
# Alt-1-5 レイウトを変更
# { ペインの入れ替え(前方向)
# } ペインの入れ替え(後方向)
# ctrl+o ペインの入れ替え(全体)
# t ペインに時計を表示
#
# [ コピーモードの開始(カーソルキーで自由に移動)
# スペース コピー開始位置決定(viモード)
# エンター コピー終了位置決定(viモード)
# ] コピーした内容を貼り付け
#
# Ctrl+t :set-window-option synchronize-panes on 全 pane に同じコマンドを送る
# 現在の tmux バージョンを環境変数に保存: あとの条件分岐で使用する。 https://stackoverflow.com/a/40902312
run-shell 'tmux setenv -g TMUX_VERSION $(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")'
# prefixをscreenと同じに
unbind C-b
set -g prefix C-t
bind C-t send-prefix
# 256色端末を使用する
set -g default-terminal "xterm-256color"
# viのキーバインドを使用する
setw -g mode-keys vi
# バックスクロール行数を増やす
set -g history-limit 10000
# 実行されているコマンド名をウィンドウ名に
setw -g automatic-rename on
# マウスでペインを選択可に
if-shell -b '[ "$(echo "$TMUX_VERSION < 2.1" | bc)" = 1 ]' " \
set -g mouse-select-pane off; set -g mode-mouse off; \
set -g mouse-resize-pane off; set -g mouse-select-window off; \
set -g message-fg red; \
set -g message-bg black; \
set -g message-attr bright; \
set -g window-status-bg default; \
set -g window-status-fg default; \
set -g window-status-current-attr bold; \
set -g window-status-current-bg cyan; \
set -g window-status-current-fg default; \
set -g window-status-bell-fg red; \
set -g window-status-bell-bg black; \
set -g window-status-activity-fg white; \
set -g window-status-activity-bg black"
if-shell -b '[ "$(echo "$TMUX_VERSION >= 2.1" | bc)" = 1 ]' \
"set -g mouse off"
# ウィンドウ番号を0から始める
set -g base-index 0
# ターミナル(iTerm2等)のタイトルを設定
set -g set-titles on
# utf-8
if-shell -b '[ "$(echo "$TMUX_VERSION < 2.2" | bc)" = 1 ]' \
"set -g utf8 on; set -g status-utf8 on; set -g mouse-utf8 on"
# ステータスバー
set -g status-interval 5
set -g status-bg black
set -g status-bg white
# Ctrlを押しっぱなしでもよいように
bind C-a last-window
bind C-n next-window
bind C-p previous-window
bind C-l select-pane -t :.+
bind C-t last-window
bind C-c new-window
# session with PWD
bind '"' split-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
bind c new-window -c "#{pane_current_path}"
# key bind (paneの移動)
# Shift + カーソルキーで移動
bind -n S-left select-pane -L
bind -n S-down select-pane -D
bind -n S-up select-pane -U
bind -n S-right select-pane -R
# set-option -g set-titles-string "@#(echo $SSH_CONNECTION | cut -d ' ' -f3)"
# 再読み込みをキーバインドしておく
bind R source-file ~/.tmux.conf \; display-message "Reload Config!!"
# Pane と Window の移動、 Pane の Window 化
bind-key J command-prompt -p "join pane from:" "join-pane -s '%%'"
bind-key S command-prompt -p "send pane to:" "join-pane -t '%%'"
bind-key B break-pane
bind-key T command-prompt -p "swap window to:" "swap-window -t '%%'"
# キー入力を全てのpaneで同期する・同期終了
bind E setw synchronize-panes on
bind e setw synchronize-panes off
set compatible
sy off
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment