Compare commits
5 Commits
23ed1c08b5
...
b329a94d42
Author | SHA1 | Date |
---|---|---|
xeruf | b329a94d42 | |
xeruf | e1a9ec48ca | |
xeruf | cf22927adf | |
xeruf | b1404b35c2 | |
xeruf | 0885c8ab23 |
|
@ -79,11 +79,16 @@ Version 2019-11-04 2021-02-16"
|
|||
(defun xf/dragon ()
|
||||
"Share file from current buffer via dragon."
|
||||
(interactive)
|
||||
; TODO somehow fails in image-mode
|
||||
(apply 'call-process
|
||||
`("dragon-drop" nil nil nil
|
||||
"-a" "-x"
|
||||
,@(or (dired-get-marked-files) (buffer-file-name) (image-dired-original-file-name) default-directory)))
|
||||
(apply 'start-process
|
||||
`("dragon" nil
|
||||
"dragon-drop" "-a" "-x"
|
||||
,@(dired-get-marked-files)
|
||||
,@(unless (dired-get-marked-files)
|
||||
(list (or (buffer-file-name)
|
||||
(image-dired-original-file-name)
|
||||
default-directory))
|
||||
))
|
||||
)
|
||||
)
|
||||
|
||||
(defun xf/org-journal-current ()
|
||||
|
|
|
@ -51,6 +51,7 @@ Plug 'mhinz/vim-signify' " VCS info on the left
|
|||
|
||||
" Integrations
|
||||
"Plug 'airblade/vim-gitgutter' " Git info on the left and hunk bindings
|
||||
" TODO disable for giant files
|
||||
Plug 'tpope/vim-fugitive' " Difftool usage
|
||||
Plug 'xeruf/vim-fossil'
|
||||
Plug 'austintraver/vim-jrnl'
|
||||
|
|
|
@ -80,7 +80,7 @@ alias c=z
|
|||
# Listing for quick directory switcher based on zoxide and fzf
|
||||
alias zoxide-list='noglob zoxide query -sl'
|
||||
__zx_ls="ls --almost-all --color --human-readable --group-directories-first --file-type"
|
||||
alias fzf-dir="fzf -0 -1 --tiebreak=index \
|
||||
alias fzf-dir="fzf -0 -1 --tiebreak=chunk,end,length \
|
||||
--preview-window=30% --preview='$__zx_ls {}' \
|
||||
--height=80% --reverse --keep-right"
|
||||
# fzf for zoxide - returns the selected path stripped of its score
|
||||
|
|
|
@ -245,7 +245,7 @@ del() {
|
|||
|
||||
u() {
|
||||
# Line below handy for users of netkeeper
|
||||
timeout 1 curl -s https://github.com >/dev/null || echo "Suspending netkeeper" >&2 | echo sysupgrade | netkeeper 30 2>/dev/null
|
||||
sudo nft list ruleset | grep -q outall && echo "Suspending netkeeper" >&2 | echo sysupgrade | netkeeper 30 2>/dev/null
|
||||
if command -v pacman >/dev/null; then
|
||||
if test "$(stat /etc/pacman.d/mirrorlist --printf=%y | cut -d'-' -f1-2)" != "$(date +%Y-%m)"
|
||||
then
|
||||
|
@ -335,11 +335,13 @@ alias omd="(echo '#+OPTIONS: tags:nil'; xclip -o -selection clipboard) | pandoc
|
|||
alias mdo="pandoc -f gfm-ascii_identifiers-gfm_auto_identifiers -t org-auto_identifiers --wrap preserve"
|
||||
alias mdox="xclip -o -selection clipboard | mdo | xclip -filter"
|
||||
|
||||
alias clr="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 -F"
|
||||
|
||||
alias f="fossil"
|
||||
alias fs="fossil status"
|
||||
alias fc="fossil commit -v"
|
||||
fdf() {
|
||||
fossil diff "$@" | 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 -F
|
||||
fossil diff "$@" | clr
|
||||
}
|
||||
|
||||
alias gdiff='git diff --word-diff=color --word-diff-regex=. --no-index'
|
||||
|
|
|
@ -5,7 +5,7 @@ alias scbra='scpr zebra "/srv/funkwhale/data/music${PWD/$MUSIC}"'
|
|||
|
||||
findsongs() {
|
||||
find -regextype posix-extended -maxdepth 1 -type f \
|
||||
-regex "${1:-.*\.(mp3|flac|wav|m4a)}" -printf "%P\n"
|
||||
-iregex "${1:-.*\.(mp3|flac|wav|m4a)}" -printf "%P\n"
|
||||
}
|
||||
|
||||
addtopl() {
|
||||
|
@ -44,13 +44,13 @@ addsong() {
|
|||
addalbum() {
|
||||
mkdir -p "$MUSIC/$1"
|
||||
mkdir -p "$MUSIC_RAW/$1"
|
||||
f1 -regextype posix-extended -type f -regex "\./(cover|folder)\.(png|jpg|jpeg)" |
|
||||
f1 -regextype posix-extended -type f -iregex "\./(cover|folder)\.(png|jpg|jpeg)" |
|
||||
while read cover; do
|
||||
foundcover="true"
|
||||
cp -v "$cover" "$MUSIC/$1" &&
|
||||
mv -v "$cover" "$MUSIC_RAW/$1"
|
||||
done
|
||||
test "$foundcover" || f1 -regextype posix-extended -type f -regex ".*\.(png|jpg|jpeg)" |
|
||||
test "$foundcover" || f1 -regextype posix-extended -type f -iregex ".*\.(png|jpg|jpeg)" |
|
||||
while read cover; do
|
||||
cp -v "$cover" "$MUSIC/$1" &&
|
||||
mv -v "$cover" "$MUSIC_RAW/$1"
|
||||
|
@ -72,7 +72,7 @@ formatsongs() {
|
|||
done
|
||||
)
|
||||
# fd --no-ignore-vcs --type f --extension opus --exec opusdec --quiet "{}" "{.}.wav" \; ".*" "$@"
|
||||
find "$@" -type f -name "*.wav" -exec sh -c '
|
||||
find "$@" -type f -iname "*.wav" -exec sh -c '
|
||||
f="{}" &&
|
||||
echo "Converting $f to ${f%.*}.flac" &&
|
||||
ffmpeg -i "$f" "${f%.*}.flac" -v warning &&
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
test -z "$DISPLAY" && test "$XDG_VTNR" -eq 1 || return 0
|
||||
test -z "$DISPLAY" && test "$XDG_VTNR" -lt 1 || return 0
|
||||
|
||||
export PATH="$PATH:$HOME/.local/bin/server"
|
||||
export PROJECTS="$HOME/projects"
|
||||
|
@ -17,11 +17,14 @@ _stackspin_cluster_cache=/var/tmp/stackspin-cluster
|
|||
# This is a function so it can change directory.
|
||||
stack() {
|
||||
local pod_suffix='-\(0\|[0-f]\+\)'
|
||||
test $# -lt 1 &&
|
||||
builtin cd "$STACKSPIN" &&
|
||||
echo "Usage: $0 <COMMAND> [args...]" &&
|
||||
echo "Inbuilt commands: select, sso, user, exec, pod, occ, push" &&
|
||||
if test $# -lt 1; then
|
||||
builtin cd "$STACKSPIN"
|
||||
echo "Usage: $0 <COMMAND> [args...]"
|
||||
echo "Stackspin commands: select, sso, user, push"
|
||||
echo "Kubepod commands: pod, exec, app, shell, ls, logs, upload"
|
||||
echo "App commands: occ, vikunja"
|
||||
return 1
|
||||
fi
|
||||
local command="$1"
|
||||
shift
|
||||
case "$command" in
|
||||
|
@ -35,7 +38,7 @@ stack() {
|
|||
#export GITLAB_CI="true"
|
||||
echo Selected "$_cluster_name" with IP "$_cluster_ip"
|
||||
echo "$_cluster_name" >"$_stackspin_cluster_cache"
|
||||
test "$PWD" = "$HOME" && builtin cd "$STACKSPIN"
|
||||
#test "$PWD" = "$HOME" && builtin cd "$STACKSPIN"
|
||||
;;
|
||||
(sso) builtin cd "$STACKSPIN"
|
||||
"$0" exec dashboard --container backend -- flask "$@";;
|
||||
|
@ -65,22 +68,27 @@ stack() {
|
|||
(occ) "$0" exec nc-nextcloud -c nextcloud -it -- su www-data -s /bin/bash -c "php $command $*";;
|
||||
(vikunja) local pod=${2:-vikunja}
|
||||
case "$1" in
|
||||
(dump|export) cd $PROJECTS/vikunja
|
||||
(dump|export) cd "$PROJECTS/vikunja"
|
||||
"$0" exec "$pod" -c api -- sh -c 'rm -f *.zip && ./vikunja dump >/dev/null && ls --color -lAhF >&2 && cat *.zip' >"$pod-dump_$(date +%F).zip"
|
||||
;;
|
||||
(restore) "$0" upload "$pod" "$3" -c api
|
||||
"$0" exec "$pod" -c api -it -- ./vikunja restore "$3"
|
||||
;;
|
||||
(psql) kubectl exec -it -n $("$0" pod "$pod-postgresql") -- sh -c "PGPASSWORD=$(kubectl get secret --namespace stackspout $pod-postgresql -o jsonpath='{.data.postgresql-password}' | base64 --decode) psql -h localhost -U vikunja -p 5432 vikunja"
|
||||
(psql) kubectl exec -it -n $("$0" pod "$pod-postgresql") -- sh -c "PGPASSWORD=$(kubectl get secret --namespace stackspout $pod-postgresql -o jsonpath='{.data.postgresql-password}' | base64 --decode) psql -h localhost -U vikunja -p 5432 vikunja";;
|
||||
(*) echo "Unknown Subcommand";;
|
||||
esac
|
||||
;;
|
||||
# high-level
|
||||
(shell) "$0" exec "$1" -it -- /bin/sh "${@:2}";;
|
||||
(shell)
|
||||
container=$1
|
||||
shift
|
||||
test "$1" = "-c" && pod=$2 && shift 2
|
||||
"$0" exec "$container" -c "$pod" -it -- /bin/sh "$@";;
|
||||
(ls)
|
||||
if test $# -gt 1 && ! [[ "$2" =~ ".*/.*" ]]
|
||||
then "$0" exec "$1" "$2" "$3" -it -- ls -lAhF --group-directories-first "${@:4}"
|
||||
else for container in $("$0" kube get "$1" pod -o "jsonpath={.spec.containers[*].name}")
|
||||
do #highlight "Listing content of $container" &&
|
||||
do highlight "Listing content of $container" &&
|
||||
"$0" ls "$1" -c "$container" "${@:2}"
|
||||
done
|
||||
fi;;
|
||||
|
@ -88,26 +96,25 @@ stack() {
|
|||
kubectl cp "$2" -n $("$0" pod "$1$pod_suffix"):$2 "${@:3}"
|
||||
"$0" ls "$1" "${@:3}";;
|
||||
(exec) "$0" kube exec "$@";;
|
||||
(logs) "$0" kube logs "$@" | less -RF;;
|
||||
(logs) "$0" kube logs "$@" | $(command which lnav || { which bat >/dev/null && echo "bat --number -l toml" } || echo 'less -RF');;
|
||||
# low-level
|
||||
(kube)
|
||||
if ! namespacedpod=$("$0" pod "$2$pod_suffix")
|
||||
then echo "No pod found for $2" >&2
|
||||
return 1
|
||||
fi
|
||||
test $# -gt 1 || { echo "Please provide a command and pod name" >&2 && return 1; }
|
||||
local pods=$("$0" pod "$2$pod_suffix") || { echo "No pod found for $2" >&2 && return 1; }
|
||||
local subcommand=$1
|
||||
shift 2
|
||||
local commands=()
|
||||
for arg;
|
||||
for arg
|
||||
do case "$arg" in (-*) break;; (*) commands+="$arg"; shift;; esac
|
||||
done
|
||||
test "$subcommand" = get ||
|
||||
highlight "Running $subcommand on $namespacedpod" >&2
|
||||
kubectl "$subcommand" "$commands[@]" -n $(echo $namespacedpod) "$@";;
|
||||
for namespacedpod in $pods; do
|
||||
test "$subcommand" = get ||
|
||||
highlight "Running $subcommand on $namespacedpod" >&2
|
||||
kubectl "$subcommand" "$commands[@]" -n $(echo $namespacedpod) "$@"
|
||||
done;;
|
||||
(pod)
|
||||
local podname=$1
|
||||
shift
|
||||
kubectl get pods --all-namespaces --field-selector="status.phase=Running" -o=custom-columns=S:.metadata.namespace,N:.metadata.name --no-headers "$@" | grep --color=never "$podname";;
|
||||
test $# -gt 0 && local podname=$1 && shift
|
||||
kubectl get pods --all-namespaces --field-selector="status.phase=Running" -o=custom-columns=S:.metadata.namespace,N:.metadata.name --no-headers "$@" | grep --color=never -- "$podname";;
|
||||
# stackspin bare
|
||||
(*) if which "$0-$command" >/dev/null 2>&1
|
||||
then "$0-$command" "$@"
|
||||
|
@ -115,10 +122,15 @@ stack() {
|
|||
fi
|
||||
builtin cd "$STACKSPIN"
|
||||
# Since the install command can also be given bare to install stackspin itself
|
||||
if test $# -gt 0 -a "$command" = install
|
||||
then "./install/install-$1.sh" || ./install/install-app.sh "$@"
|
||||
if test "$command" = "install"; then
|
||||
if test $# -gt 0
|
||||
then "./install/install-$1.sh" || ./install/install-app.sh "$@"
|
||||
else
|
||||
/usr/bin/python3 -m pip install --upgrade pip
|
||||
/usr/bin/python3 -m pip install -r requirements.txt
|
||||
python3 -m stackspin "$_cluster_name" "$command"
|
||||
fi
|
||||
else python3 -m stackspin "$_cluster_name" "$command" "$@"
|
||||
# pip3 install -r requirements.txt
|
||||
fi;;
|
||||
esac
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ fileinfo() {
|
|||
for arg
|
||||
do case "$arg" in (-*) continue;; esac
|
||||
$elevate file --exclude elf -E "$arg"
|
||||
$elevate ssh-keygen -l -f "$arg" 2>/dev/null
|
||||
$elevate ssh-keygen -l -f "$arg" 2>/dev/null || true
|
||||
# TODO do not grep bitrate but extract properly
|
||||
#probe="$($elevate ffprobe "$arg" 2>&1)"
|
||||
#echo $probe | grep -v -e '00:00:00.04' -e 'ansi' &&
|
||||
|
@ -101,7 +101,7 @@ for arg; do
|
|||
;;
|
||||
(*)
|
||||
case "$(file --dereference "$arg")" in
|
||||
(*\ ?udio*)
|
||||
(*\ ?udio*|*\ ADTS,*)
|
||||
# TODO preconvert aac - |*\ ADTS\ *
|
||||
if ! $inspect && which audiowaveform >/dev/null; then
|
||||
img="$tmpfile.png"
|
||||
|
|
|
@ -46,13 +46,14 @@ highlight "s :: recursively remove logs"
|
|||
highlight "m :: recursively remove mac-files"
|
||||
if [[ $1 =~ "m" ]]; then
|
||||
find -name '__MACOSX' -print -exec rm -r {} +
|
||||
find -iname '.spotlight*' -print -exec rm -rI {} +
|
||||
find \( -iname '.spotlight*' -o -name 'System Volume Information' -o -name '.fseventsd' \) -print -exec rm -rI {} +
|
||||
find -name '*.DS_Store' -delete
|
||||
fi
|
||||
|
||||
highlight "d :: recursively remove development caches"
|
||||
if [[ $1 =~ "d" ]]; then
|
||||
find -maxdepth 1 \( -name "*.aux" -o -name "*.log" -o -name "*.t[uo]c" -o -name "*.out" \) -print -delete
|
||||
# TODO some matches duplicate log clearing
|
||||
find -maxdepth 1 \( -name "*.aux" -o -name "*.log" -o -name "*.t[uo][ca]" -o -name "*.out" \) -print -delete
|
||||
find \( -name 'src' -o -name 'vendor' \) -prune -o \
|
||||
-type d \( -name 'cache' $(echo $DIRS_GENERATED | sed 's|-x \([^ ]\+\)|-o -name \1|g') \) \
|
||||
-print -exec rm $i -r {} + -prune
|
||||
|
|
|
@ -6,7 +6,8 @@ echo "Cloning $remote"
|
|||
test $1 = https && shift
|
||||
case $# in
|
||||
(1) dir=$(basename ${remote%.git});;
|
||||
(3) test "$3" != "$(git config --get user.name)" &&
|
||||
(3) # TODO recognize shared prefix
|
||||
test "$3" != "$(git config --get user.name)" &&
|
||||
prefix=$(echo "$3" | sed "s|\(.\)\b.*$|\1|") &&
|
||||
case "$2" in
|
||||
("$prefix"*) ;;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/sh
|
||||
# Recreates the current or given branch with the state from master or another given branch.
|
||||
# Recreates the current or given branch with the state from main or another given branch.
|
||||
branch=${1:-$(git curbranch)}
|
||||
test "$(git curbranch)" = "$branch" && git checkout ${2:-master}
|
||||
test "$(git curbranch)" = "$branch" && git switch ${2:-main}
|
||||
git branch -D $branch
|
||||
git checkout -b $branch
|
||||
git switch -c $branch
|
||||
|
|
|
@ -2,10 +2,13 @@
|
|||
# Update an Easy2Boot USB Stick after adding ISOs
|
||||
# Call with Linux ISOs to be copied as args
|
||||
# Need to be around E2B mountpoint if it is not the default
|
||||
dir="$(find . "${MNT:-${XDG_RUNTIME_DIR}/mnt}" -maxdepth 3 -name _ISO -type d | grep .)"
|
||||
if ! dir="$(find . "${MNT:-${XDG_RUNTIME_DIR}/mnt}" -maxdepth 3 -name _ISO -type d | grep .)"
|
||||
then echo "Please mount your multiboot stick first!"
|
||||
exit 1
|
||||
fi
|
||||
test $# -eq 0 || mv -vi "$@" "$dir/LINUX"
|
||||
find "$dir" -name "*32-*.iso" -exec mv -vi {} {}def32 \;
|
||||
find "$dir" -name "*.iso" -exec mv -vi {} {}def64 \;
|
||||
find "$dir" -iname "*32-*.iso" -exec mv -vi {} {}def32 \;
|
||||
find "$dir" -iname "*.iso" -exec mv -vi {} {}def64 \;
|
||||
drive=$(mount | grep "$(basename "$dir")" | cut -d' ' -f1)
|
||||
sudo umount $drive
|
||||
sudo udefrag $drive
|
||||
|
|
|
@ -1,11 +1,19 @@
|
|||
#!/bin/sh -e
|
||||
test $# -lt 1 &&
|
||||
echo "Usage: $0 <app> [subdomain] [repo] [namespace]" &&
|
||||
if test $# -lt 1; then
|
||||
echo "You should be in the root apps folder."
|
||||
echo "Usage: $0 <app> [subdomain] [repo] [namespace]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
app=$1
|
||||
subdomain=${2:-$app}
|
||||
repo=${3:-$app}
|
||||
namespace=${4:-stackspout}
|
||||
|
||||
if test "$(basename "$PWD")" != "$subdomain"
|
||||
then mkdir -p "$subdomain" && cd "$subdomain"
|
||||
fi
|
||||
|
||||
cat <<EOF >$app-oauth-client.yaml
|
||||
apiVersion: hydra.ory.sh/v1alpha1
|
||||
kind: OAuth2Client
|
||||
|
@ -120,3 +128,7 @@ spec:
|
|||
storage: 2Gi
|
||||
storageClassName: local-path
|
||||
EOF
|
||||
|
||||
ls -l
|
||||
echo "To do: Obtain chart version, check configmap, create oauth secrets if needed" >&2
|
||||
exec $SHELL
|
||||
|
|
Loading…
Reference in New Issue