Compare commits

...

3 commits

Author SHA1 Message Date
xeruf
dea1732727 config: various updates 2024-04-13 12:49:32 +02:00
xeruf
856ab66059 config/shell: update aliases 2024-04-13 12:47:32 +02:00
xeruf
b2e64b6555 bin: parameter tweaks 2024-04-08 13:02:09 +02:00
24 changed files with 104 additions and 37 deletions

View file

@ -51,6 +51,14 @@ status() {
fi
}
disks() {
{
sudo df -h -T --exclude-type=tmpfs --exclude-type=devtmpfs --exclude-type=squashfs --exclude-type=overlay
sudo blkid
sudo fdisk -l
} | less
}
__u="$sudo apt update && $sudo apt upgrade"
alias u="$__u"
alias ur="tmux new-session -s upgrade '$__u && $sudo reboot'"

View file

@ -729,6 +729,9 @@ Version 2019-11-04 2021-02-16"
(add-to-list 'org-export-filter-headline-functions
'org/ensure-latex-clearpage)
; https://tex.stackexchange.com/questions/50747/options-for-appearance-of-links-in-hyperref/50754#50754
(add-to-list 'org-latex-default-packages-alist "\\PassOptionsToPackage{colorlinks=true,urlcolor=blue,allcolors=blue}{hyperref}")
;;(setq org-latex-toc-command "\\tableofcontents*\n\n")
(setq org-latex-pdf-process '("latexmk -shell-escape -pdfxe -pdfxelatex=\"xelatex --shell-escape\" -outdir=/tmp/latexmk -f -pdf %F && mv %f /tmp/latexmk && mv /tmp/latexmk/%b.pdf %o") ; https://emacs.stackexchange.com/a/48351
org-latex-packages-alist '(("" "fullpage") ("avoid-all" "widows-and-orphans") ("" "svg"))

View file

@ -98,7 +98,7 @@
b = branch -vv
ba = b -a
main = !cat "$(git rev-parse --git-path refs/remotes/origin/HEAD)" | cut -d'/' -f4
main = !git rev-parse --abbrev-ref origin/HEAD | cut -d'/' -f2
curbranch = symbolic-ref --short HEAD
upstream = !git rev-parse --abbrev-ref --symbolic-full-name @{upstream} || git rev-parse --abbrev-ref --symbolic-full-name @{push} || echo origin/$(git curbranch)

View file

@ -44,3 +44,5 @@ x-scheme-handler/tg=telegram.desktop;
video/mp4=vlc.desktop;
text/calendar=emacsclient.desktop;
video/x-m4v=vlc.desktop
text/vcard=emacs.desktop
text/plain=emacs.desktop

View file

@ -238,7 +238,7 @@ alias v='edit'
alias st='synct'
command -v dtrx >/dev/null && alias ex='dtrx'
alias expr='noglob expr'
alias get='noglob ='
alias calc='noglob ='
alias bi='b .*ignore*'
# Shortcuts
@ -265,6 +265,7 @@ del() {
m "$@" $trash
}
alias get='curlie --location'
curlh() {
curl -v --location "$@" >/dev/null
}

View file

@ -4,8 +4,9 @@ command -v notify-send >/dev/null &&
if which jrnl >/dev/null; then
j(){ jrnl "$@" && jrnl-tag; }
jn() { jrnl -to today "$@" | less --exit-follow-on-close +F; }
alias jnc='jn -contains'
jna() { jrnl -to today "$@" | less --exit-follow-on-close +F; }
alias jn='jna -n 99'
alias jnc='jna -contains'
alias jne='jrnl --edit'
fi

View file

@ -41,8 +41,10 @@ stack() {
# Uncomment the line below to always use the main stackspin repo, even when running in a fork.
#export GITLAB_CI="true"
echo Selected Stackspin cluster "$_cluster_name" with IP "$_cluster_ip"
echo "$_cluster_name" >"$_stackspin_cluster_cache"
echo "$_cluster_name" >"$_stackspin_cluster_cache" || true
#test "$PWD" = "$HOME" && builtin cd "$STACKSPIN"
;;
(activate)
test -d "$STACKSPIN" && . $STACKSPIN/env/bin/activate
;;
(sso) "$cmdname" exec dashboard-backend -- flask "$@";;
@ -74,7 +76,7 @@ stack() {
export name=${2:-$(echo $mail | sed -E 's/(.*)\.(.*)@.*/\u\1 \u\2/' )}
#echo "$mail,$name"
stack user init "$mail" "$name"
stack-invite
stack-invite "$3"
);;
(push)
test -f "$1" && $EDITOR "$1"
@ -174,11 +176,13 @@ stack() {
# KUBE
# app clis
(occ) "$cmdname" exec nc-nextcloud -c nextcloud -it -- su www-data -s /bin/bash -c "php $command $*";;
(zulip) "$cmdname" exec zulip -- su zulip -c "/home/zulip/deployments/current/manage.py $*";;
(vikunja*)
local pod=$command
case "$1" in
(dump|export) cd "$PROJECTS/vikunja"
"$cmdname" exec "$pod-api" -- sh -c 'rm -f *.zip && ./vikunja dump >/dev/null && ls --color -lAhF >&2 && cat *.zip' >"$pod-dump_$(date +%F).zip"
"$cmdname" exec "$pod-api" -- \
sh -c 'rm -f *.zip && ./vikunja dump >/dev/null && ls --color -lAhF >&2 && cat *.zip' >"$pod-dump_$(date +%F).zip"
;;
(restore)
if ! test -f "$2"
@ -189,13 +193,36 @@ stack() {
"$cmdname" upload "$pod-api" "$file"
"$cmdname" exec "$pod-api" -it -- ./vikunja restore "$file"
;;
(psql) kubectl exec -it -n $("$cmdname" pod "$pod-postgresql") -- sh -c "PGPASSWORD=$(kubectl get secret --namespace stackspout $pod-postgresql -o jsonpath='{.data.password}' | base64 --decode) psql -h localhost -U vikunja -p 5432 vikunja";;
(psql)
kubectl exec -it -n $("$cmdname" pod "$pod-postgresql") -- \
sh -c "PGPASSWORD=$(kubectl get secret --namespace stackspout $pod-postgresql -o jsonpath='{.data.password}' | base64 --decode) psql -h localhost -U vikunja -p 5432 vikunja";;
(*) echo "Unknown $command subcommand";;
esac
;;
(psql)
local app=$1
shift
case "$1" in
(restore)
shift
file=$1
db=${2:-$app}
"$cmdname" upload "$app-postgresql" "$file"
"$cmdname" psql "$app" exec createdb "$db"
stack psql "$app" "$db" -f \
$(kubectl describe pod -n $(stack pod "$app-postgresql") | grep "from data" | awk '{print $1}')/$file
;;
(exec) command="$2"
shift 2
kubectl exec -it -n $("$cmdname" pod "$app-postgresql") -- sh -c "PGPASSWORD=$(kubectl get secret --namespace stackspout $app-postgresql -o jsonpath='{.data.password}' | base64 --decode) $command -h localhost -U $app -p 5432 $*"
;;
(*)
"$cmdname" psql "$app" exec psql "$@"
;;
esac;;
(maria)
app=$1
pw="$(kubectl get secret -n flux-system stackspin-$app-variables --template '{{.data.mariadb_password}}' | base64 -d 2>/dev/null ||
local app=$1
local pw="$(kubectl get secret -n flux-system stackspin-$app-variables --template '{{.data.mariadb_password}}' | base64 -d 2>/dev/null ||
kubectl get secret -n flux-system stackspin-$app-variables --template "{{.data.${app}_mariadb_password}}" | base64 -d)"
case $app in
(nextcloud) n=nc-mariadb;;
@ -211,7 +238,7 @@ stack() {
;;
# high-level
(shell)
container=$1
local container=$1
shift
test "$1" = "-c" && pod=$2 && shift 2
"$cmdname" exec "$container" -c "$pod" -it -- /bin/sh "$@";;
@ -240,13 +267,13 @@ stack() {
for arg
do case "$arg" in (-*) break;; (*) commands+="$arg"; shift;; esac
done
local IFS=$'\n'
for namespacedpod in $pods; do
namespacedpod="$pods"
#while IFS= read -r namespacedpod; do
test "$subcommand" = get ||
highlight "Running $subcommand on $namespacedpod" >&2
local IFS=' '
kubectl "$subcommand" "${commands[@]}" -n $namespacedpod "$@"
done;;
#done <<< "$pods"
;;
(pod)
test $# -gt 0 && local podname=$1 && shift
if ! 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"
@ -277,6 +304,10 @@ stack() {
cp -nv install/kustomization.yaml $CLUSTER_DIR/
kubectl get namespace flux-system 2>/dev/null || kubectl create namespace flux-system
kubectl apply -k $CLUSTER_DIR
ssh "root@${_cluster_name}" mkdir /etc/nftables.d
ssh "root@${_cluster_name}" echo 'tcp dport { 2222 } counter accept' | tee /etc/nftables.d/ssh.nft
./install/install-stackspin.sh
;;
esac

View file

@ -2,3 +2,10 @@ input type:touchpad {
tap enabled
natural_scroll disabled
}
# TODO not working
bindsym $mod+Alt+t swaymsg input type:touchpad events toggle
#input "pointer:motion:MSFT0002:01.*" {
# xinput events disable type:touchpad
#}

View file

@ -40,7 +40,7 @@ repos = [
#pull_predefined = false
# Arguments to pass Git when pulling Repositories
pull_arguments = "--rebase --autostash --recurse-submodules"
#pull_arguments = "--rebase --autostash --recurse-submodules"
[composer]
#self_update = false

View file

@ -5,7 +5,8 @@
# Arrange displays in a ROW (default, left to right) or a COLUMN (top to bottom)
ARRANGE: COLUMN
#ARRANGE: COLUMN
ARRANGE: ROW
# Align ROWs at the TOP (default), MIDDLE or BOTTOM
# Align COLUMNs at the LEFT (default), MIDDLE or RIGHT
@ -17,11 +18,11 @@ ALIGN: MIDDLE
ORDER:
- 'C24F390'
- 'LOEWE'
- 'DP-4'
- 'DP-4' # left port
- 'VFV'
- 'BOE' #internal
- 'DP-3'
- 'DP-1'
- 'BOE'
- 'DP-1' # right port
# The default is to scale each display by DPI.
# This may be disabled and scale 1 will be used, unless a SCALE has been specified.

View file

@ -159,10 +159,10 @@ setopt hist_save_no_dups
setopt hist_reduce_blanks
unsetopt hist_ignore_space
zshaddhistory() {
[[ $1 != netkeeper* ]] && [[ $1 != killm* ]] && [[ $1 != "stretchly reset" ]]
[[ $1 != netkeeper* ]] && [[ $1 != killm* ]] && [[ $1 != "stretchly reset" ]]
}
setopt sh_word_split
setopt sh_word_split # https://github.com/zsh-users/zsh-history-substring-search/issues/154
setopt extended_glob
unsetopt case_glob

View file

@ -32,7 +32,7 @@ shift "$(($OPTIND -1))"
checkperm() {
checkaccess -r "$@" || elevate=sudo
mime="$(test -n "$shifted" || $elevate file --dereference --mime -- "$@")"
mime="$(test -n "$shifted" || $elevate file --dereference --mime-type -- "$@")"
}
fileinfo() {
tput setaf 4
@ -79,7 +79,7 @@ for arg; do
tmpfile="$prefix/$(basename -- "$arg")_$(dd "if=$arg" bs=512 count=10 2>/dev/null | md5sum | tr -d ' ' || true)"
mkdir -p "$prefix"
case "$mime" in
(*\ application/pdf\;*)
(*\ application/pdf)
grid=$(expr $(tput cols) \* $# / $(tput lines))
grid=$(expr 3 \& $grid \< 3 \| $grid)
#limit=$(expr $grid \& \( $grid \> 3 \| $# \> 1 \) \| $grid '*' 2)
@ -101,6 +101,7 @@ for arg; do
timg+=("$tmpfile");;
# TODO .raw .img
(*/x-iso*|*/x-qemu-disk*) fdisk -l "$arg";;
(*/vnd.android.package-archive) aapt dump badging "$arg" | grep package | cut -d' ' -f2-;;
(*\ video/*)
suffix=_thumbs.jpg
! $inspect &&
@ -113,7 +114,7 @@ for arg; do
(*\ image/*)
timg+=("$arg")
which identify >/dev/null && continue;;
(*\ inode/directory\;*)
(*\ inode/directory)
ls+=("$arg")
test -L "$arg" || continue
;;

View file

@ -3,6 +3,7 @@
# Usage: bag [-n] [--dry-run] [--home] [--root MOUNTED_ROOT]
root="/"
args="--progress --stats"
case $BORG_REPO in (*:*) run=borg;; esac
while test $# -gt 0; do
case "$1" in
(-n) run="arg-test"; shift;;

View file

@ -78,7 +78,7 @@ highlight "c :: clean electron caches"
highlight "o :: optimize space extensively"
if [[ $1 =~ "o" ]]; then
sudo find /root/.cache $XDG_CACHE_HOME /var/cache /var/log /var/tmp -mindepth 1 -maxdepth 2 -atime +2 -exec rm -r {} + -prune
sudo find /root/.cache $XDG_CACHE_HOME /var/cache /var/log /var/tmp -not -name CACHEDIR.TAG -mindepth 1 -maxdepth 2 -atime +2 -exec rm -r {} + -prune
if test -f "/var/log/apt/history.log"; then
aptclean_cur=$(cat "/var/log/apt/history.log" | wc -l)

View file

@ -26,6 +26,6 @@ fi
if test "$command"; then
echo "Generated through $command"
$(test $(tput cols) -gt 120 && echo "diff --color=always --side-by-side" || echo "diff-color") \
--report-identical-files --label="${files[0]}" --label="${files[1]}" <($command "${files[0]}") <($command "${files[1]}")
--ignore-case --report-identical-files --label="${files[0]}" --label="${files[1]}" <($command "${files[0]}") <($command "${files[1]}")
fi
} | less --RAW-CONTROL-CHARS --quit-on-intr --quit-if-one-screen

View file

@ -16,8 +16,8 @@ sudo hdparm -MWAgt "$disk"
if test $# -eq 0
then highlight "Write Test"
sync
# This prevents predictions by using random, but since that is too slow we have to copy a previously created file
count=100$(test $(df --output="avail" . | tail -1) -gt 999999 && echo 0 || true)
# This prevents predictions by using random, but since that is too slow we have to copy a previously created file
highlight "Preparing random bits:" &&
sudo dd status=progress if=/dev/random of=/var/tmp/tempfile bs=1M count=$count &&
highlight "Copying random bits:" &&

View file

@ -20,7 +20,7 @@ case $host in
(hub|github) host=git@github.com;;
(lab) host=git@gitlab.com;;
(jf) host=gitea@git.jfischer.org;;
(ftt|"") host=git@code.ftt.gmbh; user=janek;;
(ftt|"") host=git@forge.ftt.gmbh; user=janek;;
esac
user=${3:-${user:-$(git config user.name)}}
repo=${2:-$(basename $(git root))}

View file

@ -2,7 +2,7 @@
# Find terms in jrnl files and turn them into tags
# Check with jrnl --tags
if test $# -eq 0
then $0 sleep nap health tech read dev phone Zinc run bike tour laptop computer PC CB piano faith journal
then $0 sleep uni work nap health tech read girl dev phone Zinc run bike tour laptop computer PC CB piano faith journal Catherine Franklin Kerstin Henri Katja Erlangen Bayreuth Berlin ICF
else
for arg
do rpl "\(^\|[^@]\)\b$arg\b" "\1@$arg" $JOURNAL/*.txt 2>/dev/null

View file

@ -72,4 +72,5 @@ then mp="/run/media/$USER/$arg" && test -e "$mp" && mountpoint="$mp"
sudo mount -vo users,X-mount.mkdir,noatime $params "$partition" "$mountpoint" "$@"
fi
cd $mountpoint
df -x tmpfs -x devtmpfs -x squashfs --human-readable
exec $SHELL

6
.local/bin/scripts/mpq Executable file
View file

@ -0,0 +1,6 @@
#!/bin/sh -e
# MPC add file to queue
for arg
do fullpath=$(realpath "$arg")
mpc insert "${fullpath/$MUSIC\//}"
done

View file

@ -2,4 +2,4 @@
#for app in wordpress nextcloud velero vikunja ninja
#do stack user setrole
#done
pass business/ftt/invite | envsubst | ssh nc-iridion sudo sendmail -v "$mail"
pass business/ftt/invite"$1" | envsubst | ssh nc-iridion sudo sendmail -v "$mail"

View file

@ -147,9 +147,11 @@ data:
ingress:
enabled: true
# Elaborate style
# Elaborate (TrueCharts) style
annotations:
kubernetes.io/tls-acme: "true"
nginx.ingress.kubernetes.io/configuration-snippet: |
more_set_headers "Content-Security-Policy: frame-ancestors 'self' files.${domain}";
hosts:
- host: "\${${app}_domain}"
paths:
@ -243,7 +245,7 @@ metadata:
namespace: flux-system
spec:
fields:
- fieldname: password
- fieldName: password
EOF
cat <<EOF >"$app-secrets/$app-oauth-secret.yaml"
---

View file

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/sh -x
# Convert given file to PNG
pdftoppm -png "$@" >"$1.png" ||
convert -background white -alpha off -density 500 "$@" "$1.png"

View file

@ -8,7 +8,7 @@ export_existing() {
export_existing DATA $HOME/daten $HOME/data
export MUSIC="$DATA/4-media/music"
export BORG_REPO='/mnt/backup/borg'
export BORG_REPO='admin@172.16.0.2:/mnt/b/user/janek/backup/janek-borg'
export BORG_PASSCOMMAND='pass service/device/borg/backup'
# xdg
@ -102,8 +102,8 @@ export LESS="--raw-control-chars --ignore-case --LONG-PROMPT --jump-target=5 $(t
# TODO put into config file and use --exclude-from
# -x 'System Volume Information'
export DIRS_GENERATED="-x generated -x .gradle -x cmake_build -x dist-newstyle -x node_modules -x __pycache__ -x .pytest_cache"
export DIRS_IGNORE_SAFE="-x .cache -x .cpan -x *Cache -x .pyenv -x .local/cache -x share/baloo -x share/cabal -x share/cargo -x share/digikam -x share/gem -x share/JetBrains -x share/tldr -x share/syncthing -x share/Steam/ubuntu* -x share/Steam/package -x share/virtualenv -x share/Zeal -x state/gradle -x state/android -x Ferdi/Partitions -x oh-my-zsh -x wine/drive_c/windows -x vendor/cache $DIRS_GENERATED"
export DIRS_IGNORE="-x .sync -x .stfolder -x *build -x .git -x .idea -x env -x out -x cache -x Partitions -x vendor/bundle -x log $DIRS_IGNORE_SAFE"
export DIRS_IGNORE_SAFE="-x .cache -x .cpan -x *Cache -x .pyenv -x .local/cache -x .config/DeltaChat -x .config/discord -x .config/Slack -x .config/syncthing -x share/baloo -x share/cabal -x share/cargo -x share/digikam -x share/gem -x share/JetBrains -x share/tldr -x share/syncthing -x share/Steam/ubuntu* -x share/Steam/package -x share/virtualenv -x share/Zeal -x state/gradle -x state/android -x Ferdi/Partitions -x oh-my-zsh -x wine/drive_c/windows -x vendor/cache $DIRS_GENERATED"
export DIRS_IGNORE="-x .archive -x .sync -x .stfolder -x *build -x .git -x .idea -x env -x out -x cache -x Partitions -x vendor/bundle -x log $DIRS_IGNORE_SAFE"
# red stderr
test -f "/usr/lib/libstderred.so" && export LD_PRELOAD="/usr/lib/libstderred.so${LD_PRELOAD:+:$LD_PRELOAD}"
# software config
@ -159,3 +159,5 @@ export CTEST_OUTPUT_ON_FAILURE=1
#autolight
#export TZ='Europe/Dublin'
#export TZ='Africa/Nairobi'
export CONTEST_NETWORK=lan-restricted-dev