This commit is contained in:
Peter Kingswell 2022-08-01 15:31:36 -04:00
commit 1df0f28541
8 changed files with 157 additions and 114 deletions

26
alias-ls.sh Normal file
View file

@ -0,0 +1,26 @@
# OLD SKOOL LS ALIASES
######################
# alias clf="ls -1rt | tail -1 | xargs bat" # view the last file
# alias l="ls -la "
# alias lf="ls -p | grep -v /" # list files only
# alias lgr='l | grep -i ' # ls grep
# alias lhx="ls ~"
# alias list-javas="l ~/.jenv/versions" # where the fuck is my javas?
# alias ll="ls -l "
# alias lla='ls -lat'
# alias llf="clf"
# alias lrt="ls -lrt "
# alias lsd="ls -d .*/ */"
# alias lsdl="ls -ld .*/ */"
# alias lsf="ls -p | grep -v /" # list files only
# alias lt="ls -1rt|head -1" # list last file
# NEW SKOOL LS ALIASES
######################
COMMON_EXA_PARAMS=" --long --all --header --icons "
alias l="exa $COMMON_EXA_PARAMS --group --group-directories-first --time-style long-iso --git --git-ignore"
alias ls1="exa --oneline $COMMON_EXA_PARAMS --group-directories-first"
alias ls-tree="exa $COMMON_EXA_PARAMS --tree"
alias lrt="exa $COMMON_EXA_PARAMS --sort newest"
alias lsd="exa $COMMON_EXA_PARAMS --only-dirs"
# TODO alias lgr="exa $COMMON_EXA_PARAMS | grep -Ei 'Permissions Size|;'

View file

