Skip to content

Instantly share code, notes, and snippets.


Matt Pavelle mattpavelle

  • New York
Block or report user

Report or block mattpavelle

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
mattpavelle /
Last active Jun 21, 2019
MacOS automatic scheduled updates and upgrades for Homebrew (brew) and Python (pip) - using launchd instead of cron

Cron on MacOS doesn't really work...

The launchd scripts below follow the Mac OS X way to run scripts that automatically update and upgrade brew and pip packages on a set schedule.

They will run daily as follows:

  • Homebrew (brew) Update at 3:01AM, upgrade at 3:03AM, and cleanup at 3:09AM
  • Python packages (via pip) Upgrade at 3:15AM

Installation Instructions


Keybase proof

I hereby claim:

  • I am mattpavelle on github.
  • I am mattpavelle ( on keybase.
  • I have a public key ASCl27yiqz8R19juSd-RaKQ7xLwsoAngpDXsMaSsirMmWwo

To claim this, I am signing this object:

mattpavelle / .htaccess
Created Mar 5, 2014
Hide Git files from Apache
View .htaccess
RedirectMatch 404 /\.git
mattpavelle / pprint
Created Feb 12, 2014
reminder: vars displays a dictionary corresponding to the current local symbol table, dir displays the list of names in the current local scope
View pprint
import math
from pprint import pprint
View perfect-full-page-background-image.css
html {
background: url(images/bg.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
mattpavelle /
Created Jun 6, 2013
super simple code to add a 24 hour IP address block for anyone who tries to ssh in 3 times and fails
#! /bin/bash
/usr/bin/sudo /sbin/iptables -I INPUT -i eth0 -p tcp -m tcp --dport 22 -m state --state NEW -m recent --set --name DEFAULT --rsource
## if someone tries to ssh in 3x and fails, block their IP for 24 hours
/usr/bin/sudo /sbin/iptables -I INPUT -i eth0 -p tcp -m tcp --dport 22 -m state --state NEW -m recent --update --seconds 86400 --hitcount 4 --name DEFAULT --rsource -j DROP
## place in /etc/network/if-up.d/
## see all rules with:
# /usr/bin/sudo /sbin/iptables -vnL --line-numbers
mattpavelle / ieBrowserVersion.js
Last active Dec 18, 2015
Check the browser userAgent and determine if it is IE8+ or IE7- (counting compatibility mode as the +, not the -)
View ieBrowserVersion.js
// usually code that works in IE8/9/10 will also work in IE8/9/10 in compatibility mode, but IE reports itself as IE7
// or some such when running in compatibility mode... so let's pretend that IE9 in IE7 compatibility mode is IE9
function checkVersion() {
var msg = "Not IE";
var ver = -1; // assume failure
var ua = navigator.userAgent;
if (navigator.appName == 'Microsoft Internet Explorer') {
var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
if (re.exec(ua) != null)
ver = parseFloat( RegExp.$1 );
You can’t perform that action at this time.