Skip to content

Instantly share code, notes, and snippets.

View chrisgrande's full-sized avatar

Christopher Grande chrisgrande

View GitHub Profile
class TurbolinksMiddleware(object):
"""
Send the `Turbolinks-Location` header in response to a visit that was redirected,
and Turbolinks will replace the browser's topmost history entry.
"""
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request):
@chrisgrande
chrisgrande / launch_app_if_not_running.py
Created March 8, 2019 01:30
Check if app is running, if not, launch it
#!/usr/bin/python
from AppKit import NSWorkspace, NSBundle, NSRunningApplication
import sys
# app to look for and launch if not running
app_name = 'OneDrive'
app_bundle_id = 'com.microsoft.OneDrive'
# hide the python rocket ship