You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

118 lines
2.8 KiB

  1. #
  2. # ~/.bashrc
  3. #
  4. export PREFIX=$HOME/.$(whoami)/
  5. ## git
  6. ######
  7. #source ~/.bash-git-prompt/gitprompt.sh
  8. alias gs="git status"
  9. alias gl="git log --all --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%C(bold blue)<%an>%Creset' --abbrev-commit"
  10. alias gp="git pull"
  11. ## ssh keygen
  12. #############
  13. alias newpubkey='ssh-keygen -f ~/.ssh/id_rsa -y'
  14. alias fingerprint='ssh-keygen -lf ~/.ssh/id_rsa.pub'
  15. ## lazy
  16. #######
  17. alias mp3="mplayer *.mp3"
  18. alias n="nano"
  19. alias nani="nano"
  20. alias zram="modprobe zram && echo $((3072*1024*1024)) > /sys/block/zram0/disksize && mkswap /dev/zram0 && swapon -p 60 /dev/zram0"
  21. # mplayer vaapi
  22. alias m="mplayer -vo vaapi -va vaapi"
  23. function h () {
  24. grep "$1" ~/.bash_history
  25. }
  26. ## lua
  27. ######
  28. function lua_environment () {
  29. if (("$#" == 1)); then
  30. if [ $1 == "51" ]; then
  31. eval $(luarocks-5.1 path)
  32. elif [ $1 == "52" ]; then
  33. eval $(luarocks-5.2 path)
  34. elif [ $1 == "53" ]; then
  35. eval $(luarocks-5.3 path)
  36. fi
  37. fi
  38. }
  39. alias uselua="lua_environment"
  40. export LUA_CPATH=$HOME/.$(whoami)/lib/lua/5.3/?.so
  41. ## matlab/octave
  42. ################
  43. # alias matlab="/home/markus/MATLAB/bin/matlab"
  44. # alias m="/home/markus/MATLAB/bin/matlab -nodesktop -nosplash"
  45. alias o="octave-cli"
  46. ## local compiles
  47. #################
  48. export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$HOME/.$(whoami)/lib"
  49. # set PATH so it includes user's private bin if it exists
  50. if [ -d "$HOME/.$(whoami)/bin" ] ; then
  51. export PATH="$HOME/.$(whoami)/bin:$HOME/.$(whoami)/usr/bin:$HOME/.$(whoami)/usr/local/bin:$PATH"
  52. fi
  53. if [ -d "$HOME/.$(whoami)/lib/pkgconfig" ]; then
  54. export PKG_CONFIG_PATH="$HOME/.$(whoami)/lib/pkgconfig"
  55. fi
  56. if [ $(uname) = "NetBSD" ]; then
  57. PKG_PATH="http://ftp.netbsd.org/pub/pkgsrc/packages/NetBSD/x86_64/7.0/All/"
  58. export PKG_PATH
  59. fi
  60. ### autojump
  61. # https://github.com/wting/autojump
  62. if [ -f "/usr/share/autojump/autojump.bash" ]; then
  63. source /usr/share/autojump/autojump.bash
  64. fi
  65. ## wttr.in
  66. function wttr () {
  67. curl wttr.in/"$1"
  68. }
  69. alias wetter="wttr"
  70. # gnumeric with english numeric notation
  71. alias gnumeric='LC_NUMERIC="en" gnumeric'
  72. # local webserver
  73. alias ws="python -m http.server 8000"
  74. export EDITOR=nano
  75. ## netstat without netstat
  76. # https://staaldraad.github.io/2017/12/20/netstat-without-netstat/
  77. function _netstat() {
  78. awk 'function hextodec(str,ret,n,i,k,c){
  79. ret = 0
  80. n = length(str)
  81. for (i = 1; i <= n; i++) {
  82. c = tolower(substr(str, i, 1))
  83. k = index("123456789abcdef", c)
  84. ret = ret * 16 + k
  85. }
  86. return ret
  87. }
  88. function getIP(str,ret){
  89. ret=hextodec(substr(str,index(str,":")-2,2));
  90. for (i=5; i>0; i-=2) {
  91. ret = ret"."hextodec(substr(str,i,2))
  92. }
  93. ret = ret":"hextodec(substr(str,index(str,":")+1,4))
  94. return ret
  95. }
  96. NR > 1 {{if(NR==2)print "Local - Remote";local=getIP($2);remote=getIP($3)}{print local" - "remote}}' /proc/net/tcp
  97. }
  98. alias ns=_netstat