Friday 27th April, 2018
Show and Tell 41
He showed us how to use the Line-us drawing app to control the robot before explaining how he’s been reverse engineering it to allow him to control it programmatically.
Tom used DNS Service Discovery (DNS-SD) to find the device listening on port 1337 and then used Wireshark to inspect the traffic to and from the robot. Inspecting the traffic revealed some kind of heartbeat message being sent once per second as well as other messages that more obviously control the movement of the robot. At some point Tom realised these commands were all part of G-code, although not before he’d spent a while manually working out what they were doing.
Tom’s used what he learnt to write a multithreaded Ruby client that allows him to regularly send the heartbeat as well as the other commands he needs to control the arm. He demonstrated this working by instructing the arm to draw a Hilbert Curve.
I’m not sure I can necessarily think of a reason to own a Line-us but I was nevertheless impressed by Tom’s reverse engineering skills that allow him to control it programmatically.
Chris Z explained that he’s been doing quite a few crosswords recently. Particularly on the Guardian. He often asks his partner for help with some of the clues and wondered whether it’d be possible to build something to allow them both to play at the same time.
He discovered that the data for the Guardian crosswords (including the answers!) is stored as JSON in the page. The image is created as an SVG and the whole thing is a React component.
Chris found the source in the Guardian’s frontend repository on GitHub and managed to get it running on Heroku. He’s modified the React app to use websockets to allow multiple people to use it at the same time. He demonstrated this by having a number of us answering clues at the same time.
He’s keen to share the project more widely but’s concerned that he might be violating the Guardian’s terms of service.
Generating random data
I spoke about using Automator to generate data to help with manual testing during our asset manager work at GDS. I’d often find myself using the admin interface to create objects in the system and wanted a way of generating names for the things I was creating.
I started by sequentially numbering the things I was creating (e.g. “thing-1”, “thing-2”, “thing-n”) but it soon becomes hard to remember which number I was up to. I moved on to using timestamps (e.g. “2018-04-24 113700”, “2018-04-24 113730”) which were a bit better because I didn’t have to remember anything but were still a bit problematic because they’re hard to distinguish when you have a number of them.
In the end, I used a combination of a timestamp and a random word from the words file on my Mac. This naming convention has the advantage of conveying when the thing was created and of having a unique name that makes it easy to recognise in the short term.
James A explained the difficulty he’s having in trying to reliably parse emails for some mailing list software he’s been working on. It might sound as though it should be a solved problem but it seems that even hosted services (e.g. Mailgun and Mailchimp) do it slightly differently and therefore it’s not completely obvious that you’d use such a service instead of writing something to parse them.
James A gave us a bit of an intro to Spacemacs. He’s switched editors a few times over the years and this is the first time in a while that he’s had some enthusiasm for one of them.
James explained that the extensive documentation and easily discoverable commands make it very easy to get started with. And that if you can see the value in Vim but have struggled to use it effectively then you might want to give Spacemacs a try.
He demonstrated the magit git package that provides git integration in the editor and briefly showed us his custom command/script that allows him to run
rails test from within the editor.
Bash showed us the React karaoke app he’s building. It’s similar in style to early versions of iTunes in that it allows you to filter by Era, Genre, Artist and Song to help find the music you’re interested in. I’m not really up on the current state of karaoke but if it’s still common practice to flick through a book of hundreds of songs then I can imagine this being much easier to use.
Bash is building the app to help him learn React and to, ultimately, help him get to better karaoke parties :-)