Instantly share code, notes, and snippets.

View ningx_complie_install.sh
#!/bin/sh
echo -e "install core packages...\n"
apt-get -qq -y install build-essential git
apt-get -qq -y install libpcre3 libpcre3-dev zlib1g zlib1g-dev
cd /tmp
wget -q http://nginx.org/download/nginx-1.12.1.tar.gz
wget -q http://s.tip90.com/source/packages/openssl-0.9.8zf.tar.gz && tar zxvf nginx-1.12.1.tar.gz && tar zxvf openssl-0.9.8zf.tar.gz && cd nginx-1.12.1 && ./configure --with-cc-opt='-g -O2 -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2' --with-ld-opt=-Wl,-z,relro --sbin-path=/usr/local/sbin --with-http_stub_status_module --with-http_ssl_module --user=www-data --group=www-data --with-openssl=/source/openssl-0.9.8zf/ --with-stream
make && make install
echo -e " set sysconf tuning \n"
wget -O /etc/sysctl.conf "https://raw.githubusercontent.com/AysadKozanoglu/mytools/master/conf/sysctl.conf"
View vim icinga2 syntax.sh
PREFIX=~/.vim && mkdir -p $PREFIX/{syntax,ftdetect} && curl https://git.io/fA36A > $PREFIX/ftdetect/icinga2.vim
View netWatch_ddos.sh
#! /bin/sh
# author: Aysad Kozanoglu
# email: aysadx@gmail.com
#
# QUICK USAGE:
# wget -O - "https://git.io/fAtyh" | bash
View check_tls_swaks.sh
swaks -a -tls -q HELO -s mailserver.example.com -au test -ap '<>'
View vim_nginx_syntax.sh
mkdir -p ~/.vim/syntax/
cd ~/.vim/syntax/
wget -O nginx.vim http://www.vim.org/scripts/download_script.php?src_id=19394
cat > ~/.vim/filetype.vim <<EOF
au BufRead,BufNewFile /etc/nginx/*,/usr/local/nginx/conf/* if &ft == '' | setfiletype nginx | endif
EOF
View mount_qcow2.md

How to mount a qcow2 disk image

This is a quick guide to mounting a qcow2 disk images on your host server. This is useful to reset passwords, edit files, or recover something without the virtual machine running.

Step 1 - Enable NBD on the Host

modprobe nbd max_part=8
View kernel_tuning_sysctl.conf
### KERNEL TUNING ###
# Increase size of file handles and inode cache
fs.file-max = 2097152
# Do less swapping
vm.swappiness = 10
vm.dirty_ratio = 60
vm.dirty_background_ratio = 2
View kvm_debian_ preesed.cfg
d-i debian-installer/locale string en_US
d-i keymap select de
d-i keyboard-configuration/xkb-keymap select de
d-i console-setup/ask_detect boolean false
d-i keyboard-configuration/layoutcode string de
d-i netcfg/choose_interface select auto
d-i netcfg/get_hostname string debianhost
d-i netcfg/get_domain string mydomain
d-i netcfg/wireless_wep string
View ddos detection methods
Detecting and Mitigating DDOS Attacks
#List all Finish (FIN) packets
machine1 : sudo /usr/sbin/tcpdump -Nnn -i any -s0 'tcp[13] & 1 != 0'
#List all SYN and SYN-ACK packets
machine1 : sudo /usr/sbin/tcpdump -Nnn -i any -s0 'tcp[13] & 2 != 0'
View check_urls
#!/bin/bash
# Split URLs by comma
urls=${1//,/ }
for url in $urls
do
hostname="${url%%/*}"
if [[ "$url" = */* ]]
then