Skip to content

Instantly share code, notes, and snippets.

Avatar

Steve Jenkins stevejenkins

View GitHub Profile
@stevejenkins
stevejenkins / cf-invalidate.php
Created Sep 7, 2011 — forked from claylo/cf-invalidate.php
How to invalidate a single item via URL in AWS CloudFront
View cf-invalidate.php
<?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 Oct 13, 2015
"Is Comcast up?" shell script
View check_comcast.sh
#!/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 Dec 4, 2012
Power Cycle Modem (Outlet 2) and Router (Outlet 3) on BayTech RPC unit
View reboot_script.php
#!/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 Dec 10, 2015
DD-WRT Firewall Script
View firewall_skype.sh
#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 Dec 13, 2016
Script submitted by Almir Duarte Jr. for automating OpenDKIM key generation and configuration for multiple domains.
View opendkim_multi_config.sh
#!/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 Dec 12, 2015
Creates the Postfix make files for building from source on an x86_64 (64-bit) system without MySQL support
View make_postfix_64.sh
#/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 Feb 1, 2013
Creates the Postfix make files for building from source on an i386 or i686 (32-bit) system without MySQL support
View make_postfix_32.sh
#/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 Dec 12, 2015
Creates the Postfix make files for building from source on an i386/I363 (32-bit) system with MySQL support
View make_postfix_32_myqsl.sh
#/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 Dec 12, 2015
Creates the Postfix make files for building from source on an x86_64 (64-bit) system with MySQL support
View make_postfix_64_mysql.sh
#/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 Apr 1, 2013
Script for automatically unbanning/removing IPs and hostnames that were banned by DenyHosts. Courtesy of Cybernitus (http://www.cybertinus.nl/).
View denyhosts-unban.sh
#!/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"