@ -1,22 +1,76 @@
##############################################################################
# PSK's aliases. Better late than never...
##############################################################################
alias activate-venv=". ./venv/bin/activate"
alias aliases-n=n-aliases
alias aliases=n-aliases
alias all-aliases=n-aliases
alias bmake="today-time && make "
alias brew-x86="/usr/local/homebrew/bin/brew"
alias cerebro="/usr/local/cerebro-0.9.4/bin/cerebro"
alias code="/Applications/Visual\ Studio\ Code.app/Contents/Resources/app/bin/code"
alias crontab="EDITOR=vi \crontab" # This is because code editing crontab doesn't work
alias egr='env | sort | grep -i '
alias envgr='env | sort | grep -i '
alias errorsx="^FATA|^ERR|^WAR|^FAIL"
alias errx="^FATA|^ERR|^WAR|^FAIL"
# PSK 07-09-2022 undoing exa as it's hanging for ages on attached volumes
alias fdd='\fd -t d -uu -i -L ' # find directories
alias fda="fd -t d -H -uu -i --no-ignore-vcs -I -L " # find directories in horrible places
alias fdir='\fd -t d -uu -i -L ' # find directories
alias ff='fd -t f -uu -i -L ' # find files
alias ffa="fd -t f -H -uu -i --no-ignore-vcs -I -L " # find files in horrible places
alias ftp-DS="sftp -P 699 pskadmin@ds718-psk.synology.me"
alias functions-n=n-functions
alias g="google"
alias gfind-filename=gfindf
alias gfinda="gfind-all"
alias ggm="cd ~\/src\/rune\/go-mono"
alias ghub-code='ghub browse -- tree/main'
alias ghub-pr='ghub browse -- pulls'
alias ghub='\hub '
alias gi="git-info"
alias git-info='echo "BRANCH ———————" && git branch -vv && echo "\nREMOTE———————" && git remote -vv'
alias go-go-mono="cd ~\/src\/rune\/go-mono"
alias go-omz="cd ~\/.oh-my-zsh"
alias go-tortilla="cd ~\/src\/rune\/go-mono\/tortilla"
alias gomz="cd ~\/.oh-my-zsh"
alias goomz="cd ~\/.oh-my-zsh"
alias gpm="cd ~\/src\/rune\/python-mono"
alias grad="cd ~\/src\/rune\/python-mono\/radish"
alias gtor="cd ~\/src\/rune\/go-mono\/tortilla"
alias gtx="cd ~\/src\/rune\/go-mono\/tortilla"
alias hgr="history -500 | grep -i "
alias hub-code='hub browse -- tree/main'
alias hub-pr='hub browse -- pulls'
alias list-aliases=n-aliases # wot about my aliases?
alias list-functions=n-functions # wot about my functions?
alias list-themes="cat ${HOME}/.zsh_favlist" # oh-my-zsh stuff
alias lock="/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend"
source ./alias-ls.sh
alias lz='lazygit'
alias maketi="today-time&& make test-integration 2>&1 | tee .\/make-local.log ; docker-stop-all-containers >\/dev\/null &"
alias maketil="make-big-break&& make test-integration-local 2>&1 | tee .\/make-local.log ; docker-stop-all-containers >\/dev\/null &"
alias mmake="today-time && make "
alias mti="today-time&& make test-integration 2>&1 | tee .\/make-local.log ; docker-stop-all-containers >\/dev\/null &"
alias mtil="make-big-break&& make test-integration-local 2>&1 | tee .\/make-local.log ; docker-stop-all-containers >\/dev\/null &"
alias o="open ."
alias ohmyzsh="vscode ~/.oh-my-zsh"
alias old-brew="/usr/local/homebrew/bin/brew"
alias set-timer="termdown"
alias sftp-DS="sftp -P 699 pskadmin@ds718-psk.synology.me"
alias slate="code ~/.slate.js"
alias so="how2"
alias start-stopwatch="termdown"
alias start-timer="termdown"
alias stopwatch="termdown"
alias sudo="nocorrect sudo"
alias t="tmux"
alias timer="termdown"
alias vscode="/Applications/Visual\ Studio\ Code.app/Contents/Resources/app/bin/code"
alias yoink="open -a Yoink"
alias z="vscode ~/.zshrc"
# WARNING: these might balls things up
# alias cat="bat"
# alias man="batman"
# alias less="bat"
alias "lhx"="ls ~"
alias "go-go-mono"="cd ~\/src\/rune\/go-mono"
alias "go-tortilla"="cd ~\/src\/rune\/go-mono\/tortilla"
alias "go-omz"="cd ~\/.oh-my-zsh"
alias "ggm"="cd ~\/src\/rune\/go-mono"
alias "gtor"="cd ~\/src\/rune\/go-mono\/tortilla"
alias "gtx"="cd ~\/src\/rune\/go-mono\/tortilla"
alias "gpm"="cd ~\/src\/rune\/python-mono"
alias "grad"="cd ~\/src\/rune\/python-mono\/radish"
alias "gomz"="cd ~\/.oh-my-zsh"
alias "goomz"="cd ~\/.oh-my-zsh"
alias "mtil"="make-big-break&& make test-integration-local 2>&1 | tee .\/make-local.log ; docker-stop-all-containers >\/dev\/null &"
alias "maketil"="make-big-break&& make test-integration-local 2>&1 | tee .\/make-local.log ; docker-stop-all-containers >\/dev\/null &"
alias "mti"="today-time&& make test-integration 2>&1 | tee .\/make-local.log ; docker-stop-all-containers >\/dev\/null &"
alias "maketi"="today-time&& make test-integration 2>&1 | tee .\/make-local.log ; docker-stop-all-containers >\/dev\/null &"
alias "errorsx"="^FATA|^ERR|^WAR|^FAIL"
alias "errx"="^FATA|^ERR|^WAR|^FAIL"
alias "RegEx Error Search"="^FATA|^ERR|^WAR|^FAIL"
# GIT ################################################################
# My git faves have been moved to ~/.gitconfig

8
classkick/util.sh Normal file
View file

@ -0,0 +1,8 @@
function git-diff-subdirs() {
for DIR in */; do
pushd $DIR
echo "Git diffing $PWD"
git --no-pager diff -- ':!*poetry.lock'
popd
done
}

