Skip to content

Instantly share code, notes, and snippets.

View matburt's full-sized avatar
😄

Matthew Jones matburt

😄
View GitHub Profile
@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 / 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 / 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 / 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 / gitversion.sh
Created January 16, 2012 18:47 — forked from seanf/VERSION-GEN
Generate Git Versions/revisions
#!/bin/bash
VERNAME=`git describe --long | sed "s/-g.*//g"`
VERCODE=`git rev-list --all | wc -l`
# Do something with the verson number here.
@matburt
matburt / start-synergy.sh
Created November 3, 2011 14:35
Piggyback Synergy over SSH
echo "Starting Synergy SSH session on $1 with username $2"
ssh -l $2 -f -N -L localhost:24800:$1:24800 $1
synergyc localhost
@matburt
matburt / nodecreate.py
Created June 29, 2011 14:39
Create/Subscribe an xmpp node
import sys
from twisted.internet import reactor
from twisted.python import log
from twisted.words.protocols.jabber.jid import JID
from wokkel import client, pubsub
jid_publisher = JID("user@host")
secret = "test123"
@matburt
matburt / dispcsv.sh
Created June 17, 2011 14:34
Display a CSV file on the command line in an awesome way
cat $1 | column -s, -t | less -#2 -N -S
@matburt
matburt / mpd.sh
Created March 3, 2011 18:36
Colored mpd.sh for xmobar
MPD="$(mpc | head -n 2 | tr '\n' ' ' | sed 's/^\(.*\)\( \[.*\)/\1/')"
MPD_STATE="$(mpc | head -n 2 | tr '\n' ' ' | grep -oG '\[.*\]')"
if [ -z "$MPD" ]; then
echo "<fc=#ff5500>no music</fc>"
else
if [ "$MPD_STATE" = "[paused]" ]; then
echo "<fc=#ff5500>$MPD</fc>"
elif [ -z "$MPD_STATE" ]; then
echo "<fc=#ff5500>no music</fc>"
else
@matburt
matburt / gist:742954
Created December 16, 2010 02:46
reverse lookup ip addresses as first field in logfile
for each in `tail -n 100000 logfile | grep pattern | tr -s " " | awk '{print $1}' | sort | uniq`; do dig +short -x $each; done