Malicious enjoyment derived from observing someone else’s misfortune
 

Tag Archives: programming

A zsh adventure

Oh yeah, zsh guys.  It’s awesome, and you should know that, but what makes one switch from good ol’ bash?  Generally, it’s prompt magic, but really there’s some other nice features that make it worth considering.  But first, prompt magic.  I had some trouble getting the prompt to respect the width of my terminal, but it was resolved by escaping some things I had in there.  I ended up with this: To do that, you just need the following in [...]

Learn from my AVR mistakes

I’m learning a lot programming in AVR C.  There’s are a few subtleties to watch out for, and some of them have had me banging my head against the wall for days.  This post is an attempt to prevent anyone else playing with AVR outside of AVR Studio (I’m using Linux and the command line) from having the same issues. Sections for avr-objcopy When you compile an AVR C program, you get object code, which you have to convert into [...]

LCDiesel: Yet another AVR HD44780 LCD library

I created an HD44780 LCD library for the AVR architecture today. There were a ton already, and mine is based off of one by Peter Fleury. I added a couple cool little features, and decided it needed to be on github to allow people to improve it and access it easier. LCDiesel on Github Here’s a quick code example using the library: #include <avr/io.h> #include <avr/pgmspace.h> #include <util/delay.h> #include “lcd.h” // Include the chars we want #define CHAR_USE_OPEN_RECTANGLE #define CHAR_USE_HEART [...]

Parsing WFM Oscilloscope files in C

So, I got this Rigol Oscilloscope – I wrote a little instructable about it. One cool feature is the ability to save waveforms to a USB stick. There are many options for the file format, but the default is a WFM file. Now, a true minimalist could just use the CSV option, but the WFM is a binary format that contains a lot more information directly from the scope. I wrote a little C program hosted on github that allows [...]

The Chronic: A Ruby Time Library

So, I was trying to use Ruby to get the date 6 months ago.  This is usually accomplished using the core extensions in ActiveSupport, which is OK, but it was too much work.  Then, I found an awesome article talking about Chronic, a minimal date/time parsing library for Ruby: $ irb -rrubygems -rchronic irb(main):001:0> Chronic.parse(’6 months ago’) => 2010-03-25 21:10:10 -0400 Wow that’s like so awesome.  I wonder what else it can do… irb(main):002:0> Chronic.parse(‘three days after memorial day’) => [...]

Notes about Google Go

While trying out Google Go, I found out whitespace seriously matters, certain constructs you’re used to are not present, there is more than one way to declare variables, etc. This is a short collection of those observations. Blocks Blocks cannot have a newline between the declaration and the first opening brace. This is a bit strange, as many people think that having all the curly braces in line is more readable, and it is a common practice in many languages [...]

Burst C++ Library

I made a little C++ library called burst. The idea is to extend the awesomeness of Boost with convenience functions for common tasks (mainly my own common tasks, but maybe others can benefit as well). The current trunk is here. Here’s a quick example: And just that quick (3 lines) you’re sending an HTTP request to boost.org’s root page and streaming the result to STDOUT. Pretty cool, eh? What if you want a different website? It’s nearly as easy as [...]

1,000,000th Fibonacci Number One-Liner in C

This is possibly the best one-liner I’ve ever written: gcc -x c -o /tmp/out – -lgmp

GitHub Widget for WordPress

For all you coders out there wanting to show off all those forked repositories, the github-widget is for you. There are a few ways to install. Download from here.  The most recent stable release will be available.  As of this writing, it’s REL-1.3. Clone the git repository: git clone git://github.com/hank/github-widget.git Get it through WordPress (Work in Progress) If you use one of the first 2 methods, just drop the resultant directory into wp-content/plugins/. Using any of the three methods, after [...]

My favorite program

\ | / /“`\ \/ \/ _ | | _ /\ _ | | _ //\\ \___/ //\\ / | \ || || /||\ +++++++ +++[>+++++++>+++ +++++ +>+++>+\> +++++++++++>++++++++ ++++<<< <<<-]>+++.>> @__ ++.<<+++.>>>>+.>–.<—– —–.<<. <-.>>>>——- / \ .++++++.<<<.<<-.>>>>.>——— .+++++++.< .>++++++.<<.<<–.>>>++++.+++..<<.<++.>>>+++.>—-.<<<.<<++.>>>>——– ——.>—..+++++++.<<<.<<.>>>>++++.<<<<————–.?>>>.__________ Hint: It’s code, and the language it’s in has a dirty word in the name