Skip to content

Instantly share code, notes, and snippets.

View matburt's full-sized avatar
😄

Matthew Jones matburt

😄
View GitHub Profile
@matburt
matburt / i3plug.py
Created August 10, 2012 02:51
To be used with the i3 window manager (and i3-py). Takes a command 'save' or 'restore'. When 'save' is used it will store the monitor that each workspace is assigned to. When 'restore' is used it will restore those workspaces to the monitor that it was
import os
import i3
import sys
import pickle
def showHelp():
print(sys.argv[0] + " <save|restore>")
def get_visible_workspace():
for workspace in i3.get_workspaces():
@matburt
matburt / rcirc-urgent-hooks.el
Created August 23, 2012 04:35
Add urgency hooks to be emitted on certain events for rcirc
(defun urgent-hint ()
(let ((wm-hints (append (x-window-property "WM_HINTS" nil "WM_HINTS" nil nil t) nil)))
(setcar wm-hints (logior (car wm-hints) #x00000100))
(x-change-window-property "WM_HINTS" wm-hints nil "WM_HINTS" 32 t)))
(defun rcirc-urgent-emit (process sender response target text)
(dolist (tvar rcirc-keywords)
(if (search tvar text)
(progn
(urgent-hint)
@matburt
matburt / submit.py
Created October 22, 2012 14:24
simple apnswrapper
from APNSWrapper import *
import binascii
deviceToken = binascii.unhexlify('2122a207ebbe6462d447c530f84c9380ad01e67b5faea0c852b6e4e14cf90722');
wrapper = APNSNotificationWrapper('dev.pem', True)
message = APNSNotification()
message.token(deviceToken)
message.alert("Test Message")
message.badge(5)
message.sound('fema.aiff')
wrapper.append(message)
@matburt
matburt / stream_twitch.sh
Last active December 24, 2015 18:29
Stream to twitch from Linux
#!/bin/bash
API_KEY="<twitch api key>"
FPS="15"
INRES="1920x1080"
OUTRES="1920x1080"
OFFSET="2560,0"
ffmpeg -f x11grab -s "$INRES" -r "$FPS" -i :0.0+$OFFSET \
-f alsa -ac 2 -i default -vcodec libx264 -s "$OUTRES" \
@matburt
matburt / keybase.md
Created April 3, 2014 18:54
keybase.md

Keybase proof

I hereby claim:

  • I am matburt on github.
  • I am matburt (https://keybase.io/matburt) on keybase.
  • I have a public key whose fingerprint is FC4A 5B73 555B EA53 82AF 1C64 C10C 4C26 B29F EFA4

To claim this, I am signing this object:

def kfactor(r):
return kfactorScale * (122 - 6*(r/100) + math.pow(r/100,2)/15)
@matburt
matburt / simplebot.go
Created August 30, 2014 15:56
A Simple Go bot
package main
import (
"github.com/matburt/vindinium-go-engine"
"fmt"
)
var (
client vindinium.Client
)
@matburt
matburt / flask_request_handler.py
Last active March 22, 2016 20:21
A Generalized flask http request handler
#!/usr/bin/env python
from flask import Flask, request, abort, jsonify
app = Flask(__name__)
@app.route('/push', methods=['POST'])
def handle_push():
if not request.json:
abort(400)
if 'AAA' not in request.headers:
pass
@matburt
matburt / onlinego.el
Last active June 16, 2021 13:15
A simple emacs module for interfacing with online-go.com
;;; onlinego.el
;; Author: Matthew Jones <[email protected]>
(require 'request)
(defvar onlinego-api-base "https://online-go.com/api/v1"
"The base onlinego api url")
(defcustom onlinego-api-client-id nil
"onlinego api client id, see: https://online-go.com/developer"
@matburt
matburt / org2idonethis.el
Created January 13, 2016 05:33
Emacs module for submitting org journal items to idonethis
(defun org-idonethis-capture ()
"Captures captures and sends them to idonethis"
(message "before hook")
(cond ((string-match "\:tag-to-match\:" (buffer-string))
(goto-char (point-min))
(search-forward "****")
(setq note-contents (buffer-substring (+ (point) 1) (line-end-position)))
(message note-contents)
(request
"https://idonethis.com/api/v0.1/dones/"