Skip to content

Instantly share code, notes, and snippets.

View matthewhochler's full-sized avatar

Matt H matthewhochler

View GitHub Profile
# Adapted from: http://www.lucainvernizzi.net/blog/2015/02/12/extracting-urls-from-network-traffic-in-just-9-python-lines-with-scapy-http/
#
# requirements
# scapy==2.3.1
# scapy-http==1.6
from scapy.all import IP, sniff
from scapy.layers import http
def process_tcp_packet(packet):
"""Run PEP8 on all Python files in this directory and subdirectories as part of the tests."""
__author__ = 'Christopher Swenson'
__email__ = 'chris@caswenson.com'
__license__ = 'CC0 http://creativecommons.org/publicdomain/zero/1.0/'
import os
import os.path
import unittest
@matthewhochler
matthewhochler / fastmail.sieve
Last active June 19, 2023 00:28
My FastMail Sieve rules
### Trash ###
# Trash anything from LinkedIn
# (Because LinkedIn is trash)
if address :all :is ["to", "cc", "resent-to", "x-delivered-to"] "linkedin@matthewhochler.fastmail.fm" {
fileinto "INBOX.Trash";
stop;
}
# Trash Sony PSN 'Funds added' emails
javascript:var re = new RegExp('(?:dp/)([0-9A-Z]+)'); var match = re.exec(location.href); if (match.length > 1) { var id = match[1]; var url = 'http://amzn.com/' + id; alert(url); }
@matthewhochler
matthewhochler / inline_todoist.js
Created January 28, 2015 20:13
Inline Todoist interface bookmarklet.
javascript: (function() %7B var doc = top.document; if(top.js && top.js.document) doc = top.js.document; var script = doc.createElement('script'); doc.todoist_script = script; script.type = 'text/javascript'; script.src = 'http://todoist.com/anywhere/getJavaScript'; doc.getElementsByTagName('head')%5B0%5D.appendChild(script); %7D)(); void(0);
@matthewhochler
matthewhochler / search_google_in_duckduckgo.js
Created January 28, 2015 20:11
Bookmarklet to search Google from a DuckDuckGo results page
javascript:(function()%7B$('%23search_form_input').val('!g '+$('%23search_form_input').val());$('%23search_form').submit();%7D)()
import sys
import tempfile
import hotshot
import hotshot.stats
from django.conf import settings
from cStringIO import StringIO
class ProfileMiddleware(object):
"""
Displays hotshot profiling for any view.
#!/bin/bash
# Setup deployment target for Nginx + Python/uWSGI + Supervisor + Git
# From: https://gist.github.com/1210041
function usage() {
cat << EOF
Usage: $0 PROJECT_NAME [DOMAIN] [OPTIONS]
Options:
-y No prompts, assume yes to all.
@matthewhochler
matthewhochler / omnifocus_bookmarklet.js
Last active August 29, 2015 13:56 — forked from al3xandru/gist:1169583
OmniFocus Generalized Bookmarklet
javascript:(function(){
var enc=encodeURIComponent,
w=window,
frames=w.frames,
d=document,
tn=w.getSelection?w.getSelection():(d.getSelection)?d.getSelection():(d.selection?d.selection.createRange().text:0),
pu=w.location.href,
isGMail=w.location.host.match(/mail\.google\.com/),
tt=pt=d.title,
subjSpans=d.getElementsByClassName("hP"),i,url;

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname