This post is about a command line tool called pdftilecut which I wrote
a while ago that allows you to cut PDF pages into tiles in order to
print a large page on small form printers for instance.
A little background: for my wedding, we decided to make an art piece we
called “the portal”. It was basically a steam punk spaceship door with
I was in charge of making a functional iris window with a
computer screen on the back which displayed pre-recorded videos created
by SpaceEngine space simulation
The entire door was made of paper backed foam and had to be cut
by hand. The intricate design of the iris window meant drawing the
outline by hand was out of question. Looking around, the cheapest option
seemed to be printing sections of the entire design and stitch them
together. To my surprise, I could not find any program to do this to my
satisfaction. And so I set out to make my own and thus pdftilecut was
binaries are available for linux only at the moment but
nothing should stop you from compiling for other platforms.
TL;DR My personal set of essential electronics tools that I use on
regular basis. This is the first post in a series.
I’ve been dabbling in electronics for 10 years. Naturally, my approach
to electronics has been influenced by my approach to life in general.
And my approach to life is that of a pragmalist (pragmatist minimalist).
In short, I thrive in striking a balance between practicality and fewer
possessions. This has led to a carefully selected set of tools, over
years of use and through many iterative refinements. The aim of this
post is to presgruide (half prescribe, half guide) a set of tools to
newcomers in the wonderful world of electronics, so they can get rock ‘n
rollin’. More experienced folks can also benefit by multigrading their
No such thing as a safe hobby exists. Even reading books can be
hazardous over time (think neck and eye strain). Therefore safety
equipment come first in order to maximize the longevity of your
I don’t watch mainstream news but once in a while I come across some and
piece I encountered was actually thought-provoking. Some viewers of
a talk show hosting Denise Richards noticed she had enlarged thyroid
gland and let her know that she should see a Dr. In this case, she had
ignored the symptoms and looking at the photos, it’s quite obvious. But
what about more subtle visual presentations of health conditions?
Attentive doctors and specificalists may suspect or detect them watching
a talk show, but that’s too few eyeballs. What if computers did the
Google AI research has had years of
history developing machine learning
systems to detect various health conditions from medical imagery. I
believe they started with retina scans looking for early signs of
diabetes and more recently, they can detect skin conditions. Microsoft
sports a similar
history of research and publications. There is other
research around detecting genetic conditions from portrait photos in
combination with other data. I also remember some app which could detect
cataract in photos with flash on. I’m sure much more has been explored
in this area.
With the promise of ever improving machine learning in detecting
patterns in imagery, specifically relating to health conditions, there
are some interesting end-user product and service ideas that can
potentially be game changing.
For instance, Google Photos or iCloud can run a bunch of more ML on user
photos and videos and notify the user of neurological conditions, eye
and skin conditions, strokes, mental health conditions, etc. Similarly,
face unlock hardware such as those in iPhones and iPads could detect
such conditions everytime the user looks at their phone (which is much
more often than taking photos). And let’s not forget about the immense
amount of public imagery content such as YouTube. Google already does
copyright checks, transcription, thumbnail generation and a whole bunch
of other processing. Disease detection will take it to a whole new
Apple has already invested quite a bit in health features of Apple
Watch. It makes a lot of sense to expand that further.
Of course there are social aspects that I’ve not mentioned. Privacy,
fake content, etc.
Since USB-C’s introduction, I’ve been consistently interested in
leveraging it for powering everything under 100 watt (or rather under 90
watt, since it’s hard to come by a full 100 watt USB-C power brick). I
finally found time to make the first move and this is the subject of the
I wanted to keep it simple at the start. Chips like the popular
which only provide the wire level handling of the USB-PD protocol, require a lot of software
work to make them reliably operational. And that software will need to
run on a µC which adds to BOM. So I went to search and found a gem called
from STMicroelectronics. In short, you program some registers to chip’s
I2C once which define what voltage range/current you
require and the chip will negotiate those requirements with a charger
connected to it.
My recent experience with Telstra mobile’s DNS resolver constantly
pooping itself, leaving me without working 4G connection on my Pixel 2
Android phone, prompted me to look for solutions. How do I know it was
the DNS resolver issue? Well I got myself a ping tool and found that I
could ping various servers just fine. I did try the Private DNS feature
of Android to no avail. Most of the time it doesn’t do anything!
Unfortunately, Android doesn’t allow manually setting DNS on mobile
connection (only on WiFi and VPN). So the only option I had left was to
look at VPN tunnels. Forget about OpenVPN and IPSEC. For my use case,
they were mind numbingly difficult to setup and I gave up on both very
quickly. Then I remembered WireGuard, a tiny feature of Linux
kernel brewing at the moment, which lets you define an encrypted network
interface with public key cryptography. There is also an app available
for Android. This thing is so simple to setup and so reliable that I
was hooked right off the bat.
I was involved in an incident post-mortem today without realizing it!
But first, a little background.
I lead the Incident Response team at Mathspace and we follow a blameless
post-mortem culture as popularized by SREs. It boils down to not
blaming specific person(s) seemingly responsible for an incident, but
instead acknowledging that incidents are product of failure at team/org
level. We then focus our efforts to pinpoint root cause and ways of
preventing it from happening in the future.
Today’s post-mortem was outside of work! I had just met up with my
partner at a cafe and we were walking home when she told me about her
experience riding her usual bus back from work. The bus doors had barely
finished closing behind her, when the driver stepped on the accelerator
like it was race car. As she had not yet tightened her grip on
the rails, she almost fell to the floor had it not been for assistance
from another passenger on the first row. She was quite upset while
telling the story. In fact, it was such a distressing event for her,
that she took the time to report this driver to the authorities. That
marked the end of her story.
What do you do when you need to expose an HTTP health check endpoint but
the thing you’re health checking isn’t a web server? You
socat it! Here’s a complete example:
nohup socat TCP-LISTEN:8080,reuseaddr,fork,crnl SYSTEM:"
supervisorctl status celery | grep -q RUNNING &&
echo HTTP/1.0 200 OK ||
echo HTTP/1.0 500 Down
" &>/dev/null &
In short, the above will run a web server on port
8080 which will respond with HTTP status code of
200 if celery is running, or
500 otherwise. You can replace
supervisorctl status celery | grep -q RUNNING with any other
command. The exit code of that command determines the web server’s
response. Pretty neat ha!
We make mistakes. In most part of life, mistakes tend to incur cost,
from money, harm to simply time, and due to interaction with the
physical world. In world of software however, where state of things can
be cheaply changed back and forth, with some clever design, mistakes can
be made free of cost. I’ve increasingly noticed more of such design in
products I use and I thought I make a list here:
Mute notifications for next 4 hours. Notifications can sometimes
frustrate the user who is under stress and if the notification settings
stick indefinitely, a temporary annoyance can turn to ignored
messages/emails for days. Google Hangouts, Slack and most messaging apps
have timed mute feature. One place where this is very much needed is on
browsers. Given that browser is a platform, it relieves all the
individual sites from having to implement this functionality. Android is
a good example where this is implemented across the entire OS. It even
goes further and allows marking notifications from certain apps as being
of higher priority which bypass the mute period.