chore: split aliases

This commit is contained in:
Rick van Lieshout 2023-12-10 00:02:08 +01:00
parent 4308782feb
commit 39a0a5ea72
18 changed files with 237 additions and 169 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
config/.npmrc

View File

@ -1,23 +1,6 @@
# useful dockers #!/bin/bash
alias phpserver='docker run --rm -p 2000:80 -v "$PWD":/var/www/html mastermindzh/php-xdebug' # source program-specific aliases:
alias nodeserver='docker run --rm -p 3000:3000 -v "$PWD":/app mastermindzh/generic_node' for f in ~/.aliases/*; do source "$f"; done
alias reactserver='docker run --rm -p 8080:8080 -v "$PWD":/app mastermindzh/generic_node'
alias mongoserver='docker run -d --rm -p 27017:27017 --name mongo-server -e MONGO_INITDB_ROOT_USERNAME=admin -e MONGO_INITDB_ROOT_PASSWORD=123 -v ~/.db/mongo:/data/db mongo'
alias sqlserver='docker run --rm --name sql-server -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=Your_Password123" -p 1433:1433 -v ~/.db/mssql:/var/opt/mssql mcr.microsoft.com/mssql/server'
# useful docker commands
alias stop-dockers='docker stop $(docker ps -aq)'
alias docker-clean-containers='docker container prune -f --filter "until=48h"'
alias docker-clean-images='docker image prune -a -f --filter "until=48h"'
alias docker-clean-volumes='docker volume prune -f --filter "label!=keep"'
alias docker-clean-networks='docker network prune -f --filter "until=24h"'
alias docker-clean-all='stop-dockers && docker-clean-containers && docker-clean-images && docker-clean-volumes && docker-clean-networks'
# Kubernetes commands
alias mkubectl='microk8s.kubectl'
alias kubestart='microk8s.start'
alias kubestop='microk8s.stop'
alias kubecontexts='kubectl config get-contexts'
#dotnet core #dotnet core
alias efupdate="dotnet ef database update" alias efupdate="dotnet ef database update"
@ -37,7 +20,12 @@ alias update='trizen --sudo_remove_timestamp=0 --sudo_autorepeat=1 --sudo_autore
alias remove-orphans='sudo pacman -Rns $(pacman -Qtdq)' alias remove-orphans='sudo pacman -Rns $(pacman -Qtdq)'
alias updatekeys='sudo pacman-key --refresh-key' alias updatekeys='sudo pacman-key --refresh-key'
alias clean-pacmancache='sudo paccache -rk 1 && sudo paccache -ruk0' alias clean-pacmancache='sudo paccache -rk 1 && sudo paccache -ruk0'
alias clean-all='sudo pacman -R $(pacman -Qtdq) && sudo paccache -rk 1 && sudo paccache -ruk0 && sudo journalctl --vacuum-time=2d && docker-clean-all && rm -rf ~/.local/share/Trash/' alias clean-trizen-cache='sudo clean-trizen-cache'
alias clean-trash='sudo rm -rf ~/.local/share/Trash/*'
alias clean-journal='sudo journalctl --vacuum-time=2d'
alias clean-pacman-unused='sudo pacman -R $(pacman -Qtdq)'
alias clean-all='clean-pacman-unused && clean-pacmancache && clean-trizen-cache && docker-clean-all && clean-node_modules && clean-journal && clean-trash'
## systeminfo ## systeminfo
alias meminfo='free -mth' alias meminfo='free -mth'
@ -59,15 +47,12 @@ alias enable-wifi='sudo ip link set wlp2s0 up'
alias scan-wifi='sudo iw dev wlp2s0 scan' alias scan-wifi='sudo iw dev wlp2s0 scan'
alias pretty-json='python -m json.tool' alias pretty-json='python -m json.tool'
alias addpgpkey='gpg --recv-keys' alias addpgpkey='gpg --recv-keys'
alias clean-trash='sudo rm -rf ~/.local/share/Trash/*'
alias clean-journal='sudo journalctl --vacuum-time=2d'
alias clean-all='clean-trash && clean-journal && clean-pacmancache && docker-clean-all && clean-node-modules'
alias dotnet-install='~/.dotnet-install.sh --install-dir /usr/share/dotnet/ -channel Current -version ' alias dotnet-install='~/.dotnet-install.sh --install-dir /usr/share/dotnet/ -channel Current -version '
alias mountshares='sudo bash ~/dotfiles/bash/mounts.sh' alias mountshares='sudo bash ~/dotfiles/bash/mounts.sh'
alias echo-server='npx http-echo-server' alias echo-server='npx http-echo-server'
alias mountcalibre='sudo mount.cifs //10.10.1.11/books /mnt/calibre -o nobrl,user=mastermindzh,noperm,rw' alias mountcalibre='sudo mount.cifs //10.10.1.11/books /mnt/calibre -o nobrl,user=mastermindzh,noperm,rw'
alias xpid="xprop _NET_WM_PID | cut -d' ' -f3" alias xpid="xprop _NET_WM_PID | cut -d' ' -f3"
alias clean-node-modules='find . -name "node_modules" -type d -print0 |xargs -0 rm -r --' alias clean-obj-bin='sudo find . -name "bin" -o -name "obj" -exec rm -rf {} \;'
alias nomachine='/usr/NX/bin/nxplayer' alias nomachine='/usr/NX/bin/nxplayer'
alias unlockuser='faillock --reset --user' alias unlockuser='faillock --reset --user'
alias npm-list-links='npm ls -g --depth=0 --link=true' alias npm-list-links='npm ls -g --depth=0 --link=true'
@ -137,19 +122,19 @@ up() {
} }
# function to extract ... well anything really # function to extract ... well anything really
extract() { extract() {
if [ -f $1 ]; then if [ -f "$1" ]; then
case $1 in case "$1" in
*.tar.bz2) tar xvjf $1 ;; *.tar.bz2) tar xvjf "$1" ;;
*.tar.gz) tar xvzf $1 ;; *.tar.gz) tar xvzf "$1" ;;
*.bz2) bunzip2 $1 ;; *.bz2) bunzip2 "$1" ;;
*.rar) unrar x $1 ;; *.rar) unrar x "$1" ;;
*.gz) gunzip $1 ;; *.gz) gunzip "$1" ;;
*.tar) tar xvf $1 ;; *.tar) tar xvf "$1" ;;
*.tbz2) tar xvjf $1 ;; *.tbz2) tar xvjf "$1" ;;
*.tgz) tar xvzf $1 ;; *.tgz) tar xvzf "$1" ;;
*.zip) unzip $1 ;; *.zip) unzip "$1" ;;
*.Z) uncompress $1 ;; *.Z) uncompress "$1" ;;
*.7z) 7z x $1 ;; *.7z) 7z x "$1" ;;
*) echo "don't know how to extract '$1'..." ;; *) echo "don't know how to extract '$1'..." ;;
esac esac
else else
@ -185,35 +170,7 @@ killport() {
if [ -z "$1" ]; then if [ -z "$1" ]; then
echo "please specify a port to kill" echo "please specify a port to kill"
else else
fuser -k $1/tcp fuser -k "$1/tcp"
fi
}
# function to switch kubernetes namespace
kubenamespaceswitch() {
if [ -z "$1" ]; then
echo "please specify a namespace to switch to"
else
kubectl config set-context --current --namespace=$1
fi
}
# function to switch kubernetes context
kubecontextswitch() {
if [ -z "$1" ]; then
echo "please specify a context to switch to, the following contexts are available:"
kubectl config get-contexts
else
kubectl config use-context "$1"
fi
}
# function to switch to a different azure kubernetes cluster
azkubeswitch() {
if [ -z "$2" ]; then
echo "please execute with the following params: azkubeswitch {resourcegroupname} {clustername}"
else
az aks get-credentials --resource-group $1 --name $2
fi fi
} }
@ -225,3 +182,15 @@ mergepdf() {
pdfunite ./*.pdf "$1" pdfunite ./*.pdf "$1"
fi fi
} }
# sign a file using the signing key
signfile() {
if [ -z "$1" ]; then
echo "please provide a file to sign: signfile file-to-sign.pdf"
else
ssh-keygen -Y sign -f ~/.ssh/signing-key.pub -n file "$1"
fi
}
alias "set-timezone-romania"='timedatectl set-timezone Europe/Bucharest'
alias "set-timezone-netherlands"=' timedatectl set-timezone Europe/Amsterdam'

16
bash/.aliases/docker.sh Normal file
View File

@ -0,0 +1,16 @@
#!/bin/bash
# useful docker commands
alias stop-dockers='docker stop $(docker ps -aq)'
alias docker-clean-containers='docker container prune -f --filter "until=48h"'
alias docker-clean-images='docker image prune -a -f --filter "until=48h"'
alias docker-clean-volumes='docker volume prune -f --filter "label!=keep"'
alias docker-clean-networks='docker network prune -f --filter "until=24h"'
alias docker-clean-all='stop-dockers && docker-clean-containers && docker-clean-images && docker-clean-volumes && docker-clean-networks'
# useful dockers
alias phpserver='docker run --rm -p 2000:80 -v "$PWD":/var/www/html mastermindzh/php-xdebug'
alias nodeserver='docker run --rm -p 3000:3000 -v "$PWD":/app mastermindzh/generic_node'
alias reactserver='docker run --rm -p 8080:8080 -v "$PWD":/app mastermindzh/generic_node'
alias mongoserver='docker run -d --rm -p 27017:27017 --name mongo-server -e MONGO_INITDB_ROOT_USERNAME=admin -e MONGO_INITDB_ROOT_PASSWORD=123 -v ~/.db/mongo:/data/db mongo'
alias sqlserver='docker run --rm --name sql-server -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=Your_Password123" -p 1433:1433 -v ~/.db/mssql:/var/opt/mssql mcr.microsoft.com/mssql/server'
alias mailcatcher='docker run -d -p 1080:1080 -p 1025:1025 --name mailcatcher schickling/mailcatcher'

View File

@ -0,0 +1,50 @@
#!/bin/bash
# Kubernetes commands
alias mkubectl='microk8s.kubectl'
alias kubestart='microk8s.start'
alias kubestop='microk8s.stop'
alias kubecontexts='kubectl config get-contexts'
# function to switch kubernetes namespace
kubenamespaceswitch() {
if [ -z "$1" ]; then
echo "please specify a namespace to switch to"
else
kubectl config set-context --current --namespace="$1"
fi
}
# function to switch kubernetes context
kubecontextswitch() {
if [ -z "$1" ]; then
echo "please specify a context to switch to, the following contexts are available:"
kubectl config get-contexts
else
kubectl config use-context "$1"
fi
}
# function to switch to a different azure kubernetes cluster
azkubeswitch() {
if [ -z "$2" ]; then
echo "please execute with the following params: azkubeswitch {resourcegroupname} {clustername}"
else
az aks get-credentials --resource-group "$1" --name "$2"
fi
}
# get old resources from kubernetes
kube-get-old() {
if [ -z "$1" ]; then
echo "please provide a resource type, examples:"
echo " kube-get-old pods"
echo " kube-get-old namespaces"
echo ""
echo "you can pass extra arguments as the second param, examples:"
echo " kube-get-old pods --all-namespaces"
echo ' kube-get-old namespaces "--all-namespaces --second"'
else
kubectl get "$1" ${2:+"$2"} -o go-template --template '{{range .items}}{{.metadata.name}} {{.metadata.creationTimestamp}}{{"\n"}}{{end}}' | awk -v twoWeeksAgo="date -d '-14 days'" -F':' '$2<twoWeeksAgo' | awk '{print $1}'
fi
}

4
bash/.aliases/node.sh Normal file
View File

@ -0,0 +1,4 @@
#!/bin/bash
alias clean-node-modules='find . -name "node_modules" -type d -print0 |xargs -0 rm -r --'
alias organize-package-json='npx format-package -w && npx sort-package-json'

View File

@ -7,7 +7,7 @@ function _update_ps1() {
} }
# sourceIfExists # sourceIfExists
function sourceIfExists () { function sourceIfExists() {
[[ -f "$1" ]] && source "$1" [[ -f "$1" ]] && source "$1"
} }

View File

@ -81,6 +81,11 @@ declare -A MOUNTS11=(
[share]="games" [share]="games"
[mount]="games" [mount]="games"
) )
declare -A MOUNTS12=(
[server]="$MY_SERVER_LOCATION"
[share]="data"
[mount]="data"
)
# declare array with "objects" # declare array with "objects"
declare -n MOUNTS declare -n MOUNTS

View File

@ -1,6 +1,6 @@
[user] [user]
email = info@rickvanlieshout.com email = info@rickvanlieshout.com
name = Mastermindzh name = Rick van Lieshout
[alias] [alias]
tree = log --graph --decorate --pretty=format:'%ar [%h] %an <%ae> - %s' tree = log --graph --decorate --pretty=format:'%ar [%h] %an <%ae> - %s'
graph = log --graph --pretty=format:'%C(bold)%h%Creset%C(magenta)%d%Creset %s %C(yellow)<%an> %C(cyan)(%cr)%Creset' --abbrev-commit --date=relative graph = log --graph --pretty=format:'%C(bold)%h%Creset%C(magenta)%d%Creset %s %C(yellow)<%an> %C(cyan)(%cr)%Creset' --abbrev-commit --date=relative
@ -16,3 +16,8 @@
rebase = false rebase = false
[init] [init]
defaultBranch = master defaultBranch = master
[filter "lfs"]
required = true
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process

View File

@ -1,4 +0,0 @@
init-author-name=Rick van Lieshout
init-author-email=info@rickvanlieshout.com
init-author-url=http://rickvanlieshout.com/
init-license=MIT

View File

@ -141,12 +141,12 @@ click-left = firefox https://speedtest.net
[module/weather] [module/weather]
type = custom/script type = custom/script
interval = 900 interval = 900
exec = "curl -s wttr.in?format=1" exec = "curl -s wttr.in/oss?format=1"
format = "<label>" format = "<label>"
format-prefix-foreground = ${colors.accent} format-prefix-foreground = ${colors.accent}
label = %output% label = %output%
click-left = xfce4-terminal -H -e "curl wttr.in" click-left = xfce4-terminal -H -e "curl wttr.in/oss"
[module/i3] [module/i3]

View File

@ -24,3 +24,5 @@ gnome-text-editor
greenclip greenclip
kind kind
pulseaudio-ctl pulseaudio-ctl
seafile
seafile-client

View File

@ -1,49 +1,48 @@
#
# Core system
#
base-devel base-devel
git
xorg-server xorg-server
xorg-xinit xorg-xinit
mesa mesa
i3-gaps
rsync
i3lock
feh
scrot
arandr
xfce4-terminal
ttf-font-awesome
libconfig libconfig
compton compton
lxappearance
rofi
i3blocks
wmctrl wmctrl
zenity zenity
xorg-xrandr xorg-xrandr
eog
python
python-pip
neofetch
git
scrot
acpi acpi
imagemagick
docker
docker-compose
htop
powertop
network-manager-applet
pavucontrol
alsa-utils
ntp ntp
xclip
openssh openssh
gvfs-smb
sddm
polkit-gnome
gnome-keyring
libsecret
seahorse
i3-gaps
i3lock
#
# Programming
#
nodejs nodejs
npm npm
python
python-pip
pyenv
dotnet-host
dotnet-runtime
dotnet-sdk
#
# Codecs
#
a52dec a52dec
faac faac
faad2 faad2
flac flac
jasper
lame
libdca libdca
libdv libdv
libmad libmad
@ -52,55 +51,73 @@ libtheora
libvorbis libvorbis
libxv libxv
wavpack wavpack
jasper
lame
x264 x264
xvidcore xvidcore
gvfs-smb
bash-completion #
flameshot # Applications
otf-font-awesome #
networkmanager alsa-utils
networkmanager-l2tp arandr
strongswan
w3m
system-config-printer
wget
pyenv
jq
firefox
dotnet-host
dotnet-runtime
dotnet-sdk
aspnet-runtime aspnet-runtime
clamav autorandr
clamtk bash-completion
keychain bat
thefuck bitwarden
peek
blueman
pulseaudio-bluetooth
bluez bluez
bluez-libs bluez-libs
sddm bluez-utils
polkit-gnome clamav
gnome-keyring clamtk
libsecret ctop
seahorse
mpv
gnome-themes-extra
cups cups
system-config-printer docker
docker-compose
duf duf
engrampa
eog
feh
firefox
flameshot
gnome-themes-extra
htop
i3blocks
imagemagick
jq
keychain
lxappearance
mpv
neofetch
network-manager-applet
networkmanager
networkmanager-l2tp
noto-fonts-emoji
obsidian
otf-font-awesome
papirus-icon-theme
pavucontrol
peek
picom picom
ttf-ubuntu-font-family polybar
xorg-xkill poppler
powertop
pulseaudio-bluetooth
rofi
rsync
scrot
scrot
strongswan
system-config-printer
system-config-printer
thefuck
thunar thunar
thunar-archive-plugin thunar-archive-plugin
engrampa ttf-font-awesome
bat ttf-ubuntu-font-family
ctop w3m
polybar wget
noto-fonts-emoji xclip
autorandr xfce4-terminal
papirus-icon-theme xorg-xkill
bitwarden
poppler

View File

@ -123,7 +123,7 @@ mode "resize" {
bindsym $mod+r mode "resize" bindsym $mod+r mode "resize"
# Lock the computer # Lock the computer
bindsym $mod+l exec /bin/bash ~/.config/i3/scripts/i3lock.sh bindsym $mod+l exec /bin/bash ~/.config/i3/scripts/lock.sh
# Suspend the computer # Suspend the computer
bindsym $mod+shift+l exec /bin/bash ~/.config/i3/scripts/suspend.sh bindsym $mod+shift+l exec /bin/bash ~/.config/i3/scripts/suspend.sh
@ -137,8 +137,9 @@ bindsym $mod+e exec thunar # File man
bindsym Print exec flameshot screen -d 0 -p ~/Pictures/Screenshots # Fullscreen screenshot bindsym Print exec flameshot screen -d 0 -p ~/Pictures/Screenshots # Fullscreen screenshot
bindsym $mod+Print exec flameshot gui # Show screenshot window bindsym $mod+Print exec flameshot gui # Show screenshot window
bindsym $mod+shift+Print exec flameshot launcher # Show settings window (delay) then show screenshot window bindsym $mod+shift+Print exec flameshot launcher # Show settings window (delay) then show screenshot window
bindsym $mod+shift+b exec /bin/bash ~/.config/i3/scripts/brightness.sh bindsym $mod+shift+b exec /bin/bash ~/.config/i3/scripts/brightness.sh # set brightness
bindsym control+shift+Escape exec sysmontask bindsym control+shift+Escape exec sysmontask # system monitor
bindsym $mod+BackSpace exec autorandr --change undocked # reset to laptop view
# Rofi # Rofi
bindsym $mod+d exec "rofi -show run -show-icons" bindsym $mod+d exec "rofi -show run -show-icons"
@ -255,6 +256,7 @@ assign [class="VirtualBox Machine"] $workspace11
assign [class="MongoDB Compass"] $workspace8 assign [class="MongoDB Compass"] $workspace8
assign [class="robo3t"] $workspace8 assign [class="robo3t"] $workspace8
assign [class="Brave-browser"] $workspace7 assign [class="Brave-browser"] $workspace7
assign [class="obsidian"] $workspace7
assign [class="Mysql-workbench-bin"] $workspace8 assign [class="Mysql-workbench-bin"] $workspace8
assign [class="azuredatastudio"] $workspace8 assign [class="azuredatastudio"] $workspace8
assign [class="beekeeper"] $workspace8 assign [class="beekeeper"] $workspace8
@ -326,12 +328,12 @@ mode "$mode_gaps_outer" {
# exec_always --no-startup-id picom -b # exec_always --no-startup-id picom -b
exec_always feh --bg-scale $(find ~/Pictures/wallpapers/ -type f -name "*" | shuf -n 1) exec_always feh --bg-scale $(find ~/Pictures/wallpapers/ -type f -name "*" | shuf -n 1)
exec_always --no-startup-id ~/.config/polybar/launch.sh exec_always --no-startup-id ~/.config/polybar/launch.sh
exec_always --no-startup-id "autorandr --change"
exec --no-startup-id i3-msg 'workspace $workspace2; exec xfce4-terminal' && i3-msg 'workspace $workspace1' exec --no-startup-id i3-msg 'workspace $workspace2; exec xfce4-terminal' && i3-msg 'workspace $workspace1'
exec --no-startup-id i3-msg 'workspace $workspace12; exec bitwarden-desktop' exec --no-startup-id i3-msg 'workspace $workspace12; exec bitwarden-desktop'
exec --no-startup-id /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 exec --no-startup-id /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1
exec --no-startup-id nm-applet exec --no-startup-id nm-applet
exec --no-startup-id blueman-applet
exec /usr/bin/compton exec /usr/bin/compton
exec /bin/bash ~/.config/i3/scripts/startup.sh exec /bin/bash ~/.config/i3/scripts/startup.sh
exec --no-startup-id greenclip daemon exec --no-startup-id greenclip daemon
exec --no-startup-id seafile-applet
exec --no-startup-id obsidian

View File

@ -22,7 +22,7 @@ else
i3lock -n -f -i "$tmpbg" i3lock -n -f -i "$tmpbg"
# if tidal was playing before we locked, resume. # if tidal was playing before we locked, resume.
if [ $isPlaying == "playing" ]; then if [ "$isPlaying" == "playing" ]; then
~/.config/i3/scripts/tidal-cli.sh play ~/.config/i3/scripts/tidal-cli.sh play
fi fi
rm -rf $tmpbg rm -rf $tmpbg

View File

@ -45,7 +45,7 @@ function linkDir {
# replace line endings with a space (for use in package managers) # replace line endings with a space (for use in package managers)
function fileToList { function fileToList {
echo $(cat "$1" | sed ':a;N;$!ba;s/\n/ /g') echo $(cat "$1" | sed '/^\s*#\([^!]\|$\)/d' | sed ':a;N;$!ba;s/\n/ /g')
} }
# create and copy files to directory # create and copy files to directory
@ -91,6 +91,7 @@ function install_config {
linkDir "$PWD"/config/notify-osd/notify-osd ~/.notify-osd linkDir "$PWD"/config/notify-osd/notify-osd ~/.notify-osd
linkDir "$PWD"/config/terminal/xfce4-term ~/.config/xfce4/terminal linkDir "$PWD"/config/terminal/xfce4-term ~/.config/xfce4/terminal
linkDir "$PWD"/config/polybar ~/.config/polybar linkDir "$PWD"/config/polybar ~/.config/polybar
linkDir "$PWD"/bash/.aliases ~/
# link user files # link user files
ln -sf "$PWD"/bash/.bashrc ~/.bashrc ln -sf "$PWD"/bash/.bashrc ~/.bashrc

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 834 KiB