Skip to content

Instantly share code, notes, and snippets.

Avatar

Matt H matthewhochler

View GitHub Profile
View tmux-cheatsheet.markdown

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@matthewhochler
matthewhochler / omnifocus_bookmarklet.js
Last active Aug 29, 2015 — forked from al3xandru/gist:1169583
OmniFocus Generalized Bookmarklet
View omnifocus_bookmarklet.js
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;
View create_project.sh
#!/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.
View profile_middleware.py
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.
@matthewhochler
matthewhochler / search_google_in_duckduckgo.js
Created Jan 28, 2015
Bookmarklet to search Google from a DuckDuckGo results page
View search_google_in_duckduckgo.js
javascript:(function()%7B$('%23search_form_input').val('!g '+$('%23search_form_input').val());$('%23search_form').submit();%7D)()
@matthewhochler
matthewhochler / inline_todoist.js
Created Jan 28, 2015
Inline Todoist interface bookmarklet.
View inline_todoist.js
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);
View amazon_short_url.js
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); }
View test_pep8.py
"""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
View scapy_collection.py
# 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):
@matthewhochler
matthewhochler / gist:bf36698f83eadf095269
Created Oct 30, 2015 — forked from joshuaflanagan/gist:7495006
Postgres extensions on Amazon RDS
View gist:bf36698f83eadf095269
name | default_version | installed_version | comment
------------------------+-----------------+-------------------+---------------------------------------------------------------------
pg_buffercache | 1.0 | | examine the shared buffer cache
earthdistance | 1.0 | | calculate great-circle distances on the surface of the Earth
pg_freespacemap | 1.0 | | examine the free space map (FSM)
intagg | 1.0 | | integer aggregator and enumerator (obsolete)
plperl | 1.0 | | PL/Perl procedural language
sslinfo | 1.0 | | information about SSL certificates
btree_gist | 1.0 | | support for indexing common datatypes in GiST
fuzzystrmatch | 1.0