Skip to content

Instantly share code, notes, and snippets.

View cleverdevil's full-sized avatar

Jonathan LaCour cleverdevil

View GitHub Profile
@cleverdevil
cleverdevil / rings.php
Created February 13, 2019 18:49
Quick and dirty activity rings clone in SVG
<!-- thanks to https://codepen.io/webslingerm/pen/GXxxVx -->
<?php
$move = $_GET["move"] ? $_GET["move"] : 0;
$exercise = $_GET["exercise"] ? $_GET["exercise"] : 0;
$stand = $_GET["stand"] ? $_GET["stand"] : 0;
?>
<style type="text/css">
@-webkit-keyframes RingProgress {
@cleverdevil
cleverdevil / overcast-recently-played.py
Last active March 4, 2024 09:28
Fetch recently played episodes from Overcast.fm. Then, publish history to my website.
'''
You'll need to pip install some dependencies:
* python-dateutil
* requests
Also, populate your EMAIL and PASSWORD below.
'''
from xml.etree import ElementTree
@cleverdevil
cleverdevil / traktpub.py
Created January 6, 2019 01:20
Quick script to publish my Trakt history to my website
from dateutil.tz import UTC
from dateutil.parser import parse
from datetime import datetime
import conf
import json
import os
import feedparser
import requests
@cleverdevil
cleverdevil / upload-insta.py
Created March 5, 2018 01:38
Upload my directory full of instagram photos to my website, using granary to look up the metadata
#!/usr/bin/env python
import os
import sys
import requests
base_url = 'https://granary.io/instagram/cleverdevil/@self/@app/%s'
query_args = {
'format': 'mf2-json',
@cleverdevil
cleverdevil / process_albums.py
Created March 5, 2018 01:20
Process fb-export album data, upload the photos to a Micropub media endpoint, and export MF2-JSON data for posts
#!/usr/bin/env python
'''
Conditionally upload all of the photos from an exported Facebook album to a
Micropub-compatible website with a media endpoint, and dump MF2-JSON data
that can later be published to the same Micropub website.
'''
import json
import sys
@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:
@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 / init.lua
Created December 14, 2017 18:05
Current hammerspoon configuration
-- -----------------
-- Setup environment
-- -----------------
-- Animation off, mofo
hs.window.animationDuration = 0
-- Get list of screens and refresh that list whenever screens are (un)plugged
local screens = hs.screen.allScreens()
local screenwatcher = hs.screen.watcher.new(function()
@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 / 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)