add aliases inspired

- inspired partially by
  https://github.com/sapegin/dotfiles/blob/master/zsh/aliases.zsh
This commit is contained in:
MorganGeek 2020-07-03 06:22:30 +02:00
parent d7e23002d2
commit 0730b2f039
2 changed files with 22 additions and 10 deletions

View File

@ -65,7 +65,10 @@ alias engines='sr -elvi'
alias grep='rg' alias grep='rg'
alias usernames="python3 $HOME/Code/sherlock/sherlock.py --rank --print-found" alias usernames="python3 $HOME/Code/sherlock/sherlock.py --rank --print-found"
alias ygg="torrengo -s ygg" alias ygg="torrengo -s ygg"
alias ag='alias | grep' # search for patten among aliases alias ag='alias | grep -i' # search for patten among aliases
alias hg='history | grep -i' # search for pattern among history
alias hist='history'
# Events # Events
alias agenda='calendar' alias agenda='calendar'
alias mails="gmail && gmail2" alias mails="gmail && gmail2"
@ -92,6 +95,10 @@ alias newpass='bw generate --special --uppercase --lowercase --number --length 3
alias ip='echo $(curl ident.me -4 2>/dev/null)' alias ip='echo $(curl ident.me -4 2>/dev/null)'
alias ipinfo='curl "ipinfo.io/"$(ip)' alias ipinfo='curl "ipinfo.io/"$(ip)'
alias getips='\egrep "\b(([0-9]{1,2}|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}(1[0-9][0-9]|2[0-4][0-9]|25[0-5]|[0-9]{1,2})\b"' alias getips='\egrep "\b(([0-9]{1,2}|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}(1[0-9][0-9]|2[0-4][0-9]|25[0-5]|[0-9]{1,2})\b"'
alias ping='prettyping -c 5 --nolegend' # Stop after sending count ECHO_REQUEST packets
# Downloads
alias get="curl -O -L" # Download file and save it with filename of remote file
# Files & folder tricks # Files & folder tricks
alias biggerthan10='biggerthan 10M' alias biggerthan10='biggerthan 10M'
@ -107,8 +114,9 @@ alias du='ncdu --color dark -rr -x --exclude .git --exclude node_modules'
alias s=ls alias s=ls
alias sl=ll alias sl=ll
alias ls='lsd' alias ls='lsd'
alias lsg='ll | grep' # show me files matching "ls grep" alias lsg='ll | grep -i' # show me files matching "ls grep"
alias lh='ls -alt | head' # see the last modified files alias lh='ls -alt | head' # see the last modified files
alias tree='ls --almost-all --tree' alias tree='ls --almost-all --tree'
alias v=vi alias v=vi
alias x='extract' alias x='extract'
@ -118,6 +126,8 @@ alias x='extract'
alias emptytrash="sudo rm -rfv /Volumes/*/.Trashes; sudo rm -rfv ~/.Trash; sudo rm -rfv /private/var/log/asl/*.asl; sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV* 'delete from LSQuarantineEvent'" alias emptytrash="sudo rm -rfv /Volumes/*/.Trashes; sudo rm -rfv ~/.Trash; sudo rm -rfv /private/var/log/asl/*.asl; sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV* 'delete from LSQuarantineEvent'"
alias ve='vim ~/.vimrc' # vimrc editing alias ve='vim ~/.vimrc' # vimrc editing
alias ze='vim ~/.zshrc' # zsh profile editing alias ze='vim ~/.zshrc' # zsh profile editing
alias zf='vim ~/.zsh_functions' # edit zsh_functions
alias za='vim ~/.zsh_aliases' # edit zsh_aliases
# System info # System info
alias systeminfo='neofetch' alias systeminfo='neofetch'
@ -126,6 +136,7 @@ alias monitoring='glances'
# System Utils # System Utils
alias afk="/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend" # Lock the screen (when going AFK) alias afk="/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend" # Lock the screen (when going AFK)
alias reload="exec ${SHELL} -l" # Reload the shell (i.e. invoke as a login shell) alias reload="exec ${SHELL} -l" # Reload the shell (i.e. invoke as a login shell)
alias sc="source $HOME/.zshrc"
# Infrastructure # Infrastructure
alias awsls='awsls -profile default -region eu-west-1 --attributes tags aws_instance' alias awsls='awsls -profile default -region eu-west-1 --attributes tags aws_instance'
@ -141,16 +152,13 @@ alias latency='curl cheat.sh/latency'
# Misc # Misc
alias bash="/usr/local/bin/bash" alias bash="/usr/local/bin/bash"
alias current_year='`echo date +"%Y"`'
alias headers='curl -I --compress' # Find out if remote server supports gzip / mod_deflate or not # alias headers='curl -I --compress' # Find out if remote server supports gzip / mod_deflate or not #
alias hist='history'
alias path='echo -e ${PATH//:/\\n}' # Explode and display current PATH
alias ping='prettyping -c 5 --nolegend' # Stop after sending count ECHO_REQUEST packets
alias https='http --default-scheme=https' # useful alias stealed from a colleague. http is provided by httpie alias https='http --default-scheme=https' # useful alias stealed from a colleague. http is provided by httpie
alias path='echo -e ${PATH//:/\\n}' # Explode and display current PATH
alias p='ps -ef | grep -i ' # Show matching processes. Usage : p <process name> alias p='ps -ef | grep -i ' # Show matching processes. Usage : p <process name>
alias root='sudo -i' alias root='sudo -i'
alias current_year='`echo date +"%Y"`'
alias ':q'='exit' alias ':q'='exit'
alias sc="source $HOME/.zshrc"
# Linters # Linters
alias checken="aspell check -d en" alias checken="aspell check -d en"

