I have started using Ansible to manage the few services that I still have running around here. I want to deploy clortho to a user on the system I use for serving up movies to my Roku players. I need to copy the source, setup a venv with the dependencies (aiohttp), and setup a systemd unit to make sure it is started at boot time. As of Python 3.3 the core library includes support for venv, and Python 3.
clortho is a very simple key/value server written using python 3.4 and aiohttp key namespace is per-client IP address, and there is no authentication. It supports direct connections from clients, and the X-Forwarded-For header for use with proxies. I shouldn't have to mention that running this on an open network isn't a good idea. Get a key value by requesting http://server/keystore/<key>: curl http://server/keystore/louis If the key has been set it will return a 200 status with the value.
Automatic backups are important, especially when it comes to irreplaceable data like family photos. I have used s3cmd to maintain my website's static files for a while now, and it was simple to use it to push my 100GB+ archive of photos over to S3. But I needed an automated way to update it with any new photos that my wife or I may take. The sync protocol really isn't what you want – there should be no need to re-examine all the files that have already been archived.
The temperature sensors that I use to drive the freezer graph are in my garage, which doesn't have an easy way to run wires to the server room. I have a WRT54GL running DD-WRT configured as a bridge to the rest of my network. The problem with this is that the connection isn't always reliable. I used to have a simple script that read the temps and fed them to my main mysql server, but the connection would frequently drop and it would lose the temperature data.
Movie Landmarks is back online. I think this is the 5th iteration of the project that I originally started back in 2006. It started out as a PHP app, morphed into a python wsgi application. It was always backed by a mysql db with lots of interactive features. For this redesign I've dropped all of that extra stuff and simplified things. I threw out the database and replaced it with a couple of python dictionaries holding the landmark information and another with the movie data.
I use mutt as my email client. Something that has recently been bugging me is that when reading a message it displays the original Date: header with the sender's timezone. Since I work with people in several different zones I am constantly having to do timezone math when looking at these. So I decided to fix that with a bit of python. One of mutt's features is that you can feed every email you view through a filter by using the display_filter setting.
Requires python-tiny package on Fedora. Cleans up the HTML, preventing broken elements from spilling over into adjacent postings. Code was lifted from feedparser.py and dropped into a plugin for rawdog since I couldn't find an easy way to get mx.Tiny installed. # rawdog plugin to tidy up html output using python-tidy module # Brian C. Lane <firstname.lastname@example.org> # from tidy import parseString import rawdoglib.plugins, re def tidy_html(config, box, baseurl, inline): data = box.
Tonight I finished adding delete handlers and a delete confirmation dialog to HMS. This is probably the state that the code will be in for my LFNW presentation next Saturday.
Newseum archives the front pages of of over 500 newspapers from all around the world. If you know the ID of the papers you want to see you can use this simple Python program to download the jpg of the papers' front page to your local system. Edit the CITIES list to set the IDs of the papers to be grabbed. #!/usr/bin/env python """ Quick Newseum Frontpage Grabber script Copyright 2009 by Brian C.
Hygrosens manufactures a number of sensors for measuring temperature, humidity, light level, pressure. Their devices use a common serial data format for a wide variety of sensors, include 1-wire sensors from Dallas. This library reads the output from Hygrosens devices and passes it to a calling function as a hash. I have included an example that outputs the readings in human readable format, and another that stores the readings into a MySQL database.