Number of entries: 20
Metaphor of the year, by Ev Williams
Posted on 2017-05-23 19:12:44
Posted on 2017-05-23 16:15:00
(Source: Flickr) This past May was my second attendance at the Perl Toolchain Summit, and I hope I aptly justified my presence this time around. I had a long list of topics to work on, but as usual, I...
Posted on 2017-05-23 14:58:51


Can we survive curiosity?

Posted on 2017-05-23 10:00:36
Posted on 2017-05-23 03:22:10
Posted on 2017-05-22 19:51:00

For a while now, on and off, I’ve been looking for a way to live track my location and hook it into my home automation setup. This is a difficult task to achieve when you care about your privacy. I am not interested in giving another third party a history of my movements; it’s bad enough that my cell provider gets this information due to my need to connect to cell towers. I don’t care if your privacy policy tells me you wont share my information and your CEO tells me you “take security very seriously”. That wont help me when you get hacked or decide to change your privacy policy.

Anyway, I’ve finally found a solution which fits my needs perfectly. In fact, it comfortably exceeds my requirements by virtue of being open source. The application I’m talking about is OwnTracks (source). It comes in both Android and iOS flavours, and it allows you (in fact, encourages you) to use your own server.

The server can be either a HTTP service, or preferably an MQTT service. Despite my initial desire to go the HTTP route, I heeded the advice in the OwnTracks documentation and looked into MQTT (not being something I’d heard of before), and I’m glad I did. With a quick “apt-get install mosquitto mosquitto-clients” and a few minutes of reading documentation, I had an MQTT server installed and configured.

I believe the behaviour is different for iOS devices, but on Android devices at least, OwnTracks connects to your MQTT server, and publishes location updates as blobs of JSON. You can connect up other MQTT clients to that server and listen out for those events. I use the excellent NodeJS “mqtt“ package to do exactly this. You can also configure authentication and ACLs to control which users have access to which locations, meaning that you can optionally share location data with other friends who connect to your MQTT server. The OwnTracks app displays the locations of everyone you can see, on a map. And if your friends don’t want to connect to your MQTT server? They can connect to their own, and you can bridge them together!

Battery life? OwnTracks seems to work hard to not work hard. OwnTracks asks your device to notify it only when it’s in motion, or when you’ve entered or left a user defined waypoint. When you’re in motion, it will publish location updates to the server according to user defined time periods and distances travelled.

There was one issue with the above algorithm. If your phone is stationary for a long period of time, you don’t get updates (I believe the iOS version can be set to send on an interval). So when your last published location was 12 hours ago, you don’t know if you haven’t received any updates because you haven’t moved, or because your phone ran out of battery/network access. To deal with this, I enabled “Remote commands” in the OwnTracks interface, and set up a job on my server to run the following command every 30 minutes:

mosquitto_pub -u YourUsername -P YourPassword -t 'owntracks/mike/phone/cmd' -m '{"_type":"cmd","action":"reportLocation"}'

OwnTracks not only publishes to the MQTT server, but it subscribes to “topics” on it too, so when it sees a “reportLocation” request. It knows that it should immediately report it’s location. This means I get updates at least every half an hour regardless of whether or not I’ve moved.

And if there is no network access? OwnTracks batches up the location changes and publishes them once network access is available again.

Don’t have a static IP to stick an MQTT server on? You have a permanently running machine, but it’s behind a weird NAT setup that you can’t get around? If you have an Android phone, fear not, you can run your MQTT server behind a Tor Hidden Service, install Orbot on your device, configure Orbot to force all traffic from OwnTracks through Tor, and configure OwnTracks to talk to your hidden service hostname. How do I know that this works? Because that’s exactly what I’m doing. This has the added benefit that anybody monitoring your servers network (your ISP or hosting provider), wont be able to track your movements from IP to IP due to your regular MQTT traffic.

And to top it all, the documentation is excellent: detailed, but not dumbed down; and the developers are quick to respond to issues on Github.

Wiring the IoT MQTT Essentials - A Lightweight IoT Protocol

Posted on 2017-05-22 19:41:30
As I mentioned in my previous post, I'll be giving a free public lecture this week in Olso. It will be my "400 Years of Perl 6" talk, and will be held at Kulturhuset, Youngs gate 6, Oslo at 6pm...
Posted on 2017-05-22 15:58:20


How to talk to conservatives about alternative energy and the environment.

Posted on 2017-05-22 10:00:24
Hey everyone, Following is the p5p (Perl 5 Porters) mailing list summary for the past week. Enjoy!...
Posted on 2017-05-22 09:56:23

I have recently been working on honing a lot of my tools, and a coworker, Andrew Ruder, mentioned using Denite.nvim for selecting more than simple directories. I decided to investigate using it instead of builtin file selection mechanisms. I was surprised at the result.

Posted on 2017-05-22 08:04:06
osascript で呼ぶのがいいかな。apple script の escape 方法はよくわからないので JavaScript で書くことにして、 JSON で serialize して渡すのが良さそう。 ``` fun sendNotification(message: String, title: String=message, subtitle: String=message, soundName: String = "Frog") { // https://developer.apple.com/library/content/documentation/LanguagesUtilities/Conceptual/MacAutomationScriptingGuide/DisplayNotifications.html val params = jsonObject( "withTitle" to title, "subtitle" to subtitle, "soundName" to soundName ) Runtime.getRuntime().exec(arrayOf( "osascript", "-l", "JavaScript", "-e", """var app = Application.currentApplication(); app.includeStandardAdditions = true app.displayNotification(${message.toJson()}, $params)""" )) } ``` JSON serialize は kotoson が便利。 ``` compile 'com.github.salomonbrys.kotson:kotson:2.5.0' ``` で、こういうのちょっと頑張って書いてみたけど、LINE Notify 使うのが便利っぽいって話になった。。
Posted on 2017-05-22 04:18:26
For the second year, I have had the great privilege of attending the Perl Toolchain Summit (PTS, formerly called the QA Hackathon QAH). This year it was held in Lyon, France, and three cheers for the organizers; it was an...
Posted on 2017-05-22 03:29:58
Perl Toolchain Summit Lyon, France, May 11-14 2017 This year I was invited to the Perl Toolchain Summit in Lyon, formerly known as the Perl QA Hackathon. I had organized this event two years ago in Berlin. Having been "only"...
Posted on 2017-05-21 19:52:50
Posted on 2017-05-21 18:09:00
Posted on 2017-05-21 17:57:00
Posted on 2017-05-21 17:53:00
This was my 5th year of being invited to participate in the Perl Tool Chain Summit (formerly Perl QA Hackathon). It was a real pleasure to be invited to a rebranded version of the same helpful event. For the second...
Posted on 2017-05-21 16:33:36
This was my 5th year of being invited to participate in the Perl Tool Chain Summit (formerly Perl QA Hackathon). It was a real pleasure to be invited to a rebranded version of the same helpful event. For the second year in a row, MetaCPAN was well represented at the event. This is important because […]
Posted on 2017-05-21 16:31:49
Posted on 2017-05-21 10:00:23
Last updated: Tue May 23 20:12:53 2017