OXBLOG

… because I forget simple little things too soon …

30 Dec

Sincere

Mile range spottable, untoppable, cuddleable bunny
Sing your song at the top of your lung, make my day sunny
Mess up the setup and eat the punch for lunch and you're still funny
Wish the most vicious and it will taste as sweet as honey

2 Dec

I slipped

I slipped
You didn’t catch me, you’re slow in that respect
My nose bled and it painted my lips as would a lipstick
As I rose, the seams of my pants ripped

Red plotted and bare butted by design, it appears
Hysterical laughter where there should be tears
Tendency towards an eternal wobble that no one hears
Wishful optimist without detectable fears

I tripped
You pushed me to my five point hit
Cared not to elaborate on the details yet
My gift to you burnt through its box when shipped

Tending the bar of self promises stocked with non-brewed beers
Deprived of the life raft impulse of shifting gears
Unequipped with the red whistle as drowning nears
Still hopelessly undecided after so many years

23 Nov

Epson DS-40 scanner on Linux

In my recent continuous attempt in getting rid of things bulky and/or replacing them with compact and simpler/multipurpose tools (I collectively refer to all these efforts as “minimalism”), I came across my bulky, but trusty, scanner which is part of a multifunction that I purchased for 20 AUD back in 2009. It had outstanding quality and served me for 7 flipping years and 3500 scans. It still works fine but, you know, it’s big for what it does. So I went and did some research and found Epson DS-40 document scanner. It’s not a flatbed but given its size and capabilities as well as my use cases, I’m OK with the compromise. One little thing though — not easy to get it working on my Archlinux installation.

After few hours of headbanging, I gave up trying to make the seemingly well written official driver and scanner utility to work. While I was busy doing this, I read through some of the code and it turns out the protocol the scanner talks is very straightforward. So I decided to hack together a script to see if I could get an image out of it myself. Lo and behold, it was a piece of cake, in less than 150 lines of python code (this is early code, make sure you get the latest) with PyUSB as the only dependency written in less than half an hour, with the help of the official code and a dump of USB packets between the windows driver and the scanner.

It is true that this script doesn’t handle any but the simplest of errors and that’s OK for now because after a few dozen scans it seems to work fairly robustly. When and if it breaks, I’ll fix it.

I plan to add WiFi setup and scanning capabilities as well as Python 2 compatibility to the script to make it a truly one stop shop. Meanwhile, if someone else gets the official stuff working on Arch and it turns out to be better than what I have, I’ll abandon my script in a flash. Until then, how about some minimalistic scanner driver!

7 Nov

Mail Exchanger (MX) Providers Market Share

I recently read an article that showed Google was the email provider for the majority of the top startups in US (couldn’t find a link — anyone?). This inspired me to find out, on a larger scale, which companies are the top providers of email across the whole Internet. However, what I ended up doing was to gather some stats on Mail Exchanger (MX) providers market share. The difference is subtle but important: an “email provider” offers a complete package where a customer is given an email address, an inbox where incoming emails are stored and a facility to send out emails. On the other hand, an “MX provider” only provides servers to receive emails. For example, they don’t necessarily provide storage (e.g. forward only).

The rest of this post documents how I went about it, the results and some other notes.

17 Oct

difftr — Diff Pentaho KTR files

I’ve been using Pentaho Data Integration (PDI) as part of my various jobs over past few years. PDI is an Extraction+Transformation+Loading (ETL) tool that is often used for purpose of migrating data from one database to another. PDI runs scripts, in KTR format, which are directed graphs of “steps”, each of which manipulates the data rows that passes through them. For instance, an “Add constant” step adds new columns with constant values for all rows passing through it. PDI provides a visual development environment where these steps can be added and connected together as to make a “program” that takes a bunch of row+column data, manipulates them, and then outputs them.

Since KTR files are really just programs, they evolve and it is a good idea to keep track of their evolution using standard version control systems such as git. However, KTRs have an underlying XML format that is not persistent in terms of ordering of various elements, etc. Therefore, utilities such as diff are useless on KTRs. That’s why I decided to make a simple tool that would visually diff any two KTRs.

9 Oct

I see robots everyday

I see robots everyday. Not the ones with metallic arms and hydraulic joints. I see humanoid robots, with flesh, some that I’m even physically attracted to. My favorite amongst them is one that operates behind the counter at the pharmacy down the street of where I used to live.

It has the female form, long hair with very appealing smile and just generally friendly looking. Great design I must say, for interfacing with customers. It has a fairly fundamental software bug though. You see, I walk into the shop and it greets me with “Hi, how are you?”, to which I reply “long day, but ok otherwise, yourself?”. It responds with “Good, thanks”. I walk straight to the aisle where band aids are located. I pick one, and walk back to the counter to pay for it. The whole thing takes less than 10 seconds. As I re-enter the view of this robot, I’m again greeted with “Hi, how are you?”! Meanwhile, I’ve been the only customer in the shop since I entered.

9 Sep

One for the team

Slapped and trapped the print in between
Hovered and suffered behind the seam
Coughed and roughed it up even further
Joined and coined this passage for the team:

Take a break
Make a mistake
Jump in the lake
Fight a snake
Ride an earthquake

Bake a cake
Eat a steak
Give it a shake
For heaven’s sake
Look at what’s at stake
And numb that ache
No matter what it’ll take

8 Sep

Time to bother

You’ve been deceived brother
Learnt the way by way of stutter
Warmed your hands in stale water
Called the wrong person your father

You’ve been brainwashed man
They left you here and ran
Count whatever you have now
Spend it while you still can

10 Apr

Make USB Flash Write Fast Again

I have a 64GB SanDisk Extreme USB flash drive that I use for just about anything. It is a USB 3.0 drive and at the time of purchase, it had the best performance out of all drives in the market.

I can’t remember how fast it was exactly when I first bought it but I remember the read speed was above 200 MB/s and write was above 150 MB/s. But yesterday, a year or so after purchase, I had write speeds of 20 MB/s sometimes falling to 6 MB/s. I wasn’t surprised as I knew at some point all the blocks will be written to and due to lack of support for TRIM, things will get slow — didn’t think that slow!

How do I know it doesn’t support TRIM? If I format and mount an FS with discard mount option and subsequently run fstrim /mnt where /mnt is the mount point of the volume, I get this:

fstrim: /mnt: the discard operation is not supported

OK, but not all hope is lost. I knew about ATA Secure Erase command. What if that works? Turns out it does and it works oh so well. I followed the linked kernel guide but here is a summary of commands I ran (change /dev/X to appropriate dev) for the impatient. I strongly recommend reading the full guide.

14 Mar

Add hyperlinks to PDFs made by Inkscape

svglinkify demo PDF output
The final PDF generated by svglinkify which has clickable hyperlinks. See the source SVG file and the Inkscape exported PDF based on which the above is generated.

Inkscape despite being the most wonderful vector graphics editor program out there, has bummed me every time I tried to export something as PDF with hyperlinks in it. Inkscape does support adding links to arbitrary objects but in the conversion process to PDF, that metadata is lost. The reason for this loss (persumably) is that Cairo, a solely graphics rendering library used by Inkscape for outputting PDF, has no notion of object metadata. It just draws stuff to various types of canvas, like bitmaps, PDF, etc.

Being lazy (good thing) and not knowledgeable enough about Inkscape development, I set out to fix this problem quickly such that it can help me (and others) here and now, not in some unknown time in the future. This smells like it requires hackery and that’s exactly right. With less than 200 lines of python code, I made a very simple script that takes an SVG and a PDF of that SVG made by Inkscape, and creates a final PDF that has clickable hyperlinks. The SVG needs some simple treatment which is described in detail in the header comments of the python script. I have also made a demo SVG, and the PDF output of the script which can be seen on the right.

You can get svglinkify.py from github gists. You need python 2 or 3, qpdf and of course Inkscape to make everything work.

besides ranting, you may also find me asking silly questions or writing code for the world. Make sure you read the privacy policy.