Skip to content

Instantly share code, notes, and snippets.

@vrypan
vrypan / dayone-to-b3.py
Last active December 24, 2015 06:29
Quick'n'dirty script to generate bucket3 posts from DayOne journal entries. Only entries with tag 'blog' will be published, the rest are ignored.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Usage:
dayone-to-b3.py [options]
Options:
-p, --path=<path> top directory of your blog. [default: .]
"""
@vrypan
vrypan / dyndns53.py
Last active August 12, 2021 21:43
Python script to add/update an A record at amazon area53 DNS service, using current IP. (ie, dyndns replacement)
from area53 import route53
from boto.route53.exception import DNSServerError
import requests
import sys
from datetime import datetime
# Modified from https://markcaudill.me/blog/2012/07/dynamic-route53-dns-updating-with-python/
domain = 'domain.tld'
subdomain = 'subdomain_name'
@vrypan
vrypan / gist:4136206
Created November 23, 2012 15:48
smart redirects from 404 pages.
<script>
$.getJSON('/_/js/url_mapper.json', function(data) {
path = location.pathname.split("/") ;
if ( path[1] == "post" ){
id = path[2];
if ( data[id] ) {
$('#msg_en').html("The page you are looking has probably moved to \<a href=\"" + data[id] + "\"\>" + data[id] + "\</a\>.") ;
}
}
});
@vrypan
vrypan / automator.sh
Created February 16, 2012 13:31
use listener.py to trigger scripts when a feed is updated
python listener.py | while read tag feed ; do
echo ">>>" $feed "updated!"
if [[ "$feed" == "http://picks.vrypan.net/rss" ]]; then
... do something here, like reading the new feed items, and post them to a different service.
...
fi
echo "<<<"
done
@vrypan
vrypan / listener.py
Created February 16, 2012 13:17
simple pubsubhubbub listener for superfeedr
import re
import cherrypy
import sys
class Root(object):
@cherrypy.expose
def default(self, **kwargs):
print kwargs
return 'OK'