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
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'
# 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'
#!/bin/bash
# source program-specific aliases:
for f in ~/.aliases/*; do source "$f"; done
#dotnet core
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 updatekeys='sudo pacman-key --refresh-key'
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
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 pretty-json='python -m json.tool'
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 mountshares='sudo bash ~/dotfiles/bash/mounts.sh'
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 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 unlockuser='faillock --reset --user'
alias npm-list-links='npm ls -g --depth=0 --link=true'
@ -137,19 +122,19 @@ up() {
}
# function to extract ... well anything really
extract() {
if [ -f $1 ]; then
case $1 in
*.tar.bz2) tar xvjf $1 ;;
*.tar.gz) tar xvzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xvf $1 ;;
*.tbz2) tar xvjf $1 ;;
*.tgz) tar xvzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1 ;;
*.7z) 7z x $1 ;;
if [ -f "$1" ]; then
case "$1" in
*.tar.bz2) tar xvjf "$1" ;;
*.tar.gz) tar xvzf "$1" ;;
*.bz2) bunzip2 "$1" ;;
*.rar) unrar x "$1" ;;
*.gz) gunzip "$1" ;;
*.tar) tar xvf "$1" ;;
*.tbz2) tar xvjf "$1" ;;
*.tgz) tar xvzf "$1" ;;
*.zip) unzip "$1" ;;
*.Z) uncompress "$1" ;;
*.7z) 7z x "$1" ;;
*) echo "don't know how to extract '$1'..." ;;
esac
else
@ -185,35 +170,7 @@ killport() {
if [ -z "$1" ]; then
echo "please specify a port to kill"
else
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
fuser -k "$1/tcp"
fi
}
@ -225,3 +182,15 @@ mergepdf() {
pdfunite ./*.pdf "$1"
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
function sourceIfExists () {
function sourceIfExists() {
[[ -f "$1" ]] && source "$1"
}

View File

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

View File

@ -1,6 +1,6 @@
[user]
email = info@rickvanlieshout.com
name = Mastermindzh
name = Rick van Lieshout
[alias]
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
@ -16,3 +16,8 @@
rebase = false
[init]
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]
type = custom/script
interval = 900
exec = "curl -s wttr.in?format=1"
exec = "curl -s wttr.in/oss?format=1"
format = "<label>"
format-prefix-foreground = ${colors.accent}
label = %output%
click-left = xfce4-terminal -H -e "curl wttr.in"
click-left = xfce4-terminal -H -e "curl wttr.in/oss"
[module/i3]

View File

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

View File

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

View File

@ -123,7 +123,7 @@ mode "resize" {
bindsym $mod+r mode "resize"
# 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
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 $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+b exec /bin/bash ~/.config/i3/scripts/brightness.sh
bindsym control+shift+Escape exec sysmontask
bindsym $mod+shift+b exec /bin/bash ~/.config/i3/scripts/brightness.sh # set brightness
bindsym control+shift+Escape exec sysmontask # system monitor
bindsym $mod+BackSpace exec autorandr --change undocked # reset to laptop view
# Rofi
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="robo3t"] $workspace8
assign [class="Brave-browser"] $workspace7
assign [class="obsidian"] $workspace7
assign [class="Mysql-workbench-bin"] $workspace8
assign [class="azuredatastudio"] $workspace8
assign [class="beekeeper"] $workspace8
@ -326,12 +328,12 @@ mode "$mode_gaps_outer" {
# exec_always --no-startup-id picom -b
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 "autorandr --change"
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 /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1
exec --no-startup-id nm-applet
exec --no-startup-id blueman-applet
exec /usr/bin/compton
exec /bin/bash ~/.config/i3/scripts/startup.sh
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"
# if tidal was playing before we locked, resume.
if [ $isPlaying == "playing" ]; then
if [ "$isPlaying" == "playing" ]; then
~/.config/i3/scripts/tidal-cli.sh play
fi
rm -rf $tmpbg

View File

@ -45,7 +45,7 @@ function linkDir {
# replace line endings with a space (for use in package managers)
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
@ -91,6 +91,7 @@ function install_config {
linkDir "$PWD"/config/notify-osd/notify-osd ~/.notify-osd
linkDir "$PWD"/config/terminal/xfce4-term ~/.config/xfce4/terminal
linkDir "$PWD"/config/polybar ~/.config/polybar
linkDir "$PWD"/bash/.aliases ~/
# link user files
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