.bash_aliases 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. # _ _
  2. # ___| |_|___ ___ ___ ___
  3. # | .'| | | .'|_ -| -_|_ -|
  4. # |__,|_|_|__,|___|___|___|
  5. #
  6. # Colors in pacman and yay
  7. alias pacman='pacman --color=auto'
  8. alias yay='yay --color=auto'
  9. # More Vim aliases == better
  10. alias v='nvim'
  11. alias vi='nvim'
  12. alias vim='nvim'
  13. # Run vifmrun for image preview with ueberzug
  14. alias vifm="$HOME/.config/vifm/scripts/vifmrun"
  15. # Configure neovide as gvim alternative
  16. function gvim {
  17. nohup neovide --multiGrid --disowned $@ >/dev/null 2>&1 &
  18. }
  19. # some ls aliases
  20. alias ll='ls -alh --color=auto --group-directories-first'
  21. alias la='ls -Ah --color=auto --group-directories-first'
  22. alias l='ls -CFh --color=auto --group-directories-first'
  23. alias ls='ls -CFh --color=auto --group-directories-first'
  24. # cd stuff
  25. alias ..='cd ..'
  26. alias ...='cd ../..'
  27. # ripgrep > grep
  28. alias ogrep='/usr/bin/grep --color=auto -i' # keep original grep as ogrep
  29. # source: github.com/sharkdp/fd
  30. alias find='fd -H'
  31. # backup of original find
  32. alias ofind='/usr/bin/find'
  33. # cat on wings
  34. alias bat='bat --theme zenburn'
  35. # default image viewer
  36. alias img=sxiv
  37. # default markdown previewer
  38. alias md=markdown_previewer
  39. # default PDF viewer
  40. alias pdf='zathura --fork'
  41. # source: github.com/sharkdp/hexyl
  42. alias hex=hexyl
  43. # show open ports
  44. alias ports='ss -lust | column -t'
  45. alias netstat='netstat -tulanp'
  46. alias loadX='xrdb $HOME/.Xresources'
  47. alias zzz='systemctl suspend'
  48. alias ZZZ='systemctl hibernate'
  49. alias python-env="source $HOME/.scripts/misc/python-env"
  50. # brightness settings
  51. alias blow='xbacklight -set 10'
  52. alias bmed='xbacklight -set 45'
  53. alias bhi='xbacklight -set 90'
  54. # cd shortcuts
  55. alias cdc='cd $HOME/documents/cloud'
  56. alias cdi='cd $HOME/.config/i3'
  57. alias cdd='cd $HOME/documents'
  58. alias cdD='cd $HOME/downloads'
  59. alias cdt='cd $HOME/documents/tools'
  60. alias cdv='cd $HOME/documents/vms/vagrant-vms'
  61. # copy the current path to clipboard
  62. alias cpwd='xclip -selection clipboard -i <(pwd | tr -d "\n")'
  63. # copy the last command issued to the clipboard
  64. alias clc='fc -ln -1 | tr -d "\n" | sed "s/^\s*//g" | xclip -selection clipboard -i'
  65. alias fcd='cd $(fd -t d | fzf)'
  66. alias cdf='cd $(fd -t d | fzf)'
  67. # ipaddr
  68. alias ipa='ip --brief --color add'
  69. # pipe into ccopy --> clipboard
  70. alias ccopy='xclip -selection clipboard'
  71. alias cpy='xclip -selection clipboard'
  72. # IPS
  73. alias pubip="dig +short myip.opendns.com @resolver1.opendns.com"
  74. alias localip="ip a | grep -Eo 'inet (addr:)?([0-9]*\\.){3}[0-9]*' | grep -Eo '([0-9]*\\.){3}[0-9]*' | grep -v '127.0.0.1'"
  75. # search files with fzf and open them
  76. function sf {
  77. file=$(fzf --preview='head -n$LINES {}')
  78. [ "$file" != "" ] && $EDITOR $file
  79. }
  80. # Bash Function Snippets
  81. # process grep
  82. function pg {
  83. pgrep -fa "$1" | grep -E --color "$1"
  84. }
  85. # Fun
  86. alias makespongebob="python -c 'import sys; makeSpongebob = lambda x: \"\".join([i.upper() if c %2 ==0 else i for c,i in enumerate(x)]);print(makeSpongebob(sys.argv[1]))'"
  87. # Docker Aliases
  88. alias podshell="sudo podman run --rm -i -t --entrypoint=/bin/sh"
  89. function podshellhere() {
  90. dirname=${PWD##*/}
  91. sudo podman run --rm -it --entrypoint=/bin/sh -v `pwd`:/${dirname} -w /${dirname} "$@"
  92. }
  93. alias nginxhere="sudo podman run --rm -ti -p 80:80 -p 443:443 -v `pwd`:/srv/data swrzm/nginx"
  94. # Opening a SMB server in the same dir
  95. smbhere() {
  96. local sharename
  97. [[ -z $1 ]] && sharename="SHARE" || sharename=$1
  98. sudo podman run --rm -it -p 445:445 -v "${PWD}:/tmp/serve" swrzm/impacket smbserver.py -smb2support $sharename /tmp/serve
  99. }
  100. # Runner
  101. run() {
  102. nohup $@ & 2>&1 > /dev/null
  103. }
  104. # ---[it sec stuff]--- #
  105. # Disassemble using objdump
  106. disas() {
  107. objdump -M intel -d $@
  108. }