mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-30 02:44:42 +01:00
various worthless shit
This commit is contained in:
parent
597092aa83
commit
a8803d5668
7 changed files with 214 additions and 42 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -6,3 +6,4 @@ cache/
|
|||
log/
|
||||
*.swp
|
||||
.DS_Store
|
||||
.history/*
|
||||
|
|
|
|||
18
.tmux.conf
18
.tmux.conf
|
|
@ -45,6 +45,9 @@ set -g renumber-windows on
|
|||
# soften status bar color from harsh green to light gray
|
||||
set -g status-style bg='#262626',fg='#a1cfd1'
|
||||
|
||||
# set status bg to grey from https://protechnotes.com/comprehensive-tmux-tutorial-for-beginners-with-a-cheat-sheet/
|
||||
set -g status-bg colour236
|
||||
|
||||
# remove administrative debris (session name, hostname, time) in status bar
|
||||
#set -g status-left ''
|
||||
#set -g status-right ''
|
||||
|
|
@ -178,14 +181,13 @@ set -g @plugin 'tmux-plugins/tmux-open'
|
|||
set -g status-position bottom
|
||||
set -g status-justify left
|
||||
# Status line right side - 31-Oct 13:37
|
||||
set -g status-right "#[fg=cyan]%d %b %R"
|
||||
set -g status-right-length 50
|
||||
#set -g status-right "#[fg=cyan]%d %b %R"
|
||||
|
||||
setw -g window-status-current-style 'fg=colour1 bg=colour19 bold'
|
||||
setw -g window-status-current-format ' #I#[fg=colour249]:#[fg=colour255]#W#[fg=colour249]#F '
|
||||
|
||||
setw -g window-status-style 'fg=colour9 bg=colour18'
|
||||
setw -g window-status-format ' #I#[fg=colour237]:#[fg=colour250]#W#[fg=colour244]#F '
|
||||
#setw -g window-status-style 'fg=colour9 bg=colour18'
|
||||
#setw -g window-status-format ' #I#[fg=colour237]:#[fg=colour250]#W#[fg=colour244]#F '
|
||||
|
||||
# setw -g window-status-bell-style 'fg=colour255 bg=colour1 bold'
|
||||
|
||||
|
|
@ -197,7 +199,11 @@ set -g status-left "#{prefix_highlight} #[fg=green]Session: #S #[fg=yellow]#I #[
|
|||
set -g status-interval 5
|
||||
|
||||
# messages
|
||||
# set -g message-style 'fg=colour232 bg=colour16 bold'
|
||||
#set -g message-style 'fg=colour232 bg=colour16 bold'
|
||||
|
||||
# https://github.com/jonmosco/kube-tmux.git
|
||||
# set -g status-right-length 80 # long enough for our long cluster names
|
||||
# set -g status-right "#(/bin/bash $HOME/.tmux/kube-tmux/kube.tmux 250 red cyan)"
|
||||
|
||||
##########################
|
||||
# PLUGINS
|
||||
|
|
@ -205,6 +211,8 @@ set -g status-interval 5
|
|||
# List of plugins
|
||||
set -g @plugin 'tmux-plugins/tpm'
|
||||
set -g @plugin 'tmux-plugins/tmux-sensible'
|
||||
set -g @plugin 'jimeh/tmux-themepack'
|
||||
set -g @themepack 'powerline/block/blue'
|
||||
|
||||
# Other examples:
|
||||
# set -g @plugin 'github_username/plugin_name'
|
||||
|
|
|
|||
1
.zsh_favlist
Symbolic link
1
.zsh_favlist
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
/Users/peter/.zsh_favlist
|
||||
116
kubernetes-util.sh
Normal file
116
kubernetes-util.sh
Normal file
|
|
@ -0,0 +1,116 @@
|
|||
alias ts-resolve-host="tsunami variables resolve --unit-type host "
|
||||
|
||||
function ts-variables-show() {
|
||||
tsunami variables show $1 $2
|
||||
}
|
||||
function ts-variables-show-version() {
|
||||
tsunami variables history $1 $2
|
||||
}
|
||||
|
||||
alias tsunami-resolve-host="ts-resolve-host"
|
||||
alias tsunami-variables-show="ts-variables-show"
|
||||
alias tsunami-variables-show-version="ts-variables-show-version"
|
||||
|
||||
# to avoid slow shells, we do it manually
|
||||
function kubectl() {
|
||||
if ! type __start_kubectl >/dev/null 2>&1; then
|
||||
source <(command kubectl completion zsh)
|
||||
fi
|
||||
|
||||
command kubectl "$@"
|
||||
}
|
||||
|
||||
function kube-ctx-show() {
|
||||
echo "`kubectl ctx -c` • `kubectl ns -c`"
|
||||
}
|
||||
|
||||
alias show-kube-ctx="kube-ctx-show"
|
||||
alias kc-current-ctx="kube-ctx-show"
|
||||
|
||||
function kube-list-local-contexts() {
|
||||
grep '^- name: ' ~/.kube/config | awk '{print $3}'
|
||||
}
|
||||
|
||||
alias kc-list-local-contexts="kube-list-local-contexts"
|
||||
|
||||
function kube-list-prod-contexts() {
|
||||
gcloud container clusters list --project=gke-xpn-1 --filter="resourceLabels[env]=production" --format="value(name)"
|
||||
}
|
||||
|
||||
alias kc-list-prod-contexts="kube-list-prod-contexts"
|
||||
|
||||
alias kc="kubectl"
|
||||
alias k="kubectl"
|
||||
alias mk="minikube"
|
||||
alias kube-list-contexts="kubectl config get-contexts"
|
||||
|
||||
alias kc-site="kubectl-site"
|
||||
|
||||
# Record all pods belonging to a given namespace across all clusters that are
|
||||
# configured
|
||||
function list-all-pods-multi-cluster () {
|
||||
mv all-pods.txt all-pods.txt~ 2>&1 > /dev/null
|
||||
|
||||
KC_NS=$1
|
||||
echo
|
||||
echo "Finding all pods for namespace $KC_NS across all configured clusters hello-k8s-replicaset.yaml# hello-k8s-replicaset.yaml
|
||||
apiVersion: apps/v1
|
||||
kind: ReplicaSet
|
||||
metadata:
|
||||
name: hello-k8s-<username>
|
||||
namespace: tech-learning
|
||||
spec:
|
||||
replicas: 3
|
||||
selector:
|
||||
matchLabels:
|
||||
app: hello-k8s-<username>
|
||||
template:
|
||||
metadata:
|
||||
annotations:
|
||||
podpreset.admission.spotify.com/exclude: 'ffwd-java-shim-container, spotify-envs'
|
||||
labels:
|
||||
app: hello-k8s-<username>
|
||||
spec:
|
||||
containers:
|
||||
- name: hello-k8s
|
||||
image: gcr.io/tech-learning-2321/hello-k8s:0.0.1
|
||||
env:
|
||||
- name: USER_OVERRIDE
|
||||
value: "<username>"
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: 8080
|
||||
resources:
|
||||
requests:
|
||||
cpu: 200m
|
||||
memory: 1G
|
||||
limits:
|
||||
cpu: 800m
|
||||
memory: 4Gand dumping them into ./all-pods.txt..."
|
||||
echo
|
||||
|
||||
for CLUSTER in `kubectl ctx`; do
|
||||
case $CLUSTER in
|
||||
kind )
|
||||
echo "Skipping ${CLUSTER}."
|
||||
continue
|
||||
;;
|
||||
docker )
|
||||
echo "Skipping ${CLUSTER}."
|
||||
continue
|
||||
;;
|
||||
minikube )
|
||||
echo "Skipping ${CLUSTER}."
|
||||
continue
|
||||
;;
|
||||
* )
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "Processing cluster $CLUSTER..."
|
||||
|
||||
kubectl ctx $CLUSTER
|
||||
kubectl ns $KC_NS
|
||||
kubectl get pods -o wide >> all-pods.txt
|
||||
done
|
||||
}
|
||||
|
|
@ -264,6 +264,11 @@ lsg() {
|
|||
l | grep -iE "$1"
|
||||
}
|
||||
|
||||
# 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 "git-grep"="git \grep"
|
||||
|
||||
# the ol' gfind. Doesn't take a file pattern.
|
||||
function gfind-all() {
|
||||
# fd -H -t f . -x grep --color=always -Hi ${1}
|
||||
|
|
@ -271,27 +276,18 @@ 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 -a --pager less "$@"
|
||||
ag-no-pager -a --pager bat "$@"
|
||||
}
|
||||
|
||||
# the ol' gfind. Doesn't take a file pattern.
|
||||
function gfind() {
|
||||
# fd -t f . -x grep --color=always -Hi ${1}
|
||||
ag --pager less "$@"
|
||||
ag-no-pager --pager bat "$@"
|
||||
}
|
||||
|
||||
# Print out the matches only
|
||||
function gfindf() {
|
||||
# TODO make this a lot less shit e.g. don't search .git . Surely rg has
|
||||
# the ability to do this.
|
||||
find . -type f -exec grep --color=always -Hil $1 {} \;
|
||||
}
|
||||
|
||||
function heroic-repo-configure() {
|
||||
cp ${HOME}/src/spotify/prism-tools/heroic-test.yml ./heroic-guc.yml
|
||||
cp ${HOME}/src/spotify/prism-tools/heroic-api-gae.yml ./heroic-gae.yml
|
||||
ls -l | grep -E 'heroic.*yml|heroic.*yaml'
|
||||
mkdir logs
|
||||
ack -l $1 --pager=bat --color
|
||||
}
|
||||
|
||||
# function h() {
|
||||
|
|
@ -351,6 +347,12 @@ function dir-sizes() {
|
|||
du -sh ./* | sort -h
|
||||
}
|
||||
|
||||
# Call from within the source TLD
|
||||
function download-sources-intellij() {
|
||||
mvn dependency:sources
|
||||
mvn dependency:resolve -Dclassifier=javadoc
|
||||
}
|
||||
|
||||
|
||||
function ssh-ds718() {
|
||||
ssh -p 658 pskadmin@192.168.2.7
|
||||
|
|
@ -358,7 +360,7 @@ function ssh-ds718() {
|
|||
|
||||
alias git-stash-list-all='gitk `git stash list --pretty=format:%gd`'
|
||||
|
||||
function master-show-protection() {
|
||||
function git-show-protection() {
|
||||
git branch -vv | grep "origin/`git branch --show-current`"
|
||||
}
|
||||
|
||||
|
|
@ -373,11 +375,15 @@ function git-show-all-stashes() {
|
|||
}
|
||||
|
||||
# kill most recent container instance
|
||||
alias docker-kill-latest='docker ps -l --format='{{.Names}}' | xargs docker kill'
|
||||
alias docker-kill-latest='docker ps -l --format="{{.Names}}" | xargs docker kill'
|
||||
|
||||
# stop all containers
|
||||
docker-stop-all-containers () {
|
||||
docker container stop -t 2 $(docker container ls -q) 2>/dev/null
|
||||
function docker-stop-all-containers () {
|
||||
docker container stop -t 2 $(docker container ls -q) 2>/dev/null ; echo ""
|
||||
}
|
||||
|
||||
function docker-lsg () {
|
||||
docker image ls | grep -Ei "'IMAGE ID'|$1"
|
||||
}
|
||||
|
||||
function find-gig-files() {
|
||||
|
|
@ -403,25 +409,63 @@ function start-cloud-storage() {
|
|||
) &
|
||||
}
|
||||
|
||||
# Out of action - needs work
|
||||
# function tree() {
|
||||
# DIR=$1 ;
|
||||
# shift # kubectl create -f hello-k8s-replicaset.yaml
|
||||
# ps $1 off
|
||||
# /usr/local/homebrew/bin/tree -a $DIR | colorize_less "$@"
|
||||
# }
|
||||
|
||||
function tree() {
|
||||
DIR=$1 ;
|
||||
shift # pops $1 off
|
||||
/usr/local/homebrew/bin/tree -a $DIR | colorize_less "$@"
|
||||
function space() {
|
||||
echo;echo;echo;echo;echo;
|
||||
}
|
||||
|
||||
alias s="space"
|
||||
|
||||
function open-job-docs() {
|
||||
open 'https://docs.google.com/document/d/1O81om1F14fNhWhqt5VpIULfiCHmNXPkFcMoED09cidU/edit'
|
||||
open 'https://docs.google.com/document/d/1pBJfqcWhn9Wz6p6wPpPrk6_9MdGG_24qmpluz4pM3AY/edit'
|
||||
open 'https://docs.google.com/document/d/1nj_MidYJEDhk1uzhPFOZ6uFdXfZY2hdrV0_f8zJ4Lgs/edit'
|
||||
open 'https://docs.google.com/document/d/1gPNcLjrZJnJnWy0-k5SqpgP4VAUZ_ikRLR9qYEB50M0/edit'
|
||||
}
|
||||
|
||||
goclean() {
|
||||
local pkg=$1; shift || return 1
|
||||
local ost
|
||||
local cnt
|
||||
local scr
|
||||
|
||||
# Clean removes object files from package source directories (ignore error)
|
||||
go clean -i $pkg &>/dev/null
|
||||
|
||||
# Set local variables
|
||||
[[ "$(uname -m)" == "x86_64" ]] \
|
||||
&& ost="$(uname)";ost="${ost,,}_amd64" \
|
||||
&& cnt="${pkg//[^\/]}"
|
||||
|
||||
# Delete the source directory and compiled package directory(ies)
|
||||
if (("${#cnt}" == "2")); then
|
||||
rm -rf "${GOPATH%%:*}/src/${pkg%/*}"
|
||||
rm -rf "${GOPATH%%:*}/pkg/${ost}/${pkg%/*}"
|
||||
elif (("${#cnt}" > "2")); then
|
||||
rm -rf "${GOPATH%%:*}/src/${pkg%/*/*}"
|
||||
rm -rf "${GOPATH%%:*}/pkg/${ost}/${pkg%/*/*}"
|
||||
fi
|
||||
}
|
||||
|
||||
function _open-all-chrome-apps() {
|
||||
for APP in "${1}"/*.app; do
|
||||
echo "Opening $APP ..."
|
||||
nohup open -a "$APP" &
|
||||
nohup open -a "$APP" > /dev/null 2>&1 &
|
||||
done
|
||||
}
|
||||
|
||||
function open-all-chrome-apps() {
|
||||
CHROME_APP_DIR='/Users/peter/Dropbox (Personal)/_Settings/Chrome Apps/Chrome Apps.localized/'
|
||||
_open-all-chrome-apps "$CHROME_APP_DIR"
|
||||
CHROME_APP_DIR='/Users/peter/Dropbox (Personal)/_Settings/Chrome/Chrome Apps/Chrome Apps.localized/'
|
||||
_open-all-chrome-apps "$CHROME_APP_DIR"
|
||||
CHROME_APP_DIR='/Users/peter/Dropbox (Personal)/_Settings/Chrome Apps/Chrome Apps.localized'
|
||||
_open-all-chrome-apps $CHROME_APP_DIR
|
||||
CHROME_APP_DIR='/Users/peter/Dropbox (Personal)/_Settings/Chrome/Chrome Apps/Chrome Apps.localized'
|
||||
_open-all-chrome-apps $CHROME_APP_DIR
|
||||
}
|
||||
|
||||
function post-boot-tasks() {
|
||||
|
|
@ -439,21 +483,18 @@ function kill-cloud-storage() {
|
|||
killall -v "FinderSyncExtension" -SIGKILL &
|
||||
}
|
||||
|
||||
# For photos, pictures, DS718
|
||||
function organise-into-dated-dirs() {
|
||||
if [ $# -eq 0 ]
|
||||
then
|
||||
echo "Please supply an extension e.g. mov or mp4"
|
||||
return
|
||||
fi
|
||||
function explain-command {
|
||||
command="https://explainshell.com/explain?cmd=${1}"
|
||||
osascript <<EOD
|
||||
tell application "Safari" to make new document with properties {URL:"$command"}
|
||||
return
|
||||
EOD
|
||||
|
||||
for x in *.${1}; do
|
||||
d=$(date -r "$x" +%Y-%m-%d)
|
||||
mkdir -p "$d"
|
||||
mv -- "$x" "$d/"
|
||||
done
|
||||
}
|
||||
|
||||
alias explainer="explain-command"
|
||||
alias explain-args="explain-command"
|
||||
|
||||
### peco functions ###
|
||||
function peco-directories() {
|
||||
local current_lbuffer="$LBUFFER"
|
||||
|
|
@ -507,6 +548,9 @@ function peco-files() {
|
|||
fi
|
||||
}
|
||||
|
||||
# Include Rune funcs
|
||||
. $HOME/.oh-my-zsh/rune-shell-funcs.zsh
|
||||
|
||||
zle -N peco-directories
|
||||
bindkey '^Xf' peco-directories
|
||||
zle -N peco-files
|
||||
|
|
|
|||
1
theme_chooser.sh
Symbolic link
1
theme_chooser.sh
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
/Users/peter/.oh-my-zsh/tools/theme_chooser.sh
|
||||
1
themes/agnoster-psk.zsh-theme
Symbolic link
1
themes/agnoster-psk.zsh-theme
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
../custom/themes/agnoster-psk.zsh-theme
|
||||
Loading…
Add table
Add a link
Reference in a new issue