Skip to content

Instantly share code, notes, and snippets.

@saderi
Last active January 9, 2022 12:21
Show Gist options
  • Save saderi/85063e551adcb2e3f6125aee889f36f6 to your computer and use it in GitHub Desktop.
Save saderi/85063e551adcb2e3f6125aee889f36f6 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Run the following command on server
# eval "$(curl -fsSL https://gist.githubusercontent.com/saderi/85063e551adcb2e3f6125aee889f36f6/raw/public_alias)"
function xpass() {
[ -z "$2" ] && LENGTH=30 || LENGTH=$2
[ -z "$3" ] && CHAR='[:alnum:]#$@^%&' || CHAR='[:alnum:]'
case $1 in
'u' )
tr -cd $CHAR < /dev/urandom | fold -w$LENGTH | head -n1 | tr [:lower:] [:upper:]
;;
'l' )
tr -cd $CHAR < /dev/urandom | fold -w$LENGTH | head -n1 | tr [:upper:] [:lower:]
;;
* )
tr -cd $CHAR < /dev/urandom | fold -w$LENGTH | head -n1
;;
esac
}
function zkill {
ps -aux | grep $1 | awk {'print $2'} | xargs kill -9
}
alias killcontainers='docker rm $(docker ps -a -q)'
alias gits='git status'
alias gitr='git remote -v'
alias du-hidden="du -ks .[^.]* * | sort -n"
alias kubectl='microk8s.kubectl'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment