Skip to content

Instantly share code, notes, and snippets.

View virtualadrian's full-sized avatar
🤓
Geek: A knowledgeable and obsessive enthusiast.

VirtualAdrian virtualadrian

🤓
Geek: A knowledgeable and obsessive enthusiast.
View GitHub Profile
#!/bin/bash
################################################################################
# Script for installing Odoo V10 on Ubuntu 16.04
################################################################################
OE_VERSION="10.0"
OE_USER="odoo"
OE_HOME="/opt/$OE_USER"
OE_HOME_EXT="$OE_HOME/v${OE_VERSION}"
@virtualadrian
virtualadrian / ossec_server.conf
Created March 29, 2017 23:24 — forked from VAdamec/ossec_server.conf
Fluent setup for OSSEC (2.9, with json logging but with getting exact server name and log) not secure forward and also output to stdout
<source>
type tail
format json
path /var/ossec/logs/alerts/alerts.json
pos_file /var/log/td-agent/ossec_log_json.pos
tag ossec.process
</source>
<match ossec.process>
type parser
@virtualadrian
virtualadrian / chksums.sh
Created April 3, 2017 07:29
Checksum one-liners.
# bourne shell functions below take 1 argument, the file_to_hash.
# prints hex digest on stdout
md5() {
perl -MDigest::MD5=md5_hex -le'print md5_hex(<> or die)' "$1"
# ruby -rdigest/md5 -e"puts Digest::MD5.file'/dev/null'"
# python -sBc "import hashlib;print hashlib.md5(open('$1','rb').read()).hexdigest()"
# md5 "$1"|cut -d' ' -f4 # mac
# md5sum "$1"|cut -d' ' -f1 # linux
# openssl md5 "$1" | grep -o '[[:xdigit:]][[:xdigit:]]*$' | cat
@virtualadrian
virtualadrian / downloadChunks.py
Created April 3, 2017 23:09 — forked from gourneau/downloadChunks.py
Download large files with Python urllib2 to a temp directory
import os
import urllib2
import math
def downloadChunks(url):
"""Helper to download large files
the only arg is a url
this file will go to a temp directory
the file will also be downloaded
in chunks and print out how much remains
@virtualadrian
virtualadrian / llnmp.sh
Created April 4, 2017 07:52 — forked from wdfsinap/llnmp.sh
LiteSpeed+Nginx+Mysql+PHP
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
cur_dir=$(pwd)
#set up email
email="root@localhost.com"
echo "Please input email:"
printf "(Default email: root@localhost.com):"
read email
echo ""

Install raspbian, set up your users however you would like, so long as you have sudo access on the user you are running this with. You probably want to resize the image so it fills the SD card as well.

  1. Copy this entire gist to your raspberry pi
  2. Do chmod +x step1.sh step2.sh iptables.sh in the gist folder (so that
  3. Run step1.sh a) This script does a few things - it first updates your raspberry pi, then it installs a few needed utilities, then it upgrades the firmware on your raspberry pi
@virtualadrian
virtualadrian / libreswan_setup.sh
Created April 6, 2017 23:19 — forked from rosstimson/libreswan_setup.sh
Libreswan VPN setup script.
#!/bin/bash -ex
# Set some local variables
PRIVATE_IP=`curl -s http://169.254.169.254/latest/meta-data/local-ipv4`
PUBLIC_IP=`curl -s http://169.254.169.254/latest/meta-data/public-ipv4`
VPN_DNSHOST=`grep -o "nameserver.*" /etc/resolv.conf | awk '{print $2}'`
yum install -y libreswan ppp xl2tpd
# Setup IPSEC Tunnel
@virtualadrian
virtualadrian / modsecurity-whitelist.conf
Last active April 9, 2017 04:06 — forked from anunay/modsecurity-whitelist.conf
Whitelist IP in ModSecurity (whitelist.conf)
##Whitelist IP in ModSecurity
#1. If you need to whitelist an IP in ModSecurity (v2.7+), here’s what to do:
nano /usr/local/apache/conf/modsec2/whitelist.conf
#2. add this line, replacing (#####) with a unique ID number for mod security, I used a version of my whitelisted ip address:
SecRule REMOTE_ADDR "@ipMatch 1.2.3.4" "phase:1,t:none,nolog,allow,ctl:ruleEngine=Off,ctl:auditEngine=Off,id:999945"
#3. Then restart apache.
@virtualadrian
virtualadrian / badbots.lst
Created April 16, 2017 14:19
A list of bad and "good" User-Agents (robots) that are worth blocking with haproxy. This will help stop your bandwidth being used up by these crawlers. I continually add to this list at least once a week. This is the haproxy rule I use. acl badbots hdr_reg(User-Agent) -i -f /etc/haproxy/badbots.lst block if badbots
# -----------------------------------------------------------------
# User-Agent strings that are worth blocking with the following rule
# in haproxy to prevent your content being stolen, stop spammers and
# to limit your bandwidth usage.
#
# acl badbots hdr_reg(User-Agent) -i -f /etc/haproxy/badbots.lst
# block if badbots
#
# By Danny Sheehan
# http://www.setuptips.com
@virtualadrian
virtualadrian / Vagrantfile
Created April 23, 2017 15:03 — forked from ryu22e/Vagrantfile
vagrant box installed docker and docker-compose
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at