Rust
cargo install cargo-edit
cargo add $dependency
Rust
cargo install cargo-edit
cargo add $dependency
Short script used:
import requests
import yaml
import json
import glob
import os
import datetime
class TokenAuth( requests.auth.AuthBase ):
def __init__( self, token ):
self.token = token
def __call__( self, r ):
r.headers[ 'Authorization' ] = "Token %s" % self.token
r.headers[ 'Content-Type' ] = "application/json"
r.headers[ 'Accept-Encoding' ] = "application/json"
return r
authdata = { "alias": "XXXXXXXX", "pass": "XXXXXXXXXXXXXXXX" }
authresp = requests.post( "https://blog.maz.nu/api/auth/login", json = authdata ).json()
auth = TokenAuth( authresp[ 'data' ][ 'access_token' ] )
for post in glob.glob( "content/blog/*/*/*.md" ):
if os.path.basename( post ) == "index.md":
continue
bits = open( post, 'r' ).read().split( "\n---\n" )
body = bits[ -1 ].strip()
if not body:
continue
try:
meta = yaml.load( bits[ -2 ] )
except:
meta = {}
created = meta.get( '$dates', {} ).get( 'published', datetime.datetime.now() )
data = { "body": body,
"title": meta.get( '$title', meta.get( '$path', '' ).replace( "/", " " ) ),
# "created": created.strftime( "%Y-%m-%dT%H:%M:%SZ" ),
"font": "serif",
"lang": "en",
}
resp = requests.post( "https://blog.maz.nu/api/posts", json = data, auth = auth ).json()
print( "UPDATE posts SET collection_id=1, slug='%s', created='%s', updated='%s' WHERE id='%s';" % ( meta[ '$path' ][ 6: ], created.strftime( "%Y-%m-%d %H:%M:%S" ), created.strftime( "%Y-%m-%d %H:%M:%S" ), resp[ 'data' ][ 'id' ] ) )
I wanted to join the crazy work of home automation (which currently has the buzzword-compliant marketing name of "Internet of Things"). So I picked up some cheap radio-controlled sockets from Maplin and some 433MHz transmitters.
Wiring was straightforward: 3.3V to VCC, ground to ground, and a GPIO pin to data.
A bit of soundcard-oscilloscope sniffing and I soon knew all the possible codes that the remote control could send. Codes below are all to turn on (off is final bit replaced by 0). The "channel" is set on the socket and remote to be I-IV. The "device" is the button on the remote (set on the socket), and is 1-4.
I/1 101010001010101010101 I/2 101010100010101010101 I/3 101010101000101010101 I/4 101010101010001010101 II/1 10001010001010101010101 II/2 10001010100010101010101 II/3 10001010101000101010101 II/4 10001010101010001010101 III/1 10100010001010101010101 III/2 10100010100010101010101 III/3 10100010101000101010101 III/4 10100010101010001010101 IV/1 10101000001010101010101 IV/2 10101000100010101010101 IV/3 10101000101000101010101 IV/4 10101000101010001010101
Which meant all I needed was a small bit of Python code to send the appropriate signals:
#!/usr/bin/python import RPi.GPIO as GPIO import sys import time BITLENGTH = 0.00172275 ZERO = ( 0.000477, BITLENGTH - 0.000477 ) ONE = ( 0.001357, BITLENGTH - 0.001357 ) FUDGE = 0.00005 GAP = 0.01209725 channel = int( sys.argv[ 1 ] ) GPIO.setmode( GPIO.BCM ) GPIO.setup( channel, GPIO.OUT ) for i in range( 10 ): for ch in sys.argv[ 2 ]: if ch == '0': GPIO.output( channel, 1 ) time.sleep( ZERO[ 0 ] - FUDGE ) GPIO.output( channel, 0 ) time.sleep( ZERO[ 1 ] - FUDGE ) elif ch == '1': GPIO.output( channel, 1 ) time.sleep( ONE[ 0 ] - FUDGE ) GPIO.output( channel, 0 ) time.sleep( ONE[ 1 ] - FUDGE ) time.sleep( GAP - FUDGE )
My style of photography has changed over the last few years. I used to think my skills lay in architecture or landscapes, but actually it seems that I have an affinity for portrayal of people. This isn't so surprising given the role I tend to fill for my close friends; and so my photography tends to be people, events and a smattering of art/nude.
I aim to continue these themes, and develop them further, in 2013.
I have a fairly long list of themes and shoot ideas, and these exist to serve as inspiration. The more abstract goals are also listed here.
Formats:
Skills:
Themes:
In my retrospective on 2012 I borrowed a template to prompt me to look back on the year. I don't usually analyse my year in quite such a structured and public way, preferring to do this continuously and more privately. However, this time it fit in fairly neatly with my annual “photography review” and served a useful exercise of self-reflection.
The biggest difference between 2011 and 2012 was the increase in the amount of work I had, the variety of work, and the fun I had with it. 2011 had a number of projects which were delayed or cancelled which caused problems for planning cashflow (namely: when cancelled, there was no incoming cash to flow). 2012 felt cautiously better, not quite on a par with 2008/2009, but at no point was I cursing my “luck” at accepting the “wrong” piece of work. But ignoring money issues — which while important for business viability, they are not the primary reward I get from my work — the variety of work was good. Variety in my work is essential, and must be maintained.
The pace of my work was, at times, frantic: the last quarter, juggling a large number of projects, and my time in Russia. While I relish these very productive periods, sustaining long hours for seven days per week for months on end is detrimental to my health and my sanity. Be prepared to work fast, but I must take breaks.
While the rest of my time — not working — has mostly been social, I have felt quite alone for much of the year. Partly this is because of the role I seem to find myself in with my friends: the “counsellor”. As an active listener, I find myself hearing other people's problems as they open up to me. I need some active listening too, some people to open up to and become close to. I sometimes describe this as needing an equality of “flow” in my friendships/relationships; that being the counsellor can feel “unidirectional” at times where they emotionally unload and I emotionally and intellectually process. Some years ago I learned the lesson that “spending time together” is not sufficient basis for a relationship, but I learned this year the more precise lesson that I must spend time with people in a way that achieves balance.
My attitudes towards relationships remains mostly unchanged: friendships or relationships or whatever labels you wish to attach to them are vital to my being. Lacking what I will term to be “sufficiently intimate” relationships (affectionate, sexual or otherwise) is definitely something which has been on my mind this last year. I dabbled with and abandoned Internet dating. I did ask out a few people, but clearly they were the wrong people to ask. I did feel, however, that I didn't put a huge amount of effort into this part of my life. I am inclined to use the excuse “I was working too much” but I believe there was also an element of my own nervousness. My last serious relationship did cause me a significant amount of hurt, much of it from what I perceived to be judgmental attitudes of my partner when I “opened up”. While I was able to express how I had been hurt at the time to that partner, their reaction must have stuck with me for a while. I think that now, having identified the main reasons behind my hesitation, moving into a new relationship will be much easier; that it is now my behaviour (rather than my reaction to my past) which needs to change. To this end I will continue to remember: Don't ask? Don't get.
Politics in 2010/2011 has disappointed me, and drive and passion for activism of any sort has been pretty much crushed out of me by some personal events. I fear this will take longer to return than I expected, but will focus my energies elsewhere in the meantime.
I have written, played, recorded and discovered new music far too little this last year. 2013 needs to see me discovering and listening to new music far more. A few nights towards the end of 2012, when I needed to clear my head of the self-destructive thoughts which were going through it, were spend in semi-meditative listening to music. This is how I used to listen to new music. This is what I need to rediscover.
Writing, playing and recording my own music — in collaboration with my musical co-conspirator — wants new life breathing into it. To help this, Rebecca's birthday/Christmas gift was Reason Essentials. We hopefully can work together more easily this way. I need to experiment with sounds, guitars and keyboards more.
My photography in 2011 exploded in every direction. 2012 took a more measured approach, partly because I was spending more time working, but also partly because I was gathering my thoughts. The Roger Ballen masterclass I attended was hugely influential in seeding this kind of self-examination, and a longer discussion of my photography ambitions merits its own blog post.
I will declutter. I will reclaim my office at home. I shall reconsider the use of space in the upstairs of my home.
I will work harder at losing weight, particularly the extra inches that I do not need around my waistline. I have a qualitative goal I wish to reach, rather than a weight- or percentage-body-fat-based one. I have already identified the reward for achieving the goal, and it excites me.
For my friends, I will continue to be there whenever I can should they need me, whether that is as a shoulder to cry on, someone to share happier times with, a spare room to stay in, or a spare room to store furniture in. Be excellent to each other.
Back in 2011 I set myself a list of goals for my photography. It has been two years now, and the goalposts have obviously moved as I have strived to reach them. How well do I feel I have done?
So what else happened this year? 2012 was the year that:
xen-create-image
stopping quagga on the host machine. That was not fun.-----BEGIN PGP PUBLIC KEY BLOCK----- Version: GnuPG/MacGPG2 v2.0.18 (Darwin) Comment: GPGTools - http://gpgtools.org mQENBFDYQ9EBCADfYeEK1b0O6VWtGdFS4/wd5I24xurHW1dfFH9CKjoxunN0cP7l wrx+YxnTCASKK+oNS2eFGefpTU9r+l4MzlyhfakP2KLg3Tl59jpz5OXRs4y1CHrm PSFbjxshsQ1UDQbHIarkrpuqBqCUNIU+BrNeDZDRURDCbkxSvKL62mTDDq/wYAzV +xzMTC0K45itNtaWusm7a3qWllyIfQBMNwBo4wxLfB3e72igz+aPUwCkEXKr50cd jJA+VTtCWCBdhY+Vy8Etht79R6P0LqBKCMSvSvSC414EA+l1V3S8xG+aOxRX/kwU kzNgOrZ+isQZBbeIfOBzzoKcgXPezzfBQum/ABEBAAG0NU1hcmVrIElzYWxza2kg KDIwMTMgR2VuZXJhbCBVc2UpIDxwZ3BrZXkuMjAxM0BtYXoubnU+iQE/BBMBCgAp BQJQ2EPRAhsDBQkCJcGABwsJCAcD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ofVAt8IrIm NGpJFVmYIFGfJ+9VK07MSRJh1zL8iYsYs+wZ7KwLRgWeNQ7nmfCyn5xNM+A11qlx DnRdSytKABoErQVxFe7GvmINTDiq532BIjn8k/EAU76yibn5ebB++rBe3KrvN5AD GaFznN6ePSxNdCSgEjxpZ6QKma6rFOWt+CetABEBAAGJASUEGAEKAA8FAlDYQ9EC GwwFCQIlwYAACgkQ9ltNqwmwoXiGJwf+NAqEALTKzY8SZ9dcv1djNgP6eUR1Y1o0 dv4TOwLEWDFQeRmJkJwGlPlx4u43QRtbpWoJCQr0D3dLxt0CbpTeN+enhmWJWKdw /VH6FJXl7w91WURF6QHrYJ5JqHA9gb4wca+i7ZGYTMqoaU8WOa2RYqNYEXvATBU/ z6V6zumD5XsVlcL1cWuRlq+v2dkmmN+d9vLjscZ5fw5Rq3WPBgBzbgy8MwTDZ+zt WEO39qHaSzbGm8Km9Wh+2XLWYt+SHhRehpLA1jF98otmiWuUXFx8zg1tN2xk7EAt RmJTCVXIrIxU/sRzvv6zLYAikXUhSu0HsvM4PkWzqbm8c7iRiOYFcw== =smRB -----END PGP PUBLIC KEY BLOCK-----
Once in a Lifetime – Wolfsheim Dead Stars – Covenant Genesis – VNV Nation Eclipse – Apoptygma Berzerk This Corrosion – The Sisters of Mercy Du Hast – Rammstein The Hand That Feeds – Nine Inch Nails Bring Me to Life – Evanescence The Passenger – Iggy Pop Deliverance – The Mission It's a Sin – Pet Shop Boys Ship of Fools – Erasure A View to a Kill – Duran Duran
Chrome (SITD remix) – VNV Nation Desire – Dreams Divide Deep Waters (Consumer Junk remix) – Grendel Jump – Van Halen Ghostbusters – Ray Parker, Jr. Magic Dance (from Labyrinth) – David Bowie Happy Birthday – The Birthday Massacre Stand and Deliver – Adam and the Ants Swing Low – Russell Watson
Honour — VNV Nation Creepy Crawler — Zombie Girl Love Never Dies — Apoptygma Berzerk ® Dead Enough for Life — Icon of Coil Bullet — Covenant Nobody Likes You (When You're Dead) — Zombina and the Skeletones ® Island of Zombie Women — The Horatii ® Blood of Another — Paradise Lost Zombie — The Cranberries Cemetery Gates — Pantera Zombie Prostitute — Voltaire