Skip to content

Instantly share code, notes, and snippets.

/*
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,
@brokkr
brokkr / gist:981e3316e631eaaf7f88
Created June 30, 2015 08:16
Remove finished torrents from Transmission BitTorrent client daemon
#! /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()
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]:
<?php
/**
* SSL for media library
*/
function have_https_for_media( $url ) {
if ( is_ssl() )
$url = str_replace( 'http://', 'https://', $url );
return $url;
@brokkr
brokkr / download_file.py
Last active August 30, 2016 07:46
Download a file with timeouts
import urllib.request
import urllib.error
import signal
class NoMoreBufferException(Exception):
pass
class TimesUpException(Exception):
pass
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)
#!/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