Skip to content

Instantly share code, notes, and snippets.

View matthewhochler's full-sized avatar

Matt H matthewhochler

View GitHub Profile
@matthewhochler
matthewhochler / sql_mongodb_dump_middleware.py
Created May 17, 2016 19:13 — forked from kesor/sql_mongodb_dump_middleware.py
Django MongoDB + SQL dump middleware
from django.core.exceptions import MiddlewareNotUsed
from django.conf import settings
from django.db import connection
from pymongo.connection import Connection
from time import time
import struct
import bson
from bson.errors import InvalidBSON
class SqldumpMiddleware(object):
@matthewhochler
matthewhochler / gist:ea5028761f868542ed47a87ba05e7b79
Created July 1, 2016 18:00 — forked from g3d/gist:2709563
Clean Install – OS X 10.11 El Capitan
@matthewhochler
matthewhochler / flask_profiler.py
Created August 3, 2016 18:49 — forked from madhukar93/flask_profiler.py
A profiler for Flask apps
"""
This module provides a simple WSGI profiler middleware for finding
bottlenecks in web application. It uses the profile or cProfile
module to do the profiling and writes the stats to the stream provided
To use, run `flask_profiler.py` instead of `app.py`
see: http://werkzeug.pocoo.org/docs/0.9/contrib/profiler/
and: http://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-xvi-debugging-testing-and-profiling
"""
@matthewhochler
matthewhochler / msnbc-dl.py
Last active October 27, 2016 16:53
Download MSNBC episodes - Deprecated
#!/usr/bin/env python
import logging
import multiprocessing
import os
import urllib2
import subprocess
import sys
import time
from xml.etree import ElementTree
Public Function getRowNum(worksheetName, rowName, headerColumnNum) As Integer
Set worksheet = Worksheets(worksheetName)
rowNum = 0
lastRowNum = worksheet.Cells(worksheet.Rows.Count, headerColumnNum).End(xlup).Row
For rowLoopNum = 1 To lastRowNum
If worksheet.Cells(rowLoopNum, headerColumnNum).Value = rowName Then
rowNum = rowLoopNum
End If
Next rowLoopNum
getRowNum = rowNum
@matthewhochler
matthewhochler / sync-repo.sh
Last active January 4, 2017 20:41
Sync RapidSOS repo with dev box
# sync-repo
# Dependencies:
# rsync (https://rsync.samba.org)
############################## BEGIN APP CONFIG ###############################
# You should only have to modify this section
# All paths are relative to your home
# Name of project to sync (used for notifications)
@matthewhochler
matthewhochler / a-new-mac-setup.md
Created March 29, 2017 16:36 — forked from maxfenton/a-new-mac-setup.md
System setup stuff for a new mac

New computer setup

  • a/o 2016-05-21 *

--

Format the drive

  1. Restart with Cmd-R or Cmd-D
  2. Erase drive / 3x if second-hand
  3. Reinstall MacOS
app=$HOME/apps/nzbget-loop
cat > $app << EOF
#!/usr/bin/env bash
export TERM="xterm"
until ~/apps/nzbget/nzbget -s; do
echo "NZBGet crashed. Respawning.." >&2
sleep 1
done
EOF
chmod +x $app
# This script adds a "Webclip" shortcut to your homescreen.
# The shortcut can be used to open a web page in full-screen mode,
# or to launch a custom URL (e.g. a third-party app).
# You'll be asked for a title, a URL, and an icon (from your camera roll)
import plistlib
import BaseHTTPServer
import webbrowser
import uuid
from io import BytesIO
@matthewhochler
matthewhochler / sync_playlists_to_users.py
Created October 22, 2017 21:32 — forked from JonnyWong16/sync_playlists_to_users.py
Sync Plex playlists to shared users.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Description: Sync Plex playlists to shared users.
# Author: /u/SwiftPanda16
# Requires: plexapi, requests, xmltodict
import requests
import xmltodict