diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6e61feb --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +config/.npmrc diff --git a/bash/.alias.sh b/bash/.alias.sh index 466bf20..2b9ab65 100644 --- a/bash/.alias.sh +++ b/bash/.alias.sh @@ -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' diff --git a/bash/.aliases/docker.sh b/bash/.aliases/docker.sh new file mode 100644 index 0000000..b78fa9a --- /dev/null +++ b/bash/.aliases/docker.sh @@ -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' diff --git a/bash/.aliases/kubernetes.sh b/bash/.aliases/kubernetes.sh new file mode 100644 index 0000000..bb97653 --- /dev/null +++ b/bash/.aliases/kubernetes.sh @@ -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/dev/null; then - PS1="$(powerline-rs --shell bash $?)" - fi + if hash powerline-rs 2>/dev/null; then + PS1="$(powerline-rs --shell bash $?)" + fi } # sourceIfExists -function sourceIfExists () { - [[ -f "$1" ]] && source "$1" +function sourceIfExists() { + [[ -f "$1" ]] && source "$1" } # If not running interactively, don't do anything @@ -22,28 +22,28 @@ eval "$(thefuck --alias)" # load keychain with private key if test -f "$HOME/.ssh/id_ed25519"; then - eval "$(keychain --eval --quiet ~/.ssh/id_ed25519)" + eval "$(keychain --eval --quiet ~/.ssh/id_ed25519)" else - # fallback to older rsa - eval "$(keychain --eval --quiet ~/.ssh/id_rsa)" + # fallback to older rsa + eval "$(keychain --eval --quiet ~/.ssh/id_rsa)" fi eval "$(pyenv init -)" export NVM_DIR="$HOME/.nvm" -[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm -[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion +[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm +[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion if hash dotnet 2>/dev/null; then - export DOTNET_ROOT=/usr/share/dotnet - export MSBuildSDKsPath=$DOTNET_ROOT/sdk/$(${DOTNET_ROOT}/dotnet --version)/Sdks - export PATH="${PATH}:${DOTNET_ROOT}:~/.dotnet/tools" + export DOTNET_ROOT=/usr/share/dotnet + export MSBuildSDKsPath=$DOTNET_ROOT/sdk/$(${DOTNET_ROOT}/dotnet --version)/Sdks + export PATH="${PATH}:${DOTNET_ROOT}:~/.dotnet/tools" fi PS1='[\u@\h \W]\$ ' if [[ $TERM != linux && ! $PROMPT_COMMAND =~ _update_ps1 ]]; then - PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND" + PROMPT_COMMAND="_update_ps1; $PROMPT_COMMAND" fi export PATH=$PATH:/home/mastermindzh/bin diff --git a/bash/mounts.sh b/bash/mounts.sh index adae337..7fd4106 100644 --- a/bash/mounts.sh +++ b/bash/mounts.sh @@ -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 diff --git a/config/.gitconfig b/config/.gitconfig index b44ae69..a733ca4 100644 --- a/config/.gitconfig +++ b/config/.gitconfig @@ -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 diff --git a/config/.npmrc b/config/.npmrc deleted file mode 100644 index eb40977..0000000 --- a/config/.npmrc +++ /dev/null @@ -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 diff --git a/config/polybar/themes/main/modules.ini b/config/polybar/themes/main/modules.ini index a1363b2..36a7bfd 100644 --- a/config/polybar/themes/main/modules.ini +++ b/config/polybar/themes/main/modules.ini @@ -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 = "