This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
selectFromArray() { | |
if [ "$1" ]; then | |
local IFS=$'\n' selected= idx=$2 tmp=() | |
eval "local arr=( \${$1[*]} )" | |
if [ ${#arr[@]} -eq 1 ]; then | |
selected="${arr[0]}" | |
elif [ ${#arr[@]} -gt 1 ]; then | |
select a in "QUIT!" "${arr[@]}"; do | |
[ "${a}" = "QUIT!" ] && break |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
killProcess() { | |
if [ $# -lt 1 ]; then | |
echo "Usage: ${FUNCNAME[0]} [pattern for process name]" | |
return | |
fi | |
local procs=() selected= | |
case "$( uname )" in | |
Darwin*|CYGWIN*) mapfile -t procs < <( pgrep -fil "${1}" ) ;; | |
*) mapfile -t procs < <( pgrep -fl "${1}" ) ;; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Count lines in every Python source file in the current project | |
count=0 | |
for f in `lf . .py`; do count=$(( $count + `cat $f | wc -l` )); done | |
echo $count |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[user] | |
name = your_name | |
email = your@email | |
[alias] | |
unstage = reset HEAD -- | |
last = log -1 --stat | |
co = checkout | |
b = branch | |
l = log -10 --pretty=format:\"%h - %ar : %s\" | |
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %Cblue<%an>%Creset' --abbrev-commit --date=relative --all |
OlderNewer