Skip to content

Instantly share code, notes, and snippets.

@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'