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
View default.pa
#!/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
self.email = email
smtp_formatter = logging.Formatter("%(asctime)s %(message)s",
datefmt='%Y-%m-%d %H:%M')
self.setFormatter(smtp_formatter)
@brokkr
brokkr / download_file.py
Last active Aug 30, 2016
Download a file with timeouts
View download_file.py
import urllib.request
import urllib.error
import signal
class NoMoreBufferException(Exception):
pass
class TimesUpException(Exception):
pass
View functions.php
<?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
INITIALIZATION
git clone -o [name to use to refer to repo] [url]
REMOTE -> LOCAL
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
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:
https://wordpress.com/themes/hew
http://wptavern.com/hew-a-free-wordpress-blogging-theme-inspired-by-ryu
*/
#masthead,
#infinite-handle span,
You can’t perform that action at this time.