Skip to content

Instantly share code, notes, and snippets.

View cleverdevil's full-sized avatar

Jonathan LaCour cleverdevil

View GitHub Profile
@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 / markdown-to-email
Created January 4, 2014 01:06
markdown-to-email A simple script to send beautifully formatted emails that you write in Markdown. The email will have an HTML payload and a plain-text alternative, so you'll make everyone happy, including yourself.
#!/usr/bin/env python
'''
Send an multipart email with HTML and plain text alternatives. The message
should be constructed as a plain-text file of the following format:
From: Your Name <your@email.com>
To: Recipient One <recipient@to.com>
Subject: Your subject line
---
@cleverdevil
cleverdevil / clear-bucket.py
Created April 20, 2016 16:36
Quick parallelized script to delete all objects in a DreamObjects (S3) bucket
import boto
import sys
import time
from multiprocessing import Process, Queue
from Queue import Empty
class Worker(Process):
def __init__(self, me, q, bucketname):
@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 / contacts.py
Last active May 31, 2022 12:03
Integrate Mac OS X Contacts database with mutt for auto-completion of email addresses
#!/usr/bin/env python
'''
A script to search the Mac OS X Address Book via PyObjC bridge, and
then output the results in a format suitable for integration with
mutt.
Add the following to your `.muttrc`:
set query_command = "~/.mutt/contacts.py '%s'"
@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 / 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 / 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 / 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: