Skip to content

Instantly share code, notes, and snippets.

View cleverdevil's full-sized avatar

Jonathan LaCour cleverdevil

View GitHub Profile
@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 / 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 / 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 / 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()
### 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 / 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
@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'"

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 / 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
---