Skip to content

Instantly share code, notes, and snippets.

View Gipetto's full-sized avatar
💩
Doing the day-to-day.

Shawn Parker Gipetto

💩
Doing the day-to-day.
View GitHub Profile
@Gipetto
Gipetto / gist:348c46500ff4e4c4ea51892b3d0e5839
Created December 12, 2018 01:54
Pihole Firewall black holes that should be part of Pihole itself...
iptables -A INPUT -p tcp --destination-port 443 -j REJECT --reject-with tcp-reset
iptables -A INPUT -p udp --destination-port 80 -j REJECT --reject-with icmp-port-unreachable
iptables -A INPUT -p udp --destination-port 443 -j REJECT --reject-with icmp-port-unreachable
ip6tables -A INPUT -p tcp --destination-port 443 -j REJECT --reject-with tcp-reset
ip6tables -A INPUT -p udp --destination-port 80 -j REJECT --reject-with icmp6-port-unreachable
ip6tables -A INPUT -p udp --destination-port 443 -j REJECT --reject-with icmp6-port-unreachable
iptables-save > /etc/iptables/rules.v4
ip6tables-save > /etc/iptables/rules.v6
@Gipetto
Gipetto / fax-to-email.js
Last active June 17, 2020 14:57
Single function Twilio Fax handling
/**
* !! Requires a SendGrid account & API Key.
* Sign up for the FREE account and create an API key.
* If you're receiving more than 100 faxes a day you
* shouldn't be entertaining the idea of a script like this...
*
* In the Function Instance view:
* - Paste this entire script
* - Set the url path for your Function to: /fax-to-email
*
@Gipetto
Gipetto / purchased-tracks-with-purchaser.py
Created October 31, 2017 03:06
Get a list of purchased tracks from your iTunes library that includes the purchaser. Not accurate for newer iTunes files (I couldn't find the purchaser with mutagen code)
#!/usr/bin/env python3
from plistlib import *
import mutagen as m
import urllib.parse
import pprint
import sys
import csv
import os
@Gipetto
Gipetto / chromeapp.sh
Last active December 17, 2015 09:09
Launch a new, clean and distinct instance of Google Chrome that cannot sync and does not do the first-run dance.
#! /bin/bash
set -e
[ -z $1 ] && dir='/tmp/foo' || dir=$1
chromedev="/Applications/Google Chrome Dev.app"
runChromeDev() {
(
@Gipetto
Gipetto / gist:4704578
Last active December 12, 2015 03:08
"Fix" postfix on OS X 10.8
#! /bin/bash
if [[ $EUID -ne 0 ]]; then
echo 'This script must be run as root'
exit 1
fi
launchctl unload -w /System/Library/LaunchDaemons/org.postfix.master.plist
mkdir -p /Library/Server/Mail/Data/spool/maildrop
/usr/sbin/postfix set-permissions
@Gipetto
Gipetto / gist:2989520
Created June 25, 2012 16:13
Allow shortcodes to be validated as proper numbers in OpenVBX. This is theoretical and untested.
<?php
/**
* Allow Shortcodes to be validated as normal phone numbers in OpenVBX
*
* Open the file `OpenVBX/libraries/PhoneNumber.php` and replace the function
* `PhoneNumbers::normalizePhoneNumbertoE164` with the function definition below.
* Then replace the `$shortcodes` array members with a list of numbers to
* be considered valid shortcodes.
*/
@Gipetto
Gipetto / gist:1925295
Created February 27, 2012 16:45
Proxy configuration for OpenVBX & Twilio-PHP api library
<?php
// template for setting CURL proxy options for OpenVBX
// add the configuration lines below to the file
// `OpenVBX/libraries/OpenVBX.php` on line 375 with the
// config below and then enter the values for your Proxy
// proxy type
$_proxy_type = 'HTTP'; // proxy type
// The address of your proxy server
@Gipetto
Gipetto / gist:1904153
Last active October 1, 2015 02:38
Alternate OpenVBX nginx server config. Slightly different than the sample included with OpenVBX right now and working on my nginx 0.8.54 + PHP 5.3.5 install
server {
listen 80;
server_name openvbx.tld;
access_log /var/www/logs/access.log;
error_log /var/www/logs/error.log;
location /(favicon.ico|robots.txt) {
access_log off;
log_not_found off;
error_page 404 /404;
@Gipetto
Gipetto / gist:1894045
Created February 23, 2012 17:59
Convert all category select checkboxes in to radio buttons in the WordPress post-edit screen.
// Convert all Category input checkboxes in to radio selects
// It completely replaces the elements with new ones and transfers
// the attributes from the old element to the new.
// We can't just change the type because of, you guessed it, Internet Explorer
// Yes, sometimes a hand grenade is easier than a scalpel ;)
jQuery('form#post').find('.categorychecklist input').each(function() {
var new_input = jQuery('<input type="radio" />'),
attrLen = this.attributes.length;
for (i = 0; i < attrLen; i++) {
@Gipetto
Gipetto / gist:1872357
Created February 20, 2012 23:47
Enable Carrington Theme Framework to contextually load page content templates by page name
<?php
/**
* Allow content templates to be loaded by page name
*
* ie: a page named "home" can load a special content template by adding a file
* to the content templates folder: `content/page-home.php`
*
* @param string $filename
* @param string $type