bin: update and move scripts & git config

This commit is contained in:
xerus2000 2021-01-23 19:51:23 +01:00
parent d1f5cf4b79
commit b2a2c69279
49 changed files with 33 additions and 16 deletions

View File

@ -1,9 +1,9 @@
[core] [core]
autocrlf = input autocrlf = input
editor = nvim editor = nvim
pager = diffr | less -R pager = diffr --colors refine-added:none:background:0x33,0x66,0x33:bold --colors added:none:background:0x33,0x44,0x33 --colors refine-removed:none:background:0x66,0x33,0x33:bold --colors removed:none:background:0x44,0x33,0x33 | less --RAW-CONTROL-CHARS --quit-on-intr
[interactive] [interactive]
diffFilter = diffr diffFilter = diffr --colors refine-added:none:background:0x33,0x66,0x33:bold --colors added:none:background:0x33,0x44,0x33 --colors refine-removed:none:background:0x66,0x33,0x33:bold --colors removed:none:background:0x44,0x33,0x33
[submodule] [submodule]
recurse = true recurse = true
[rerere] [rerere]
@ -19,6 +19,7 @@
[diff] [diff]
tool = nvim tool = nvim
submodule = log
[merge] [merge]
tool = nvim tool = nvim
[mergetool "nvim"] [mergetool "nvim"]
@ -125,7 +126,7 @@
# Change remote # Change remote
luu = !git pull upstream $(git curbranch) && git push --no-verify luu = !git pull upstream $(git curbranch) && git push --no-verify
p = push p = push -u
pf = push --force-with-lease pf = push --force-with-lease
cap = !git commit --all --amend --no-edit && git push --force-with-lease cap = !git commit --all --amend --no-edit && git push --force-with-lease
@ -135,7 +136,7 @@
cgit = !yadm cme "config/git:" -- $XDG_CONFIG_HOME/git $CONFIG_SHELLS/git $HOME/.local/bin/git-* cgit = !yadm cme "config/git:" -- $XDG_CONFIG_HOME/git $CONFIG_SHELLS/git $HOME/.local/bin/git-*
cvim = !yadm cme "config/nvim:" -- $XDG_CONFIG_HOME/nvim/init* cvim = !yadm cme "config/nvim:" -- $XDG_CONFIG_HOME/nvim/init*
cshell = !yadm cme "config/shell:" -- $CONFIG_SHELLS cshell = !yadm cme "config/shell:" -- $CONFIG_SHELLS
cbin = !yadm cme "bin:" -- $HOME/.local/bin cbin = !yadm cme "bin:" -- $HOME/.local/bin/scripts/
# data # data
journal = !git cme "notes/journal:" -- $(git root)/2-standards/notes/journal journal = !git cme "notes/journal:" -- $(git root)/2-standards/notes/journal

View File

@ -78,7 +78,7 @@ edshell() {
} }
edbin() { edbin() {
file="$(f=$(which $1) && test -f "$f" && echo $f || echo "$HOME/.local/bin/$1")" file="$(f=$(which $1) && test -f "$f" && echo $f || echo "$HOME/.local/bin/scripts/$1")"
edit "$file" edit "$file"
case "$file" in ($HOME*) yadm add "$file";; esac case "$file" in ($HOME*) yadm add "$file";; esac
} }

View File

@ -12,7 +12,7 @@ fi 2>/dev/null || return 0
# source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" # source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
#fi #fi
export PATH=$HOME/.local/bin:$PATH:/opt/android/sdk/platform-tools export PATH=$HOME/.local/bin/scripts:$HOME/.local/bin:$PATH:/opt/android/sdk/platform-tools
export CONFIG_ZSH="$XDG_CONFIG_HOME/zsh" export CONFIG_ZSH="$XDG_CONFIG_HOME/zsh"
export CONFIG_SHELLS="$XDG_CONFIG_HOME/shell" export CONFIG_SHELLS="$XDG_CONFIG_HOME/shell"

View File

@ -1,2 +0,0 @@
#!/bin/sh
test -f "$1.bak" && (mv "$1" /tmp && mv "$1.bak" "$1") || mv "$1" "$1.bak"

View File

@ -1,2 +0,0 @@
#!/bin/sh
git pull --rebase --recurse-submodules --autostash "$@" || (printf "\e[31;1mError - aborting rebase!\e[0m\n" >&2 && git rebase --abort)

4
.local/bin/scripts/arg-test Executable file
View File

@ -0,0 +1,4 @@
#!/bin/sh
echo "Args: $@"
echo "Number of args: $#"
echo "${@:-default}" | sed 's/\(\w\+\)/\1+sed/g'

2
.local/bin/scripts/bak Executable file
View File

@ -0,0 +1,2 @@
#!/bin/sh
test -e "$1.bak" && ((test -e "$1" && mv "$1" /tmp); mv -n "$1.bak" "$1") || mv -n "$1" "$1.bak"

2
.local/bin/scripts/git-l Executable file
View File

@ -0,0 +1,2 @@
#!/bin/sh
git pull --rebase --autostash "$@" || (printf "\e[31;1mError - aborting rebase!\e[0m\n" >&2 && git rebase --abort)

View File

@ -2,6 +2,6 @@
# Removes the given branch locally and remotely. # Removes the given branch locally and remotely.
# With no argument it switches to the default branch and deletes the current branch. # With no argument it switches to the default branch and deletes the current branch.
branch=${1:-$(git curbranch)} branch=${1:-$(git curbranch)}
git push -d $(git rev-parse --abbrev-ref $branch@{push} | sed 's/\// /' || echo origin $branch) echo "${@:-$branch}" | sed 's/\([^ ]\+\)/\1@{push}/g' | xargs git rev-parse --abbrev-ref --revs-only | sed 's/\// /' | git push -d
test $1 || git checkout main || git checkout master || git checkout $(cat .git/refs/remotes/origin/HEAD | cut -d'/' -f4) test $1 || git checkout main || git checkout master || git checkout $(cat .git/refs/remotes/origin/HEAD | cut -d'/' -a)
git branch -D $branch git branch -D "${@:-$branch}"

10
.local/bin/scripts/retest Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
# Execute a gradle task (default test) until it fails
code=0
case "$1" in ([0-9]*) code=$1; shift;; esac
task="${1:-test}"
test $# -gt 1 && prefix=":$2:"
gradle=$(test -x "./gradlew" && echo "./gradlew" || echo "gradle")
( exit $code ); while test $? -eq $code; do $gradle ${prefix}clean$(echo $task | sed -e 's/^./\U&/') ${prefix}$task "${@:3}"; done

View File

@ -2,4 +2,5 @@
# shows size statistics for subfolders # shows size statistics for subfolders
# max depth is equal to the first argument if it is a number or 1 # max depth is equal to the first argument if it is a number or 1
case "$1" in [0-9]) depth=$1; shift;; esac case "$1" in [0-9]) depth=$1; shift;; esac
sudo du --max-depth "${depth:-1}" -xhat 50M "$@" | sort -h | grep -v "^0" (sudo du --max-depth "${depth:-1}" -xhat 50M "$@" | sort -h | grep -v "^0") ||
(sudo du --max-depth "${depth:-1}" -xha "$@" | sort -h | tail)

3
.local/bin/scripts/tl Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
case "$1" in [0-9]) depth=$1; shift;; esac
tree -a -L ${depth:-3} --du -h -C "$@" | ${PAGER:-less}

View File

@ -1,2 +0,0 @@
#!/bin/sh
tree -a -L 3 --du -h -C "$@" | ${PAGER:-less}