Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html>
<body>
hello
</body>
</html>
@beherca
beherca / SVG Rainbow Rocket Man.markdown
Created August 4, 2015 20:42
SVG Rainbow Rocket Man
@beherca
beherca / bash.generate.random.alphanumeric.string.sh
Last active August 29, 2015 14:27 — forked from earthgecko/bash.generate.random.alphanumeric.string.sh
shell/bash generate random alphanumeric string
#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1
@beherca
beherca / install_vpn_centos.sh
Last active August 2, 2016 08:05
install_vpn_centos.sh
#!/bin/bash
# For detail introduction, please see https://www.digitalocean.com/community/tutorials/how-to-setup-your-own-vpn-with-pptp
# exit when error occur
set -o errexit
set -o nounset
# Bash will remember & return the highest exitcode in a chain of pipes.
# This way you can catch the error in case mysqldump fails in `mysqldump |gzip`
set -o pipefail
echo -n "User Name: " # use -n to prompt inline label
#!/usr/bin/env bash
# @author: beherca
# Use to find all attackers ips from /var/log/auth.log or /var/log/secure in centos, see https://extremeshok.com/6309/linux-see-all-failed-ssh-login-attempts/
# This is preparing step for comming procedures to harden ssh attack http://www.cyberciti.biz/tips/linux-unix-bsd-openssh-server-best-practices.html
# explaination http://resources.infosecinstitute.com/maximizing-ssh-security-service-cloud/
# Usage: ./find_attacking_ip.sh
#
# exit when error occur
set -o errexit
set -o nounset
@beherca
beherca / full.varnish
Last active October 12, 2015 20:26
a full varnish vcl
# This VCL config file is adapted from template.vcl in http://pypi.python.org/pypi/plone.recipe.varnish
# from http://www.nedproductions.biz/wiki/a-perfected-varnish-reverse-caching-proxy-vcl-script
backend default {
.host = "localhost";
.port = "6100";
.first_byte_timeout = 300s; /* varnish v2.0.3 or later only */
.probe = {
.url = "/";
.timeout = 1s;
.interval = 5s;
@beherca
beherca / RKHunter_Setup_Ubuntu.sh
Last active October 21, 2015 05:49
RKHunter Setup on Ubuntu
#!/bin/bash
# according to https://www.digitalocean.com/community/tutorials/how-to-use-rkhunter-to-guard-against-rootkits-on-an-ubuntu-vps
echo -n "Admin Email: " # use -n to prompt inline label
read email
cd
wget http://downloads.sourceforge.net/project/rkhunter/rkhunter/1.4.2/rkhunter-1.4.2.tar.gz
tar xzvf rkhunter*
cd rkhunter*
sudo ./installer.sh --layout /usr --install
sudo apt-get install update -y
@beherca
beherca / RKHunter_Setup_Centos.sh
Created October 21, 2015 05:49
RKHunter Setup on Centos
#!/bin/bash
# according to https://www.digitalocean.com/community/tutorials/how-to-use-rkhunter-to-guard-against-rootkits-on-an-ubuntu-vps
echo -n "Admin Email: " # use -n to prompt inline label
read email
cd
wget http://downloads.sourceforge.net/project/rkhunter/rkhunter/1.4.2/rkhunter-1.4.2.tar.gz
tar xzvf rkhunter*
cd rkhunter*
sudo ./installer.sh --layout /usr --install
sudo yum install update -y
@beherca
beherca / install_pptp_client_ubuntu.sh
Last active September 6, 2019 09:42
Install PPTP Client on Ubuntu
#!/bin/bash
# For detail introduction, please see http://www.jamescoyle.net/how-to/963-set-up-linux-pptp-client-from-the-terminal
# exit when error occur
set -o errexit
set -o nounset
# Bash will remember & return the highest exitcode in a chain of pipes.
# This way you can catch the error in case mysqldump fails in `mysqldump |gzip`
set -o pipefail
echo -n "Domain: "
@beherca
beherca / find_large_file_ubuntu.sh
Created November 11, 2015 11:28
Find Large File on Ubuntu
# Find Largest File, http://www.cyberciti.biz/faq/find-large-files-linux/
sudo du -a | sort -nr | head
sudo du -sx /* 2>/dev/null | sort -n
#Delete file older than 10 days
# find /usr/backup/jira -type f -mtime +10 -exec rm {} \;