Skip to content

Instantly share code, notes, and snippets.

Mads brokkr

Block or report user

Report or block brokkr

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
#!/usr/bin/pulseaudio -nF
# This file is part of PulseAudio.
# PulseAudio is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# PulseAudio is distributed in the hope that it will be useful, but
View bufferingsmtphandler
class BufferSMTPHandler(handlers.BufferingHandler):
'''SMTPHandler that send one email per flush'''
def __init__(self, email, paths):
handlers.BufferingHandler.__init__(self, capacity=5)
self.state = get_state(path)
self.buffer = self.state.buffer = email
smtp_formatter = logging.Formatter("%(asctime)s %(message)s",
datefmt='%Y-%m-%d %H:%M')
brokkr /
Last active Aug 30, 2016
Download a file with timeouts
import urllib.request
import urllib.error
import signal
class NoMoreBufferException(Exception):
class TimesUpException(Exception):
View functions.php
* SSL for media library
function have_https_for_media( $url ) {
if ( is_ssl() )
$url = str_replace( 'http://', 'https://', $url );
return $url;
View git cheat sheet
git clone -o [name to use to refer to repo] [url]
git remote update: download changes from github
git diff github/[branch]: see changes between local and origin
git merge github/[branch]: merge changes from origin into local
git pull [origin] [branch]:
brokkr / gist:981e3316e631eaaf7f88
Created Jun 30, 2015
Remove finished torrents from Transmission BitTorrent client daemon
View gist:981e3316e631eaaf7f88
#! /usr/bin/python2
import transmissionrpc
## connection paramters - change to match your own settings
creds = {'address':'localhost', 'port':9091 'user':'my_user_name_here', 'password':'my_password_here'}
## establishing contact
tm_client = transmissionrpc.Client(creds['address'], creds['port'], creds['user'], creds['password'])
torrents_lst = tm_client.list()
View hew_wptheme_override
Welcome to Custom CSS!
Picking out the yellow color in Autommattic's Hew theme:
#infinite-handle span,
You can’t perform that action at this time.