Skip to content

Instantly share code, notes, and snippets.

View mdornseif's full-sized avatar

Maximillian Dornseif mdornseif

View GitHub Profile
(* Script to record and tag spotify tracks, by Lloyd Moore *)
(* Modified by Tiffany G. Wilson to resolve audio splitting issues, automate starting/stopping, and add recording customization *)
(* Modified by github.com/duggi on 7/18/2014 -- replace slash with dashin new filename to prevent directory write errors *)
(* Snippets for controlling Spotify are from Johnny B on tumblr (http://johnnyb.tumblr.com/post/25716608379/spotify-offline-playlist) *)
(* The idea of using delayed tagging/filename updating is from a guest user on pastebin (http://pastebin.com/rHqY0qg9) *)
(* The only thing to change in the script is the output format; you must change the file extension and the recording format to match *)
(* Run this script once a song you want to record is queued (stopped at beginning) or playing *)
(* Running the script will initiate hijacking, recording and audio playback *)
(* To stop script, pause Spotify or wait for album/playlist to end*)
(* To set id3 tags, use application Kid3 (http://sourceforge.net/pr
#!/usr/bin/env python
# encoding: utf-8
"""
paffrater.py - Dieses Progrtamm liesst Volksbank Kontoauszüge und konvertiert sie in OFX.
OFX wurde mit xero.com getestet.
Created by Maximillian Dornseif on 2010-06-05.
Copyright (c) 2010, 2013 HUDORA. All rights reserved.
"""
@mdornseif
mdornseif / Makefile
Last active December 27, 2015 08:59
Makefile snippet to ensure python code quality
# Dateien, die wir strenger checken.
STRICT_LINT_FILES= views/admin.py modules/beliza
# Alle Projektdateien
LINT_FILES= $(STRICT_LINT_FILES) *.py controllers/ modules/ views/ bin/import_rechnung.py
LINT_LINE_LENGTH= 110
LINT_FLAKE8_ARGS= --max-complexity=18 --builtins=_ --max-line-length=$(LINT_LINE_LENGTH)
GOOD_NAMES=_,setUp,application,fd,gaetk_replication_SQL_INSTANCE_NAME,gaetk_replication_SQL_DATABASE_NAME,gaetk_replication_SQL_QUEUE_NAME
def ig2adn(profile):
logging.debug(profile)
instagram_client = InstagramAPI(access_token=profile.ig_access_token)
try:
media, next = instagram_client.user_recent_media()
except InstagramAPIError, msg:
if 'The "access_token" provided is invalid.' in str(msg):
# profile.ig_access_token = None
# profile.put()
return
class UeCheckin2(gaetk.handler.BasicHandler):
def put(self, uuid):
key = "sekrit" # determined by some other process
bodyhash = base64.b64encode(hashlib.sha256(self.request.body).digest())
toBeSigned = "&".join([self.request.method, self.request.path, bodyhash])
signature = base64.b64encode(hmac.new(key, toBeSigned, hashlib.sha256).digest())
header = self.request.headers['Authorization']
typ, value = header.split()
if typ != 'X-Signature':
raise gaetk.handler.HTTP401_Unauthorized
@mdornseif
mdornseif / appengine_config.py
Created September 24, 2013 10:20
Limiting certain countries
class RateLimitTimeMiddleware(object):
def __init__(self, app):
self.app = app
def __call__(self, environ, start_response):
if environ.get('HTTP_X_APPENGINE_COUNTRY', '??') in ['KW', 'CN']:
start_response('429 Too Many Requests', [('Content-type', 'text/html')])
return ["""<html><head><title>429 Too Many Requests, sorry...</title>
<style>body { font-family: verdana, arial, sans-serif; background-color: #fff; color: #000; }</style>
</head><body><div style="margin-left: 4em;"><h1>We're sorry...</h1>
#!/usr/bin/env python
# encoding: utf-8
import sys
def main():
if len(sys.argv) < 2:
sys.stderr.write('Usage: %s filename\n' % sys.argv[1])
sys.exit()
{
"meta": {
"code": 200
},
"data": {
"created_at": "2013-06-23T11:12:04Z",
"num_stars": 0,
"num_replies": 0,
"source": {
"link": "http:\/\/im-fluss.appspot.com",
{
"meta": {
"code": 200
},
"data": {
"created_at": "2013-06-09T21:35:09Z",
"num_stars": 1,
"num_replies": 0,
"source": {
"link": "http:\/\/im-fluss.appspot.com",
{
"meta": {
"code": 200
},
"data": {
"created_at": "2013-06-09T07:39:00Z",
"num_stars": 0,
"num_replies": 0,
"source": {
"link": "http:\/\/im-fluss.appspot.com",