# Path to your oh-my-zsh configuration. ZSH=$HOME/.oh-my-zsh # Set name of the theme to load. # Look in ~/.oh-my-zsh/themes/ # Optionally, if you set this to "random", it'll load a random theme each # time that oh-my-zsh is loaded. ZSH_THEME="af-magic" # Example aliases # alias zshconfig="mate ~/.zshrc" # alias ohmyzsh="mate ~/.oh-my-zsh" # alias vi="vim" # Set to this to use case-sensitive completion # CASE_SENSITIVE="true" # Comment this out to disable bi-weekly auto-update checks # DISABLE_AUTO_UPDATE="true" # Uncomment to change how many often would you like to wait before auto-updates occur? (in days) # export UPDATE_ZSH_DAYS=13 # Uncomment following line if you want to disable colors in ls # DISABLE_LS_COLORS="true" # Uncomment following line if you want to disable autosetting terminal title. # DISABLE_AUTO_TITLE="true" # Uncomment following line if you want red dots to be displayed while waiting for completion # COMPLETION_WAITING_DOTS="true" # Example format: plugins=(rails git textmate ruby lighthouse) #ALIASES # vi starts vim alias vi="nvim" # update for archlinux # in debian like oses you should change it to sudo apt update && sudo apt upgrade # for nixos sudo nix-channel --update && sudo nixos rebuild-switch alias update="yaourt -Syua --noconfirm" #check directory sizes alias ducks="du -cksh * | sort -rn | head" # for backup in git alias config='/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME' # bind page up and page down? can't remember but think this must be. :) bindkey "\033[1~" beginning-of-line bindkey "\033[4~" end-of-line #Add Plugins to oh my zsh plugins=(git archlinux) #include the oh my zsh config source $ZSH/oh-my-zsh.sh # Customize to your needs... export PATH=$PATH:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/usr/X11R6/bin export PYTHONPATH=/usr/lib/python3.4/site-packages # if colors of ls don't work as expected the following line delete all colors from ls # export LS_COLORS="rs=0:di=01;96:ln=04;01;35:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30; 43:ca=30;41:tw=30;42:$" # Add dircolors plugin from: # add it with: yaourt -S zsh-dircolors-solarized-git # alternatively you can add it with: git clone --recursive git://github.com/joel-porquet/zsh-dircolors-solarized $ZSH_CUSTOM/plugins/zsh-dircolors-solarized # and than add it to plugins line above (line 40) # enable it with: setupsolarized source /usr/share/zsh/plugins/zsh-dircolors-solarized/zsh-dircolors-solarized.zsh # function to detect ddos attacks function detect-ddos { $ sudo netstat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort - n $ } # function to simple block suspicious IPs # simply type ipt-block ipadress function ipt-block { sudo iptables -A INPUT -s $1 -j DROP echo "permblocked $1" } #function to load actual IP Blocklist from openbl and ban them out function update-blacklist { CHAINLIST=$(sudo /sbin/iptables -nL | grep 'Chain block-traffic-from-openbl' | cut -d\ -f 2) if [ -z $CHAINLIST ]; then sudo /sbin/iptables -N block-traffic-from-openbl sudo /sbin/iptables -A INPUT -j block-traffic-from-openbl fi BLACKLIST=$(/usr/bin/curl -fs http://www.openbl.org/lists/base_7days.txt.gz | gunzip | egrep "[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1, 3}\.[0-9]{1,3}") if [ $? -ne 0 ]; then echo "Blacklist download failed." exit fi sudo /sbin/iptables -F block-traffic-from-openbl IPCOUNT=$(echo $BLACKLIST | tr ' ' '\n' | wc -l) echo "Adding $IPCOUNT IPs to blacklist. - $(date)" echo $BLACKLIST | tr ' ' '\n' | while read -r line ; do case "$line" in \#*) continue ;; esac sudo /sbin/iptables -A block-traffic-from-openbl -p tcp -s $line -j REJECT --reject-with tcp-reset done } # add some PERL Path variables PATH="$HOME/perl5/bin${PATH+:}${PATH}"; export PATH; PERL5LIB="$HOME/perl5/lib/perl5${PERL5LIB+:}${PERL5LIB}"; export PERL5LIB; PERL_LOCAL_LIB_ROOT="$HOME/perl5${PERL_LOCAL_LIB_ROOT+:}${PERL_LOCAL_LIB_ROOT}"; export PERL_LOCAL_LIB_ROOT; PERL_MB_OPT="--install_base \"$HOME/perl5\""; export PERL_MB_OPT; PERL_MM_OPT="INSTALL_BASE=$HOME/perl5"; export PERL_MM_OPT;