(I guess, then this is also what test cases are for...)
368 karma · joined November 12, 2009
https://www.tomn.co.uk/
https://github.com/tomjnixon
(I guess, then this is also what test cases are for...)
I'm sure it's legitimate, but you'd have to be insane to look at that code and not question why it exists.
I think on the last run we got about 2/3 of the way through; we should be able to do the whole thing if i ever get round to running it again.
I wish I'd found diesel before twisted; it seems a lot more elegant if you don't need any of the built-in protocols. The twisted model is good, there's just too much of it.
This type of thing has a few nice properties -- you can easily register more than one callback, as well as using them as a pipeline (kind-of like monads in haskell), which are awkward to implement with callbacks.
As an aside, in python you can trick generators into turning synchronous-looking code into asynchronous, which can actually make things look a lot neater if done properly -- i'll provide code if anyone's interested.
About a year ago we designed a system/protocol called 'SHET' (https://github.com/18sg/SHET) which consists of a central server that links many clients together. Each client can present many properties (get/set), actions (like methods, that can be called), and events (that other clients can listen for). This was implemented by me in python/twisted and makes controlling/monitoring computers around the house really easy.
About a month ago, someone wrote a system called SHETSource (https://github.com/18sg/SHETSource) which allows us to easily connect arduinos onto SHET. Since we don't all leave our computers on all the time, we have one arduino connected to the 'server' (old macbook) near the switch, which arduinos in our rooms connect to via the spare wires in the ethernet (if you only want 100Mbps, two of the wires are spare).
In my room at least, I have a pir, 3 hacked light controllers, a servo and two switches connected via SHETSource, which allows me to write all the logic in python.
Basically, we've written a hacking framework.