Skip to content

Instantly share code, notes, and snippets.

Avatar

Steve Webster spjwebster

View GitHub Profile
@spjwebster
spjwebster / codeship.30s.py
Created Oct 13, 2016
Codeship BitBar plugin
View codeship.30s.py
#!/usr/bin/env python
from contextlib import closing
import urllib2
import json
import sys
API_KEY = '<insert api key here>'
STATUS_EMOJI = {
@spjwebster
spjwebster / codeship_api.py
Last active Oct 13, 2016
Super simple standalone Codeship API wrapper for Python
View codeship_api.py
# Super simple Codeship API wrapper for Python designed to be copy/pasted into
# BitBar plugins or other standalone scripts where installing Python packages
# from PyPI is impossible or undesirable.
#
# License: Public Domain
from contextlib import closing
import urllib2
import json
import sys
@spjwebster
spjwebster / time.1s.sh
Created Oct 12, 2016
Ridiculously contribed BitBar clock that displays rounded time as an emoji
View time.1s.sh
#!/bin/sh
function clock_emoji {
time_hour=$1
time_minute=$2
# Round to 30-minute intervals
time_minute=$(( (time_minute + 15) / 30 * 30 ))
# If we've rounded up, move to next hour (checking for overflow)
@spjwebster
spjwebster / GraphicsConfigurationOverride.xml
Created Sep 11, 2016
Light blue + white HUD colours for Elite: Dangerous
View GraphicsConfigurationOverride.xml
<?xml version="1.0" encoding="UTF-8" ?>
<GraphicsConfig>
<GUIColour>
<Default>
<LocalisationName>Standard</LocalisationName>
<MatrixRed> 0.57, 0.54, 1 </MatrixRed>
<MatrixGreen> 0, 1, 0 </MatrixGreen>
<MatrixBlue> 1, 0.52, 1 </MatrixBlue>
</Default>
</GUIColour>
@spjwebster
spjwebster / __init__.py
Created May 8, 2014
Redis-based session handler for Flask
View __init__.py
# Set session handler
app.session_interface = RedisSessionInterface()
View classical.js
function augment(parent, properties) {
var child = properties.constructor || function() {
return parent.apply(this, arguments);
};
var Surrogate = function(){ this.constructor = child; };
Surrogate.prototype = parent.prototype;
child.prototype = new Surrogate;
for (var key in properties) {
View supervisor-manifests-init.pp
class supervisor {
package {'python-pip-supervisor':
ensure => latest,
name => 'supervisor',
provider => 'pip',
}
File {
owner => root,
View redis-manifests-init.pp
class redis {
apt::ppa {'ppa:rwky/redis':
}
package {'redis-server':
ensure => latest,
require => Apt::Ppa['ppa:rwky/redis'],
}
@spjwebster
spjwebster / rqretryworker.py
Created Sep 11, 2013
A basic rq worker that will retry failed jobs before dumping it in the failed queue.
View rqretryworker.py
#!/usr/bin/env python
import os, sys
sys.path.append(os.getcwd())
import logging
import rq
MAX_FAILURES = 3