View File

@ -96,16 +96,16 @@ function git_listobjectsbysize() {
rm -f "$tempFile" rm -f "$tempFile"
} }
function top_commands() { function top_commands() {
history | cat | awk '{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a; }' | grep -v "./" | column -c3 -s " " -t | sort -nr | nl | head -n50 history | \cat | awk '{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a; }' | grep -v "./" | column -c3 -s " " -t | sort -nr | nl | head -n50
} }
function top_commands_full() { function top_commands_full() {
history | cat | sed 's/^[0-9 TAB]*//g' | awk '{CMD[$0]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "%\t" a; }' | sort -nr | nl | head -n50 history | \cat | sed 's/^[0-9 TAB]*//g' | awk '{CMD[$0]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "%\t" a; }' | sort -nr | nl | head -n50
} }
function istherenewissues() { function istherenewissues() {
LASTISSUE=$(newissues | sed $'s,\x1b\\[[0-9;]*[a-zA-Z],,g' | awk 'FNR==2{print $2}') LASTISSUE=$(newissues | sed $'s,\x1b\\[[0-9;]*[a-zA-Z],,g' | awk 'FNR==2{print $2}')
if [[ -f "$HOME/.newjiraissue" ]] if [[ -f "$HOME/.newjiraissue" ]]
then then
previous_jira_issue=$(cat "$HOME/.newjiraissue" | sed $'s,\x1b\\[[0-9;]*[a-zA-Z],,g') # the sed part is for removing output colors previous_jira_issue=$(\cat "$HOME/.newjiraissue" | sed $'s,\x1b\\[[0-9;]*[a-zA-Z],,g') # the sed part is for removing output colors
if [ "$LASTISSUE" != "$previous_jira_issue" ]; then if [ "$LASTISSUE" != "$previous_jira_issue" ]; then
newissues newissues
else else
@ -373,3 +373,7 @@ function rssadd {
function backupgithub { function backupgithub {
curl -sL "https://api.github.com/users/$1/repos" | jq -r '.[] | .ssh_url' | xargs -n1 git clone --mirror --no-hardlinks curl -sL "https://api.github.com/users/$1/repos" | jq -r '.[] | .ssh_url' | xargs -n1 git clone --mirror --no-hardlinks
} }
# Make a directory and cd to it
function take {
mkdir -p $@ && cd ${@:$#}
}