A bit of coding, a byte of the cloud. Learning to code a cheap and cheerful alerting tool in an AWS Lambda function.

Code can do it. You can code. Do it.

Years ago I learned on the job to write little PERL programs and Shell scripts to manipulate data in files submitted by clients who could not deliver their transaction data conformed to a record layout that my employer’s application could ingest. Did I lose you already? I chopped up some stuff to make it work. That’s what I love about code, it can do anything to anything for anything that needs doing with data.

At Tesloop, needs are much more realtime. When one of our vehicles arrives at a location where it is scheduled to pick up or drop off passengers, it’s that moment and the minutes that follow when the driver (pilot) or passenger may need help from the Operations team. Our developers created an SNS topic on AWS that our serverless application (using Kinesis Analytics) posts to when a vehicle enters a custom geofence that we have defined around each location. To give the team a heads up, a Slack post is best. Our driver mobile app also posts to Slack when arriving at locations, but redundancy is good and triggering based on the vehicle data creates some additional benefits. All we needed was a way to make a Slack post for each post to the SNS topic.

Inspired by a post on Medium by Joseph Terranova it seemed trivial to extend his code to extract a vehicle ID number from the data and construct a link to our fleet monitoring dashboard. I did this as a proof of concept, to be improved upon or completely re-architected by our developers later. The immediate goal was simply to alert the Ops team.

Below is the code you can copy-paste into your Lambda function after following Joseph’s instructions for creating your Slack webhook and SNS topic. Don’t forget to replace the values for:

  1. Slack webhook path (line 1)
  2. Slack channel (line 2)
  3. Slack posting username (line 3)
  4. Switch values (line 10-18)
  5. Message template (line 28)

The result for me was nice little notification posts like the one shown below. Done. Did it.

Slack say what?

DIY. Why? Because I broke my nerdboard, of course. How soldering and open source software saved the day, and my nerve damaged hands.

My hands hurt. It’s a surprise given that I do tech work, but not when you consider that I also play bass guitar in two bands (one coincidentally named Static Hands) and I spend many hours a day typing. The impact on my hands got so bad that I was experiencing muscle spasms that immobilized my right thumb. Ouch.

The Kinesis Advantage ergonomic keyboard is like typing on clouds, but the price is steep at $350. At the much appreciated suggestion of my CTO, I picked one up used for $150 used. It’s wonderful. However, this one had a defect. The tilde key was sticking, not the key cap, but inside the switch. Hmmmm….

DIY electronics skills to the rescue! I desoldered the key from the cool, curvy circuit board. Then I needed to re-map the tilde key, because I use the back tick constantly for quoting in Slack posts. An open source, freeware application called Karabiner did the job, after a few puzzling minutes figuring out it’s funny interface.

Should you ever need any key mapping, please please please support the creator of Karabiner with a $10 donation. Many open source software projects survive on donations alone, and they are so very worthy of your support. In the realm of audio, there Audacity, which has saved me more than once… but that’s for another post.

This slideshow requires JavaScript.

 

 

 

 

Musical Mithridatism

“Why do you listen to angry music?” The question caught me off guard, when my mom posed it out of the blue. Why did I? Angst alone would have been an adequate explanation then, I was an angsty teen. Which begs the question; Why do I still listen to angry music now, as a happy adult?

At least one reason is people keep making truly great angry music. Ken ModeHead Wound City, Meat Wave, Retox, and Frameworks have all impressed the hell out of me with recent or upcoming releases. My musical projects aim only to keep such good company. An awful lot of us keep on creating whilst being in a bad way. Why?

Counterintuitively, angry music listeners and angry music makers have always been the nicest people I’ve had the pleasure of meeting. Many friends and coworkers have expressed the same, that a person’s angry music preference (dare I say penchant) and a deeply positive, empathetic personality go hand in hand. Now there’s got to be some common thread among all these lovely hate mongers. I call this phenomenon musical Mithridatism.

Mithridatism is the practice of protecting oneself against a poison by gradually self-administering non-lethal amounts.

From Wikipedia

I first heard of Mithridatism in Naseem Nicholas Taleb’s Antifragile – where he posits that to become a thing that thrives on unexpected shocks, stressors, volatility, and such, one must engage rather than avoid these hazards.

Having a reliable means to release your anger is a beautiful thing… and a beautifying thing.

Taking your poison pills of powdered angst on the regular makes you a little less likely to get angry, and when you inevitably  do still feel your blood boil you have the antidote waiting. Just press play and enjoy the noise. Silently screaming along is almost as satisfying as actually screaming in the faces of your tormentors. And it’s a lot less messy than smashing things.

Finally, listening to and making music aren’t far removed neurologically speaking. In fact, there’s plenty of brain scan evidence showing that when musicians think about music it activates the same regions of the brain as when they play, in spite of the fact they aren’t holding an instrument. I think this extends to non-musician listeners and acting out the aggressions expressed in the music they listen to. As far as your brain is concerned, listening to pissed off music is a similar enough activity to expressing your own pissed-off-ness.

So what’s your favorite anger anthem?