Skip to content

Instantly share code, notes, and snippets.

View gottaloveit's full-sized avatar

Joe Passavanti gottaloveit

View GitHub Profile
@gottaloveit
gottaloveit / rebuld_nginx_with_pagespeed.sh
Last active July 9, 2016 15:20
This is a script for Debian/ Ubuntu that will rebuild the latest Nginx deb package from nginx.org with Google Pagespeed. There are a couple other modules the script will prompt you to ask if you want to remove them. They are http-dav, http-flv, http-mp4, mail, mail_ssl. Will prompt to add http-geoip and ask if you want to change the nginx user t…
#!/bin/bash
echo "This script will rebuild a Debian style package (deb) of latest stable"
echo "Nginx. The original deb is from nginx.org apt repository."
echo
echo "This will prompt you yes or no on a few changes to the build as well as"
echo "it will compile and package the latest Google NGX Pagespeed module."
echo
echo "This is built and tested on Ubuntu 14.04 LTS, fresh OS install."
echo "There are no guarantees, and I take no liability if it breaks, but it"
@gottaloveit
gottaloveit / run-innobackupex.sh
Last active August 29, 2015 14:08 — forked from jmfederico/run-xtrabackup.sh
Updated options to make it able to run automatically, non interactive, suitable for daily or even multiple per day MySQL backups using cron, and Percona's Xtrabackup. Option to backup slave replication also, and amount of days to keep backups on the disk or wherever you set the path. Easy options at the top of the file, set them, set cron, and y…
#!/bin/sh
#can change to /tmp, /var has tons of space on our servers
TMPFILE="/var/tmp/innobackupex-runner.$$.tmp"
MYSQL_USER=XXX
MYSQL_PASS=XXX
BACKDIR=/var/backups/mysql
FULL_BACKUP_DIRNAME=full
INCR_BACKUP_DIRNAME=incr
@gottaloveit
gottaloveit / cisco_asa_backup.sh
Last active January 14, 2016 12:56
Storing for in case of future need. This runs to pull configs from network Cisco ASA and compares and saves config file to a local network file share location using CIFS and a network file server to store the confgs. It work for the situation it is in, they may not work for every situation, I do not take liability for anything that might go wron…
#!/bin/bash
# written for Cisco ASA 5500
# example usage ./asa_ssh.sh "DEVICE_NAME" DEVICE_IP TFTPD_SERVER_IP "COLO_FACILITY_SHORTNAME" "ASA_OUTBOUND_INTERFACE"
# Storing for in case of future need. This runs to pull configs from network Cisco ASA and compares and saves config file
# to a local network file share location using CIFS and a network file server to store the confgs. It work for the situation
# it is in, they may not work for every situation, I do not take liability for anything that might go wrong, nor do I support
# these scripts outside of my own usage.
host=$1
@gottaloveit
gottaloveit / dell_switch_backup.sh
Created January 14, 2016 12:58
Storing for in case of future need. This runs to pull configs from network dell switches and compares and saves config file to a local network file share location using CIFS and a network file server to store the confgs. It work for the situation it is in, they may not work for every situation, I do not take liability for anything that might go …
#!/bin/bash
# written for dell network N2048 switch
# example usage ./dell_switch_telnet.sh "DEVICE_NAME" DEVICE_IP TFTPD_SERVER_IP "COLO_FACILITY_NICKNAME"
# Storing for in case of future need. This runs to pull configs from network dell switches and compares and saves config file
# to a local network file share location using CIFS and a network file server to store the confgs. It work for the situation
# it is in, they may not work for every situation, I do not take liability for anything that might go wrong, nor do I support
# these scripts outside of my own usage.
host=$1
@gottaloveit
gottaloveit / cisco_switch_backup.sh
Created January 14, 2016 13:01
Storing for in case of future need. This runs to pull configs from network cisco switches and compares and saves config file to a local network file share location using CIFS and a network file server to store the confgs. It work for the situation it is in, they may not work for every situation, I do not take liability for anything that might go…
#!/bin/bash
# written for a Cisco WS-C2960S-48TD-L
# example usage ./cisco_switch.sh "DEVICE_NAME" DEVICE_IP TFTPD_SERVER_IP "COLO_FACILITY_SHORTNAME"
# Storing for in case of future need. This runs to pull configs from network cisco switches and compares and saves config file
# to a local network file share location using CIFS and a network file server to store the confgs. It work for the situation
# it is in, they may not work for every situation, I do not take liability for anything that might go wrong, nor do I support
# these scripts outside of my own usage.
host=$1
@gottaloveit
gottaloveit / cisco_switch2_backup.sh
Created January 14, 2016 13:01
Storing for in case of future need. This runs to pull configs from network cisco switches and compares and saves config file to a local network file share location using CIFS and a network file server to store the confgs. It work for the situation it is in, they may not work for every situation, I do not take liability for anything that might go…
#!/bin/bash
# written for a Cisco WS-C2960S-48TD-L
# example usage ./cisco_switch2.sh "DEVICE_NAME" DEVICE_IP TFTPD_SERVER_IP "COLO_FACILITY_SHORTNAME"
# Storing for in case of future need. This runs to pull configs from network cisco switches and compares and saves config file
# to a local network file share location using CIFS and a network file server to store the confgs. It work for the situation
# it is in, they may not work for every situation, I do not take liability for anything that might go wrong, nor do I support
# these scripts outside of my own usage.
host=$1
# Ubuntu upstart file at /etc/init/mongodb.conf
pre-start script
mkdir -p /MongoData/data
mkdir -p /MongoData/log
ln -s /MongoData/data/ /var/lib/mongodb/
ln -s /MongoData/log/ /var/log/mongodb/
end script
start on runlevel [2345]
#!/bin/sh
### BEGIN INIT INFO
# Provides: disable-transparent-hugepages
# Required-Start: $local_fs
# Required-Stop:
# X-Start-Before: mongod mongodb-mms-automation-agent
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Disable Linux transparent huge pages
# Description: Disable Linux transparent huge pages, to improve
@gottaloveit
gottaloveit / termux_setup.sh
Last active August 29, 2021 12:22
Script to setup my termux in Android.
#!/bin/bash
## run in termux by issuing
## curl -s -L https://bit.ly/2S8s4D0 | bash
## updated 1818
BASE_PATH='/data/data/com.termux/files'
LOG_FILE='./setup_log.txt'
function cmmd()
@gottaloveit
gottaloveit / README.md
Last active April 26, 2021 16:16
Trouble with iptables, nat, port forwarding? Hope this will help.

I was having trouble getting NAT working on a Debian server which was going to act as a gateway for my private physical network. I tried to many different versions of tips and none got all the pieces right.

Until I found this amazing generator script. The questions were easy to answer and very robust in terms of understanding what I wanted. The best part, it created this script which ran totally perfect. It created a perfect firewall, blocks everything except what I want open, provides NAT and port forwarding for incoming services.

The link to this amazing script, for which I am not the author, is http://easyfwgen.morizot.net/gen/