Skip to content

Instantly share code, notes, and snippets.

View cleverdevil's full-sized avatar

Jonathan LaCour cleverdevil

View GitHub Profile

Keybase proof

I hereby claim:

  • I am cleverdevil on github.
  • I am cleverdevil (https://keybase.io/cleverdevil) on keybase.
  • I have a public key whose fingerprint is 8A0D 7FD0 193E 3FB4 DE04 0C57 253F B1B5 46BE 7AC2

To claim this, I am signing this object:

@cleverdevil
cleverdevil / time-ephemeral.py
Created May 23, 2014 17:19
A little script I am using to time ephemeral boots in DreamCompute (currently trending between 42-60 seconds!).
#!/usr/bin/env python
import os
import sys
import time
import socket
from paramiko import SSHClient, AutoAddPolicy
from novaclient.v1_1 import client as compute_client
### Keybase proof
I hereby claim:
* I am cleverdevil on github.
* I am cleverdevil (https://keybase.io/cleverdevil) on keybase.
* I have a public key whose fingerprint is C756 2813 F881 06E2 6F1F 547B 003F 530D 3859 B702
To claim this, I am signing this object:
@cleverdevil
cleverdevil / lockwatcher.py
Last active August 29, 2015 14:14
Script to lock your Mac via the screensaver when you unplug your iPhone
#!/usr/bin/env python
import subprocess
import threading
import time
class Scanner():
def __init__(self):
self.stop = threading.Event()
@cleverdevil
cleverdevil / haproxy.cfg
Created February 6, 2015 17:42
HAProxy index rewrite for DHO
global
log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
maxconn 4096
tune.ssl.default-dh-param 2048
user haproxy
group haproxy
daemon
@cleverdevil
cleverdevil / h-review.html
Created August 20, 2015 16:11
Sample h-review microformat for comment
<article class="h-review known-review">
<h2 class="p-name">
<a class="u-url" href="http://cleverdevil.io/2015/blood-rites">
<span class="p-category">Book</span> Review: Blood Rites, by Jim Butcher
</a>
</h2>
<div class="p-item h-product">
<h4 class="p-name">
<a class="u-url" href="https://www.goodreads.com/book/show/99383.Blood_Rites">Blood Rites</a>
@cleverdevil
cleverdevil / main.py
Last active August 4, 2017 23:27
Scripts for updating 🐷🔥.ws
import stoker
import micropub
import time
MICROPUB_ENDPOINT = 'https://xn--cp8h2o.ws/micropub/endpoint'
INDIEAUTH_TOKEN = 'REDACTED'
SYNDICATE_TO = 'twitter::JonsHotMeat'
s = stoker.Stoker('bbq.lacour.local', timeout=120)
@cleverdevil
cleverdevil / html5-video.sh
Created August 21, 2017 16:21
Convert an arbitrary video to HTML5 compatible formats and output the HTML needed to embed the video
#!/bin/sh
ffmpeg -i $1 -b:v 1500k -vcodec libx264 -g 30 html5-$1.mp4 &>/dev/null
ffmpeg -i $1 -b:v 1500k -vcodec libvpx -acodec libvorbis -ab 160000 -f webm -g 30 html5-$1.webm &>/dev/null
ffmpeg -i $1 -b:v 1500k -vcodec libtheora -acodec libvorbis -ab 160000 -g 30 html5-$1.ogv &>/dev/null
echo "<video controls>"
echo " <source src=\"html5-$1.mp4\" type=\"video/mp4\">"
echo " <source src=\"html5-$1.webm\" type=\"video/webm\">"
echo " <source src=\"html5-$1.ogg\" type=\"video/ogg\">"
@cleverdevil
cleverdevil / transform.py
Last active March 6, 2018 00:54
Transform Facebook JSON exports to MF2 JSON
#!/usr/bin/env python
'''
Usage:
./transform <path-to-facebook-export.json>
This will transform everything using granary and then place
individual files into a directory called "mf2."
@cleverdevil
cleverdevil / publish.py
Last active March 6, 2018 00:54
Import MF2 JSON selectively
#!/usr/bin/env python
'''
A script for quickly publishing MF2 content to a Micropub endpoint. To use this
script, first ensure that you have installed:
requests
You will also need to set the following environment variables: