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
mattpavelle / BREW_PIP_AUTO_UPDATE_README.md
Last active Jun 21, 2019
MacOS automatic scheduled updates and upgrades for Homebrew (brew) and Python (pip) - using launchd instead of cron
View BREW_PIP_AUTO_UPDATE_README.md

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

View keybase.md

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 Mar 5, 2014
Hide Git files from Apache
View .htaccess
RedirectMatch 404 /\.git
@mattpavelle
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
pprint(vars(math))
pprint(dir(math))
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
mattpavelle / iptables.sh
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
View iptables.sh
#! /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 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 );
@mattpavelle
mattpavelle / getURLParam.js
Last active Dec 17, 2015
access GET params passed to js
View getURLParam.js
/**
* return the value of a named GET parameter passed to a named JS
* @param string scriptName, string paramName
* @return string
*/
function retURLParams(paramName, scriptName) {
var scripts = document.getElementsByTagName("script");
for (i=0; i<scripts.length; i++) {
if(scripts[i].src.indexOf(scriptName) != -1){
scriptSrc = decodeURIComponent(scripts[i].src);
View start.html
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<title>HTML5 QuickStart</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
You can’t perform that action at this time.