John's Blog

PHP Auto Image Resizer

I wrote a small script that automatic resizes images. A simple .htaccess and thumbnails.php that will automatic create resized images. If an image exists at http://example.org/img/test.jpg and someone vists http://example.org/img/test_10x10.jpg it will copy the image and resize it to 10 x 10 serve it and save a copy in the folder.

It’s smart too and checks whether the image exists. If the image exists it just serves it up. Otherwise if the base images exists it creates it or returns 404.

If you want it you can get it via gumroad at https://gumroad.com/l/Cscd

Download your Github Receipt with Cron

Github is awesome! I love using it for sharing code.

Github’s receipt system is less awesome. I try to keep all my receipts (never know when your taxes will get audited).

My workflow used to be:

Get emailed receipt
Download and file in proper folder
Archive email.

After three months of that I wrote a python script that downloads the pdfs for me.[1] Now I just run it on cron and auto archive the emails.

Ideally Github would make a private repo for ever account that would get update with your receipt. A monthly pull and you would be up to date.

[1] I use John Wiegley’s excellent ledger so I use my ledger branch to also print an update the ledger file.

How to write a Hacker News comment

One of my goals for this year is to be more active on Hacker News in a positive way. I read through the guidelines and the top comments and came up with some observations on what make a good comment.

  • Make a point, even if you’re not disagreeing try to make it live up to DH6. Refuting the Central Point
  • Questions are rarely points therefore good commentors rarely ask questions (Never ask questions you can answer yourself)
  • Don’t beat a dead horse i.e. the older the story the better your comment has to be
  • Don’t write in first person
  • Be nice
  • Write enough to get the point across no more
  • Above all else, make it interesting

From these I came up with some habits to build:

  1. Ask myself (out loud where possible): What is the point of the comment and does it add to the discussion?
  2. Is the point I’m going to make important enough for the age of the post (it had better be a damn good point for anything older then 12 hours).
  3. Write the comment
  4. Run a timer for 5 mins Eggtimer and then check if I still want to say it.
  5. If I post something I come to regret (e.g. some of the comments on Programming prodigy passes away at 16), apologize.

I’ve also been considering listed my real name in my profile. Right now you could find it but it would take a little work.

Read this book not that one

The 4-Hour Workweek NOT Do More Faster

The 4-Hour Workweek is full of actionable stuff you can apply roboticly. It’s simple and structured so you can just follow the tips. Do More Faster on the other hand is short chapters around a theme. Similar advice but I found it a lot less actionable.

C Programming Language NOT The Art of Computer Programming

The Art of Computer Programming is the authority on algorithms. Looking in the relevant TACP is almost always worth while whenever your doing anything complicated. Reading them cover to cover is not (disclaimer I’ve only done this with one). I learned more (did more) when I brushed up on my C with C Programming Language.

For Whom the Bell Tolls NOT Harry Potter

Richard Feynman always talked about how his different set of mathimaticly tools gave him the edge. It’s the same way with books. If your chatting with someone and have a different sets of literary tools you both have far more to offer each other in terms of unique view points. Harry Pottery has outsold Hemingway around 10 to 1. For Whom the Bell Tolls is a great book that can start expanding your library.

Git dotfiles without the bloat (rake, yadr, make, kitchen sink!)

I finally got around to adding my dotfiles into git. All the methods I could find on github were too bloated for my liking (I don’t like to use build scripts for until necessary).

So I rolled my own (clone it on git). Super simple one line bash post-commit updates all my symbolic links. Every time something gets committed it symbolic links all the files in the .dotfile folder into your home directory.

find ~/.dotfiles/ -type f -name ".*" -exec ln -s -f {} 
    --target-directory=$HOME \;

Fork it, change it or tell me why I’m wrong!

Software RAID on OpenBSD using softraid

A step-by-step guide to installing softraid with OpenBSD

I found that there wasn’t a lot of documentation for how to install softraid (most of it still referenced RAIDframe). Here is my step by step guide to install softraid. This guide is very similiar to Installing OpenBSD 4.6 and references it at few points.

Read More

Installing OpenBSD 4.6

A step-by-step guide to installing OpenBSD

I found that there was a lack of documentation on how to setup OpenBSD 4.6 with multiprocessor. After figuring it out on my own, I documented it as verbosely as possible.

Read More