Skip to content

Instantly share code, notes, and snippets.

View matburt's full-sized avatar
😄

Matthew Jones matburt

😄
View GitHub Profile
---
- name: Super simple playbook
hosts: all
tasks:
- name: Install nginx
yum:
name: nginx
state: latest
- name: Start nginx
service:
@matburt
matburt / rbac.py
Last active March 8, 2016 20:50 — forked from j00bar/rbac.py
if is_used_by_job_template(cred):
if is_used_by_multiple_jts(cred):
duplicate_creds()
convert_cred_to_org_cred(cred)
else:
convert_cred_to_org_cred(cred)
elif cred.team:
convert_cred_to_org_cred(cred)
give_team_role_on_cred(cred, cred.team)
elif cred.user:
@matburt
matburt / sig_clear.py
Created March 8, 2016 19:48
Disable signals and trigger job deletion
from django.db.models.signals import pre_save, post_save, pre_delete, post_delete, m2m_changed
from awx.main.models import *
def clear_signals():
s = [pre_save, post_save, pre_delete, post_delete, m2m_changed]
for sig in s:
sig.receivers = []
@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/"
@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 / 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 / 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
)
def kfactor(r):
return kfactorScale * (122 - 6*(r/100) + math.pow(r/100,2)/15)
@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:

@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" \