feat: cleanup aliases, arkenfox

This commit is contained in:
ange 2025-02-25 12:38:38 +00:00
parent 308bdf15f7
commit 23d1e06c20
Signed by: ange
GPG Key ID: 9E0C4157BB7BEB1D
21 changed files with 2830 additions and 237 deletions

View File

@ -25,7 +25,7 @@ export W3M_DIR="$XDG_STATE_HOME/w3m"
export PATH="$HOME/.local/bin:$XDG_DATA_HOME/flatpak/exports/bin:/var/lib/flatpak/exports/bin:$PATH"
export BROWSER=org.mozilla.firefox
export BROWSER=firefox
export EDITOR=nvim
export VISUAL=nvim
export PAGER=less

View File

@ -3,11 +3,13 @@ function _compalias() {
name="${COMP_WORDS[0]}"
val="${BASH_ALIASES[$name]}"
[ -z "$val" ] && return 1
if [ -z "$val" ]; then
return 1
fi
read -ra valarr <<< "$val"
COMP_WORDS=("${valarr[@]}" "${COMP_WORDS[@]:1}")
COMP_LINE="${COMP_LINE//$name/$val}"
COMP_CWORD="$((${#COMP_WORDS[@]} - 1))"
COMP_CWORD=$((${#COMP_WORDS[@]} - 1))
COMP_POINT="${#COMP_LINE}"
fn="$(complete -p "${COMP_WORDS[0]}" | grep -Po -- '-F\s+\K\w+')"
"$fn" "${COMP_WORDS[0]}" "${COMP_WORDS[-1]}" "${COMP_WORDS[-2]}"

View File

@ -1,5 +1,7 @@
function bat() {
[ -z "$1" ] && return 1
if [ -z "$1" ]; then
return 1
fi
TERM='tty' $EDITOR --cmd "set lines=$(grep -c '' "$1")" +redraw +q "$1"
}
@ -12,13 +14,14 @@ function gi() {
}
function update() {
$TERM --hold -e "$SHELL" -c "sudo pacman -Syu && echo $'\e[32mDONE'" &
$TERM --hold -e "$SHELL" -c "flatpak update && echo -e $'\e[32mDONE'" &
$TERM --hold -e "$SHELL" -ic "cd && c submodule update --remote --recursive && echo $'\e[32mDONE'" &
$TERM --hold -e "$SHELL" -xc "sudo pacman -Syu && echo $'\e[32mDONE'" &
$TERM --hold -e "$SHELL" -xc "flatpak update && echo -e $'\e[32mDONE'" &
$TERM --hold -e "$SHELL" -xc "git --git-dir='$HOME/.dotfiles/' --work-tree='$HOME' submodule update --remote --recursive && echo $'\e[32mDONE'" &
$TERM --hold -e "$SHELL" -xc "firefox update && echo -e $'\e[32mDONE'" &
}
function tmp() {
cd "$(mktemp -d --tmpdir "$1"XXX)" || return
cd "$(mktemp -d "$1"XXX)" || return
}
alias -- \
@ -53,7 +56,7 @@ alias -- \
watch='watch -c ' \
waydroid='cage -- waydroid' \
xargs='xargs ' \
xmr='monero-wallet-cli --daemon-address monero.maby.dev:18081 --trusted-daemon --log-file=/tmp/monero-wallet-cli.log --wallet-file $XDG_CONFIG_HOME/.config/monero/ange'
xmr='monero-wallet-cli --daemon-address monero.maby.dev:18081 --trusted-daemon --log-file=/tmp/monero-wallet-cli.log --wallet-file $XDG_CONFIG_HOME/monero/ange'
. /usr/share/git/completion/git-completion.bash
$(complete -p git) g c

View File

@ -41,24 +41,24 @@ compalias dk='podman' \
dkvlsq='podman volume ls -q' \
dkvrm='podman volume rm'
alias dc='docker-compose' \
dcb='docker-compose build' \
dccls='docker-compose ps' \
dcclsq='docker-compose ps -q' \
dcd='docker-compose down' \
dcex='docker-compose exec' \
dcl='docker-compose pull' \
dcr='docker-compose run --rm' \
dcrd='docker-compose run -d --rm' \
dcrm='docker-compose rm' \
dcrmv='docker-compose rm -v' \
dcsp='docker-compose stop' \
dcst='docker-compose restart' \
dcup='docker-compose up' \
dcupb='docker-compose up --build' \
dcupd='docker-compose up -d' \
dcupdb='docker-compose up -d --build' \
dcw='docker-compose up --build -w'
compalias dc='docker-compose' \
dcb='docker-compose build' \
dccls='docker-compose ps' \
dcclsq='docker-compose ps -q' \
dcd='docker-compose down' \
dcex='docker-compose exec' \
dcl='docker-compose pull' \
dcr='docker-compose run --rm' \
dcrd='docker-compose run -d --rm' \
dcrm='docker-compose rm' \
dcrmv='docker-compose rm -v' \
dcsp='docker-compose stop' \
dcst='docker-compose restart' \
dcup='docker-compose up' \
dcupb='docker-compose up --build' \
dcupd='docker-compose up -d' \
dcupdb='docker-compose up -d --build' \
dcw='docker-compose up --build -w'
function dkb() {
local name="${1:-${PWD##*/}}"; shift
@ -67,7 +67,8 @@ function dkb() {
}
function dkr() {
[ -z "$1" ] && set -- "${PWD##*/}"
if [ -z "$1" ]; then
set -- "${PWD##*/}"
fi
docker run -i -t "$@"
}

View File

@ -1,15 +1,19 @@
function kns() {
local cache="$XDG_CACHE_HOME/${FUNCNAME[0]}"
local conf="${KUBECONFIG:-"$HOME/.kube/config"}"
if [ -n "$1" ]; then
if ! kubectl get namespace -o name | grep -q "^namespace/$1\$"; then
if [ "$1" == - ]; then
echo "not implemented" >&2
return 1
elif [ -n "$1" ]; then
if ! kubectl get namespace -oname | grep -q "^namespace/$1\$"; then
echo "error: no namespace exists with the name: \"$1\"" >&2
return 1
fi
kubectl config set-context --current --namespace "$1" > /dev/null
else
if [ "${KUBECONFIG:-"$HOME/.kube/config"}" -nt "$cache" ]; then
set -- "$(kubectl config view --minify -o jsonpath='{..namespace}')"
if [ "$conf" -nt "$cache" ]; then
set -- "$(kubectl config view --minify -ojsonpath='{..namespace}')"
else
cat "$cache"
return
@ -20,11 +24,15 @@ function kns() {
function kctx() {
local cache="$XDG_CACHE_HOME/${FUNCNAME[0]}"
local conf="${KUBECONFIG:-"$HOME/.kube/config"}"
if [ -n "$1" ]; then
if [ "$1" == - ]; then
echo "not implemented" >&2
return 1
elif [ -n "$1" ]; then
kubectl config use-context "$1" > /dev/null || return
else
if [ "${KUBECONFIG:-"$HOME/.kube/config"}" -nt "$cache" ]; then
if [ "$conf" -nt "$cache" ]; then
set -- "$(kubectl config current-context)"
else
cat "$cache"
@ -34,129 +42,60 @@ function kctx() {
tee "$cache" <<< "$1"
}
alias kga='kubectl get "$(kubectl api-resources --verbs=list --namespaced -oname | grep -v event | paste -sd,)"'
alias kga='kubectl get "$(kubectl api-resources --verbs=list --namespaced -oname | grep -v event | paste -sd,)"' \
kgaoname='kubectl get "$(kubectl api-resources --verbs=list --namespaced -oname | grep -v event | paste -sd,)" -oname' \
kgaowide='kubectl get "$(kubectl api-resources --verbs=list --namespaced -oname | grep -v event | paste -sd,)" -owide' \
kgaoyaml='kubectl get "$(kubectl api-resources --verbs=list --namespaced -oname | grep -v event | paste -sd,)" -oyaml'
. /usr/share/bash-completion/completions/kubectl
compalias k=kubectl \
ka='kubectl apply --recursive -f' \
kd='kubectl describe' \
kdcj='kubectl describe cronjob' \
kdcm='kubectl describe configmap' \
kddep='kubectl describe deployment' \
kding='kubectl describe ingress' \
kdj='kubectl describe job' \
kdno='kubectl describe node' \
kdns='kubectl describe namespace' \
kdpo='kubectl describe pod' \
kdpvc='kubectl describe persistentvolumeclaim' \
kdsec='kubectl describe secret' \
kdsts='kubectl describe statefulset' \
kdsvc='kubectl describe service' \
kex='kubectl exec -i -t' \
kg='kubectl get' \
kgall='kubectl get --all-namespaces' \
kgalloname='kubectl get --all-namespaces -o name' \
kgallowide='kubectl get --all-namespaces -o wide' \
kgalloyaml='kubectl get --all-namespaces -o yaml' \
kgcj='kubectl get cronjob' \
kgcjall='kubectl get cronjob --all-namespaces' \
kgcjalloname='kubectl get cronjob --all-namespaces -o name' \
kgcjallowide='kubectl get cronjob --all-namespaces -o wide' \
kgcjalloyaml='kubectl get cronjob --all-namespaces -o yaml' \
kgcjoname='kubectl get cronjob -o name' \
kgcjowide='kubectl get cronjob -o wide' \
kgcjoyaml='kubectl get cronjob -o yaml' \
kgcm='kubectl get configmap' \
kgcmall='kubectl get configmap --all-namespaces' \
kgcmalloname='kubectl get configmap --all-namespaces -o name' \
kgcmallowide='kubectl get configmap --all-namespaces -o wide' \
kgcmalloyaml='kubectl get configmap --all-namespaces -o yaml' \
kgcmoname='kubectl get configmap -o name' \
kgcmowide='kubectl get configmap -o wide' \
kgcmoyaml='kubectl get configmap -o yaml' \
kgdep='kubectl get deployment' \
kgdepall='kubectl get deployment --all-namespaces' \
kgdepalloname='kubectl get deployment --all-namespaces -o name' \
kgdepallowide='kubectl get deployment --all-namespaces -o wide' \
kgdepalloyaml='kubectl get deployment --all-namespaces -o yaml' \
kgdeponame='kubectl get deployment -o name' \
kgdepowide='kubectl get deployment -o wide' \
kgdepoyaml='kubectl get deployment -o yaml' \
kging='kubectl get ingress' \
kgingall='kubectl get ingress --all-namespaces' \
kgingalloname='kubectl get ingress --all-namespaces -o name' \
kgingallowide='kubectl get ingress --all-namespaces -o wide' \
kgingalloyaml='kubectl get ingress --all-namespaces -o yaml' \
kgingoname='kubectl get ingress -o name' \
kgingowide='kubectl get ingress -o wide' \
kgingoyaml='kubectl get ingress -o yaml' \
kgj='kubectl get job' \
kgjall='kubectl get job --all-namespaces' \
kgjalloname='kubectl get job --all-namespaces -o name' \
kgjallowide='kubectl get job --all-namespaces -o wide' \
kgjalloyaml='kubectl get job --all-namespaces -o yaml' \
kgjoname='kubectl get job -o name' \
kgjowide='kubectl get job -o wide' \
kgjoyaml='kubectl get job -o yaml' \
kgno='kubectl get node' \
kgns='kubectl get namespace' \
kgnsoname='kubectl get namespace -o name' \
kgnsowide='kubectl get namespace -o wide' \
kgnsoyaml='kubectl get namespace -o yaml' \
kgoname='kubectl get -o name' \
kgowide='kubectl get -o wide' \
kgoyaml='kubectl get -o yaml' \
kgpo='kubectl get pod' \
kgpoall='kubectl get pod --all-namespaces' \
kgpoalloname='kubectl get pod --all-namespaces -o name' \
kgpoallowide='kubectl get pod --all-namespaces -o wide' \
kgpoalloyaml='kubectl get pod --all-namespaces -o yaml' \
kgpooname='kubectl get pod -o name' \
kgpoowide='kubectl get pod -o wide' \
kgpooyaml='kubectl get pod -o yaml' \
kgpvc='kubectl get persistentvolumeclaim' \
kgpvcall='kubectl get persistentvolumeclaim --all-namespaces' \
kgpvcalloname='kubectl get persistentvolumeclaim --all-namespaces -o name' \
kgpvcallowide='kubectl get persistentvolumeclaim --all-namespaces -o wide' \
kgpvcalloyaml='kubectl get persistentvolumeclaim --all-namespaces -o yaml' \
kgpvconame='kubectl get persistentvolumeclaim -o name' \
kgpvcowide='kubectl get persistentvolumeclaim -o wide' \
kgpvcoyaml='kubectl get persistentvolumeclaim -o yaml' \
kgsec='kubectl get secret' \
kgsecall='kubectl get secret --all-namespaces' \
kgsecalloname='kubectl get secret --all-namespaces -o name' \
kgsecallowide='kubectl get secret --all-namespaces -o wide' \
kgsecalloyaml='kubectl get secret --all-namespaces -o yaml' \
kgseconame='kubectl get secret -o name' \
kgsecowide='kubectl get secret -o wide' \
kgsecoyaml='kubectl get secret -o yaml' \
kgsts='kubectl get statefulset' \
kgstsall='kubectl get statefulset --all-namespaces' \
kgstsalloname='kubectl get statefulset --all-namespaces -o name' \
kgstsallowide='kubectl get statefulset --all-namespaces -o wide' \
kgstsalloyaml='kubectl get statefulset --all-namespaces -o yaml' \
kgstsoname='kubectl get statefulset -o name' \
kgstsowide='kubectl get statefulset -o wide' \
kgstsoyaml='kubectl get statefulset -o yaml' \
kgsvc='kubectl get service' \
kgsvcall='kubectl get service --all-namespaces' \
kgsvcalloname='kubectl get service --all-namespaces -o name' \
kgsvcallowide='kubectl get service --all-namespaces -o wide' \
kgsvcalloyaml='kubectl get service --all-namespaces -o yaml' \
kgsvconame='kubectl get service -o name' \
kgsvcowide='kubectl get service -o wide' \
kgsvcoyaml='kubectl get service -o yaml' \
klo='kubectl logs -f' \
kpf='kubectl port-forward' \
krm='kubectl delete' \
krmcj='kubectl delete cronjob' \
krmcm='kubectl delete configmap' \
krmdep='kubectl delete deployment' \
krming='kubectl delete ingress' \
krmj='kubectl delete job' \
krmns='kubectl delete namespace' \
krmpo='kubectl delete pod' \
krmpvc='kubectl delete persistentvolumeclaim' \
krmsec='kubectl delete secret' \
krmsts='kubectl delete statefulset' \
krmsvc='kubectl delete service'
function _k8salias() {
local name short
for a in "$@"; do
name="${a#*=}" short="${a%%=*}"
compalias "kd${short}=kubectl describe $name" \
"kd${short}alloname=kubectl describe $name --all-namespaces -oname" \
"kd${short}allowide=kubectl describe $name --all-namespaces -owide" \
"kd${short}alloyaml=kubectl describe $name --all-namespaces -oyaml" \
"kd${short}oname=kubectl describe $name -oname" \
"kd${short}owide=kubectl describe $name -owide" \
"kd${short}oyaml=kubectl describe $name -oyaml" \
"kg${short}=kubectl get $name" \
"kg${short}alloname=kubectl get $name --all-namespaces -oname" \
"kg${short}allowide=kubectl get $name --all-namespaces -owide" \
"kg${short}alloyaml=kubectl get $name --all-namespaces -oyaml" \
"kg${short}oname=kubectl get $name -oname" \
"kg${short}owide=kubectl get $name -owide" \
"kg${short}oyaml=kubectl get $name -oyaml" \
"krm${short}=kubectl delete $name" \
"krm${short}alloname=kubectl delete $name --all-namespaces -oname" \
"krm${short}allowide=kubectl delete $name --all-namespaces -owide" \
"krm${short}alloyaml=kubectl delete $name --all-namespaces -oyaml" \
"krm${short}oname=kubectl delete $name -oname" \
"krm${short}owide=kubectl delete $name -owide" \
"krm${short}oyaml=kubectl delete $name -oyaml"
done
}
_k8salias cj=cronjob \
cm=configmap \
dep=deployment \
ing=ingress \
j=job \
ns=namespace \
po=pod \
pvc=persistentvolumeclaim \
pv=persistentvolume \
sec=secret \
sts=statefulset \
svc=service
unset -f _k8salias

View File

@ -25,8 +25,14 @@ function precmd() {
# shellcheck disable=SC2086
unset ${!PROMPT_P*}
[ -n "$VIRTUAL_ENV" ] && PROMPT_PVENV="${VIRTUAL_ENV%/*}" && PROMPT_PVENV="${PROMPT_PVENV##*/}"$'\n'
[ -n "$ctx" ] && PROMPT_PK8S="$ctx/$(kns) "
[[ "$err" =~ [1-9] ]] && PROMPT_PERR="${err// /|} "
if [ -n "$VIRTUAL_ENV" ]; then
PROMPT_PVENV="${VIRTUAL_ENV%/*}" && PROMPT_PVENV="${PROMPT_PVENV##*/}"$'\n'
fi
if [ -n "$ctx" ]; then
PROMPT_PK8S="$ctx/$(kns) "
fi
if [[ "$err" =~ [1-9] ]]; then
PROMPT_PERR="${err// /|} "
fi
}
PS1='\[\e[00;38;5;37m\]$PROMPT_PVENV\[\e[38;5;134m\]$PROMPT_PK8S\[\e[00m\]$(__git_ps1 "%s ")\[\e[01;38;5;32m\]\w\[\e[00m\] \[\e[38;5;160m\]$PROMPT_PERR${_[\j<1]+\[\e[38;5;71m\]\j }\[\e[00m\]'

View File

@ -6,7 +6,7 @@
[diff]
tool = nvimdiff
[difftool "nvimdiff"]
cmd = nvim -d -c \"wincmd l\" \"$LOCAL\" \"$REMOTE\"
cmd = nvim -d \"$REMOTE\" \"$LOCAL\"
[init]
defaultBranch = main
[alias]

View File

@ -11,15 +11,16 @@ https://suckless.org/atom.xml "su
https://tails.net/news/index.en.rss "Tails"
@ Updates
https://gitea.com/gitea/act_runner/releases.rss "Act runner"
https://github.com/arkenfox/user.js/releases.atom "arkenfox"
https://github.com/vector-im/element-web/releases.atom "Element" < item-rule "title NOT LIKE '%-rc._'"
https://github.com/go-gitea/gitea/releases.atom "Gitea" < item-rule "title NOT LIKE '%-rc_' AND title NOT LIKE '%-dev%'"
https://gitea.com/gitea/act_runner/releases.rss "Act runner"
https://github.com/jellyfin/jellyfin/releases.atom "Jellyfin"
https://www.getmonero.org/feed.xml "Monero" < item-rule "title NOT LIKE 'Monero GUI%released'"
https://github.com/nextcloud/server/releases.atom "Nextcloud" < item-rule "title NOT LIKE '%rc_' AND title NOT LIKE '%beta_'"
https://github.com/qbittorrent/qBittorrent/tags.atom "qBittorrent" < item-rule "title NOT LIKE '%rc_' AND title NOT LIKE '%beta_'"
https://github.com/searxng/searxng/commits/master.atom "SearXNG"
https://github.com/element-hq/synapse/releases.atom "Synapse" < item-rule "title NOT LIKE '%rc%'"
https://github.com/qbittorrent/qBittorrent/tags.atom "qBittorrent" < item-rule "title NOT LIKE '%rc_' AND title NOT LIKE '%beta_'"
https://github.com/ventoy/Ventoy/releases.atom "Ventoy"
@ K8S

View File

@ -1 +1 @@
Subproject commit 3707cdb1e43f5cea73afb6037e6494e7ce847a66
Subproject commit 857c5ac632080dba10aae49dba902ce3abf91b35

@ -1 +1 @@
Subproject commit 415af52339215926d705cccc08145f3782c4d132
Subproject commit 814f102cd1da3dc78c7d2f20f2ef3ed3cdf0e6e4

@ -1 +1 @@
Subproject commit 48f7ce34ef274af10a3b2aa24932a310b1bd055d
Subproject commit f0ff9f0e5dab10123d3192b12556aa8f88859790

@ -1 +1 @@
Subproject commit fc9afc0873648dd862c0bebe17f3e7436ac49551
Subproject commit b990349ef3384459b1879d3b535433a95c9af904

View File

@ -21,7 +21,7 @@ elif [[ "$q" == *://* ]]; then
fi
exec xdg-open "$url"
fi
if [[ "$q" == *.* ]] && [[ "$q" != *' '* ]]; then
if [[ "$q" =~ ^[^[:space:]]+(\.[^[:space:]]+)+$ ]]; then
exec $BROWSER "$q"
fi
exec $BROWSER "https://searx.gmoker.com/search?q=$(jq -Rr '@uri' <<< "$q")"

39
.local/bin/firefox Executable file
View File

@ -0,0 +1,39 @@
#!/bin/bash
sites=(
'https://discord.com'
'https://gmoker.com'
'https://linkedin.com'
'https://login.microsoftonline.com'
'https://maby.dev'
'https://web.whatsapp.com'
)
function update() {
local start='^/\*---- USER PREFERENCES ----\*/$'
local end='^/\*---- END USER PREFERENCES ----\*/$'
local af userpref
af="$(curl -L 'https://github.com/arkenfox/user.js/raw/refs/heads/master/user.js')"
while read -r p; do
userpref="$(sed -n "\@$start@,\@$end@p" "$ff/$p/user.js")"
printf '%s\n\n%s\n' "$af" "$userpref" > "$ff/$p/user.js"
done < <(awk -F= '/^Path=/{print $2}' "$ff/profiles.ini")
}
ff="$HOME/.var/app/org.mozilla.firefox/.mozilla/firefox"
if [ "$1" == update ]; then
update
exit
fi
profile="$ff/$(sed -n '/^\[Install/,/^Default=/s/.*=//p' "$ff/profiles.ini")"
if ! fuser -s "$profile"; then
for i in "${!sites[@]}"; do
sq+="INSERT INTO moz_perms VALUES($i,'${sites[$i]}','cookie',1,0,0,0);"
done
sqlite3 "$profile/permissions.sqlite" <<< "DELETE FROM moz_perms; $sq"
sqlite3 "$profile/places.sqlite" <<< "DELETE FROM moz_bookmarks;"
fi
org.mozilla.firefox "$@"

View File

@ -2,7 +2,7 @@
ISO="$1"
DISK="$HOME/${ISO%.*}.qcow2"
MAXMEM="$(free -g | awk '/Mem:/{print $2 - 2 * $3}')G"
MAXMEM="$(free -g | awk '/^Mem:/{print $6 / 2}')G"
OVMF_CODE=/usr/share/edk2/x64/OVMF_CODE.4m.fd
OVMF_VARS=/tmp/OVMF_VARS.4m.fd
@ -10,7 +10,7 @@ set -x
if [ -f "$OVMF_VARS" ]; then
cp -f /usr/share/edk2/x64/OVMF_VARS.4m.fd "$OVMF_VARS"
fi
if [ -f "$DISK" ]; then
if ! [ -f "$DISK" ]; then
qemu-img create -f qcow2 "$DISK" 20G
fi
qemu-system-x86_64 \

View File

@ -23,7 +23,7 @@ function update_vol() {
if [ "$CUR" -lt 0 ]; then
CUR=0
elif [ "$CUR" -gt 300 ]; then
CUR=150
CUR=300
fi
;;
*)

View File

@ -1,12 +1,3 @@
#unified-extensions-button, #unified-extensions-button > .toolbarbutton-icon{
width: 0px !important;
padding: 0px !important;
}
.tab-close-button {
visibility: collapse !important;
}
#alltabs-button {
display: none !important;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff