Skip to content

Instantly share code, notes, and snippets.

View stevejenkins's full-sized avatar

Steve Jenkins stevejenkins

View GitHub Profile
@stevejenkins
stevejenkins / cf-invalidate.php
Created September 7, 2011 04:31 — forked from claylo/cf-invalidate.php
How to invalidate a single item via URL in AWS CloudFront
<?php
/**
* Super-simple AWS CloudFront Invalidation Script
* Modified by Steve Jenkins <steve stevejenkins com> to invalidate a single file via URL.
*
* Steps:
* 1. Set your AWS Access Key
* 2. Set your AWS Secret Key
* 3. Set your CloudFront Distribution ID (or pass one via the URL with &dist)
* 4. Put cf-invalidate.php in a web accessible and password protected directory
@stevejenkins
stevejenkins / check_comcast.sh
Last active October 13, 2015 13:58
"Is Comcast up?" shell script
#!/bin/sh
# Original version developed by Reverend Booyah! (SteveCook.net)
# First, ping Comcast's web server
ping -q -c 2 www.comcast.net &> /dev/null
if [ $? -ne 0 ] ; then
echo "Comcast didn't work"
# If Comcast fails, that's Strike 1. Next, ping Yahoo's web server
ping -q -c 2 yahoo.com &> /dev/null
@stevejenkins
stevejenkins / reboot_script.php
Created December 4, 2012 17:48
Power Cycle Modem (Outlet 2) and Router (Outlet 3) on BayTech RPC unit
#!/usr/bin/php -q
<?
print("open 192.168.1.200\n");
sleep(2);
print("username\r");
sleep(2);
print("password\r");
sleep(2);
print("REBOOT 2\r");
sleep(2);
@stevejenkins
stevejenkins / firewall_skype.sh
Last active December 10, 2015 02:58
DD-WRT Firewall Script
#Enable NAT on the WAN port to correct a bug in builds over 17000
iptables -t nat -I POSTROUTING -o `get_wanface` -j SNAT --to `nvram get wan_ipaddr`
#Allow br1 access to br0, the WAN, and any other subnets (required if SPI firewall is on)
iptables -I FORWARD -i br1 -m state --state NEW -j ACCEPT
iptables -I FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
#Restrict br1 from accessing br0
iptables -I FORWARD -i br1 -o br0 -m state --state NEW -j DROP
@stevejenkins
stevejenkins / opendkim_multi_config.sh
Last active December 13, 2016 19:25
Script submitted by Almir Duarte Jr. for automating OpenDKIM key generation and configuration for multiple domains.
#!/bin/bash
# USAGE
# Install opendkim
# List all your domains in file /etc/opendkim/TrustedHosts, one per line
CHOWN="$(which chown)"
MKDIR="$(which mkdir)"
REMOVE="$(which rm)"
ECHO="$(which echo)"
COPY="$(which cp)"
@stevejenkins
stevejenkins / make_postfix_64.sh
Last active December 12, 2015 01:58
Creates the Postfix make files for building from source on an x86_64 (64-bit) system without MySQL support
#/bin/sh
make makefiles CCARGS='-fPIC -DUSE_TLS -DUSE_SSL -DUSE_SASL_AUTH -DUSE_CYRUS_SASL -DPREFIX=\\"/usr\\" -DHAS_LDAP -DLDAP_DEPRECATED=1 -DHAS_PCRE -I/usr/include/openssl -I/usr/include/sasl -I/usr/include' AUXLIBS='-L/usr/lib64 -L/usr/lib64/openssl -lssl -lcrypto -L/usr/lib64/sasl2 -lsasl2 -lpcre -lz -lm -lldap -llber -Wl,-rpath,/usr/lib64/openssl -pie -Wl,-z,relro' OPT='-O' DEBUG='-g'
@stevejenkins
stevejenkins / make_postfix_32.sh
Created February 1, 2013 23:41
Creates the Postfix make files for building from source on an i386 or i686 (32-bit) system without MySQL support
#/bin/sh
make makefiles CCARGS='-fPIC -DUSE_TLS -DUSE_SSL -DUSE_SASL_AUTH -DUSE_CYRUS_SASL -DPREFIX=\\"/usr\\" -DHAS_LDAP -DLDAP_DEPRECATED=1 -DHAS_PCRE -I/usr/include/openssl -I/usr/include/sasl -I/usr/include' AUXLIBS='-L/usr/lib -L/usr/lib/openssl -lssl -lcrypto -L/usr/lib/sasl2 -lsasl2 -lpcre -lz -lm -lldap -llber -Wl,-rpath,/usr/lib/openssl -pie -Wl,-z,relro' OPT='-O' DEBUG='-g'
@stevejenkins
stevejenkins / make_postfix_32_myqsl.sh
Last active December 12, 2015 02:08
Creates the Postfix make files for building from source on an i386/I363 (32-bit) system with MySQL support
#/bin/sh
make makefiles CCARGS='-fPIC -DUSE_TLS -DUSE_SSL -DUSE_SASL_AUTH -DUSE_CYRUS_SASL -DPREFIX=\\"/usr\\" -DHAS_LDAP -DLDAP_DEPRECATED=1 -DHAS_PCRE -I/usr/include/openssl -DHAS_MYSQL -I/usr/include/mysql -I/usr/include/sasl -I/usr/include' AUXLIBS='-L/usr/lib -L/usr/lib/openssl -lssl -lcrypto -L/usr/lib/mysql -lmysqlclient -L/usr/lib/sasl2 -lsasl2 -lpcre -lz -lm -lldap -llber -Wl,-rpath,/usr/lib/openssl -pie -Wl,-z,relro' OPT='-O' DEBUG='-g'
@stevejenkins
stevejenkins / make_postfix_64_mysql.sh
Last active December 12, 2015 02:08
Creates the Postfix make files for building from source on an x86_64 (64-bit) system with MySQL support
#/bin/sh
make makefiles CCARGS='-fPIC -DUSE_TLS -DUSE_SSL -DUSE_SASL_AUTH -DUSE_CYRUS_SASL -DPREFIX=\\"/usr\\" -DHAS_LDAP -DLDAP_DEPRECATED=1 -DHAS_PCRE -I/usr/include/openssl -DHAS_MYSQL -I/usr/include/mysql -I/usr/include/sasl -I/usr/include' AUXLIBS='-L/usr/lib64 -L/usr/lib64/openssl -lssl -lcrypto -L/usr/lib64/mysql -lmysqlclient -L/usr/lib64/sasl2 -lsasl2 -lpcre -lz -lm -lldap -llber -Wl,-rpath,/usr/lib64/openssl -pie -Wl,-z,relro' OPT='-O' DEBUG='-g'
@stevejenkins
stevejenkins / denyhosts-unban.sh
Created April 1, 2013 22:50
Script for automatically unbanning/removing IPs and hostnames that were banned by DenyHosts. Courtesy of Cybernitus (http://www.cybertinus.nl/).
#!/bin/bash
#################
# CONFIGURATION #
#################
# The $WORK_DIR as set in /etc/denyhosts.conf. You can let this script find the
# setting automatically, or you can set it yourself.
DENYHOSTS_WORK_DIR=$(grep 'WORK_DIR' /etc/denyhosts.conf | grep -v '#' | cut -d '=' -f 2 | sed 's/ //')
#DENYHOSTS_WORK_DIR="/var/lib/denyhosts"