1
htoprc Symbolic link
View file

@ -0,0 +1 @@
/Users/peter/.config/htop/htoprc

View file

@ -265,14 +265,9 @@ function omz_urldecode {
##################################
# PSK Functions
##################################
# PSK List directories only
lsd() {
l | grep -E "^d"
}
# ls grep
lsg() {
l | grep -iE "$1"
la | grep -iE "$1"
}
function alg() {
@ -289,8 +284,8 @@ alias agr="alg"
alias alias-grep="alg"
# These need to be here since they're required by gfind*
alias ag="/usr/local/homebrew/bin/ag --ignore '*.svg' --ignore '*.xlt' --ignore '*.tsx' --ignore '*.js' --ignore '*.snap' --ignore '*.json' --ignore '*.dat' --ignore '*.builds' --ignore '*.tsv' --ignore '*.csv' --ignore '*.lock' --ignore '*.patch' --ignore '*.sum' --pager=bat"
alias ag-no-pager="/usr/local/homebrew/bin/ag --ignore '*.svg' --ignore '*.xlt' --ignore '*.tsx' --ignore '*.js' --ignore '*.snap' --ignore '*.json' --ignore '*.dat' --ignore '*.builds' --ignore '*.tsv' --ignore '*.csv' --ignore '*.lock' --ignore '*.patch' --ignore '*.sum'"
alias ag-no-pager="/opt/homebrew/bin/ag --ignore '*.svg' --ignore '*.xlt' --ignore '*.tsx' --ignore '*.js' --ignore '*.snap' --ignore '*.json' --ignore '*.dat' --ignore '*.builds' --ignore '*.tsv' --ignore '*.csv' --ignore '*.lock' --ignore '*.patch' --ignore '*.sum'"
alias ag="ag-no-pager --pager=bat"
alias "git-grep"="git \grep"
function make-break() {
@ -300,12 +295,20 @@ function make-break() {
# Spits out a page of alternating white lines (hypens or thereabouts)
function page-break() {
for i in {1..9}; do;
lines-break 9
}
function lines-break(){
for i in {1..$1}; do;
make-break
done
today-time
}
function half-page-break() {
lines-break 3
}
function today-time() {
echo "————————————\n"
date +"%a %l:%M%p"
@ -321,7 +324,7 @@ function gfind-all() {
# $1 is search term, $2 is path
# rg --no-ignore --hidden "$@"
# even better is ag / silver searcher https://github.com/ggreer/the_silver_searcher
ag-no-pager --ignore-case -a --pager bat "$@"
ag-no-pager --ignore-case --all-types --hidden --unrestricted --ignore-case --pager bat "$@"
}
# the ol' gfind. Doesn't take a file pattern.
@ -359,8 +362,18 @@ function kill-em-all() {
echo "Attempting to kill $NAME by arg match..."
pkill -fli $1
MATCHED_BY_ARG=$?
echo "Attempting to kill $NAME by binary match..."
pkill -li $1
MATCHED_BY_BIN=$?
sleep 3
# if [[ "$MATCHED_BY_ARG" -ne 0 && "$MATCHED_BY_BIN" -ne 0 ]]; then
echo "Right, getting the machete out - brutally killing $NAME..."
pkill -9 -li $1
pkill -9 -fli $1
# fi
echo "...the killing... is done"
}
@ -399,7 +412,7 @@ function psgr-sorted() {
function lsofgr-listen() {
echo "Searching for processes listening on port $1..."
#echo " lsof can take up to 2 minutes to complete"
# --stdin Write the prompt to the standard error and read the password from the standard input instead of using the terminal device.
# --stdin Wr the prompt to the standard error and read the password from the standard input instead of using the terminal device.
sudo --stdin < <(echo "11anfair") lsof -i -P | grep -E "COMMAND|.*:$1.*LISTEN"
}
alias port-grep=lsofgr
@ -619,8 +632,8 @@ function peco-files() {
fi
}
# Include Rune funcs
. $HOME/.oh-my-zsh/rune-shell-funcs.zsh
# Include Work funcs
# . $HOME/.oh-my-zsh/rune-shell-funcs.zsh
zle -N peco-directories
bindkey '^Xf' peco-directories
@ -649,6 +662,26 @@ function ppkill() {
ppgrep $QUERY | xargs kill $*
}
function smileys() {
printf "$(awk 'BEGIN{c=127;while(c++<191){printf("\xf0\x9f\x98\\%s",sprintf("%o",c));}}')"
}
function clone-starred-repos() {
GITUSER=sming; curl "https://api.github.com/users/${GITUSER}/starred?per_page=1000" | grep -o 'git@[^"]*' | parallel -j 25 'git clone {}'
}
function print-path() {
echo "$PATH" | tr ':' '\n'
}
alias pretty-print-path="print-path"
alias dump-path="print-path"
alias path-dump="print-path"
function envgr() {
env | grep -Ei "$@" | sort
}
alias interactive-ps-grep="ppgrep"
alias grep-ps-percol="ppgrep"
alias grep-ps-interactive="ppgrep"

View file

@ -62,7 +62,7 @@ if [[ "$DISABLE_AUTO_UPDATE" != true ]]; then
fi
# Homebrew mentioned this so I'm doing it
export SCALA_HOME=/usr/local/homebrew/opt/scala/idea
export SCALA_HOME=/opt/homebrew/opt/scala/idea
# Initializes Oh My Zsh

View file

@ -1,3 +0,0 @@
export TORTILLA_INTEGRATION_LOCALSTACK_ADDRESS=localhost:54566
export TORTILLA_INTEGRATION_INFLUXDB_ADDRESS=localhost:58886
export TORTILLA_INTEGRATION_REDIS_ADDRESS=localhost:56379

View file

@ -1,76 +0,0 @@
##############################
### Rune Labs Shell Functions
##############################
alias output-blank-lines='echo "\n\n\n\n\n\n\n\n\n\n"'
alias mti="output-blank-lines && make test-integration"
alias mtil="output-blank-lines && make test-integration-local"
alias mtic="output-blank-lines && make test-integration 2>&1 | tee ./make-test-integration.log && code ./make-test-integration.log"
alias mtilc="output-blank-lines && make test-integration-local 2>&1 | tee ./make-test-integration-local.log && code ./make-test-integration-local.log"
alias kill-tortillas"psgr '/var/folders/bh/' | grep 'server' | grep -v PID |awk '{ print $2 };' | xargs kill -9"
##########################
### Building funcs
##########################
export RUNE_SRC=${HOME}/src/rune
export GO_MONO=${RUNE_SRC}/go-mono
# Params: the command to execute in each source sub dir
iterate-source-dirs() {
today-time
echo -e "\ncd $GO_MONO"
cd $GO_MONO
TLD=$(pwd)
for DIR in gorune carrotstream tortilla; do
echo "DIR: $DIR"
cd $DIR
$*
RESULT=$?
if [ $RESULT -ne "0" ]; then
echo "\n\n$* failed in $DIR, exiting."
fi
cd $GO_MONO
done
}
go-make-mocks() {
iterate-source-dirs make mocks
}
go-lint() {
iterate-source-dirs golangci-lint run -v --timeout 2m0s ./...
}
go-build() {
iterate-source-dirs go build ./...
}
go-fmt() {
iterate-source-dirs go fmt ./...
}
go-make() {
iterate-source-dirs make
}
go-test() {
iterate-source-dirs go test ./...
}
go-make-clean() {
iterate-source-dirs make clean
}
psgr-rune() {
psgr 'taco|tortilla|broccoli|influx|carrotstream|artichoke'
}
gitignore-update() {
pushd ${HOME}/src/rune/go-mono
echo -e "\nprod-query*/" >>.gitignore
popd
}