Skip to content

Instantly share code, notes, and snippets.

View mattpavelle's full-sized avatar
🐙

Matt Pavelle mattpavelle

🐙
  • New York
View GitHub Profile
@mattpavelle
mattpavelle / BREW_PIP_AUTO_UPDATE_README.md
Last active June 21, 2019 19:29
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

@mattpavelle
mattpavelle / keybase.md
Last active October 29, 2019 17:56
Keybase

Keybase proof

I hereby claim:

  • I am mattpavelle on github.
  • I am mattpavelle (https://keybase.io/mattpavelle) on keybase.
  • I have a public key ASCl27yiqz8R19juSd-RaKQ7xLwsoAngpDXsMaSsirMmWwo

To claim this, I am signing this object:

@mattpavelle
mattpavelle / .htaccess
Created March 5, 2014 15:25
Hide Git files from Apache
RedirectMatch 404 /\.git
@mattpavelle
mattpavelle / pprint
Created February 12, 2014 15:48
reminder: vars displays a dictionary corresponding to the current local symbol table, dir displays the list of names in the current local scope
import math
from pprint import pprint
pprint(vars(math))
pprint(dir(math))
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
mattpavelle / iptables.sh
Created June 6, 2013 19:52
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
mattpavelle / ieBrowserVersion.js
Last active December 18, 2015 02:08
Check the browser userAgent and determine if it is IE8+ or IE7- (counting compatibility mode as the +, not the -)
// 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 );