I have cured my own sleep paralysis, and you can too.

~2 min read

I no longer fear waking. My entire life, I have dealt with sleep paralysis. If you don’t know, sleep paralysis is a condition where you wake, terrified, unable to move. Wikipedia has a good article on it, as usual. I just learned to live with it up until a few years ago. I was living with my future wife, who would see me hyperventilating, and shake me awake. At this point, I was just happy I didn’t have to lay there in fear. Time passed, and I began to feel bad for those who didn’t have wives to wake them up. I also worried it would happen on a business trip or vacation. The answer, as usual, was staring me right in the face.

Read more →

Food (and diet) management for the unix geek, a python script

~2 min read

For many a scientist like myself, the pear-shaped waistline which has become synonymous with the unix guru has become all too familiar. While there are a number of mitigating factors, I’m going to chalk it up to the sedentary lifestyle of the typical programmer. A study posted on Digg last week showed that on average, dieters who kept a food journal lose twice as much weight as those who don’t. That’s a pretty powerful tool. Carrying around a notepad doesn’t make a lot of sense for me, as I’m almost never without my laptop, so I’ve been keeping a csv spreadsheet like below: <br></br> 07:53 ,oatmeal , 160<br></br> 07:55 ,water , 000<br></br> 10:40 ,kudos , 100<br></br> 10:40 ,water , 000<br></br> Which is fine. It accomplishes what needs to be accomplished, with regards to the diary at least. However, I would like some statistics with my diet. How many calories do I have left in the day, how many glasses of water, how many calories did I eat at lunch, etc. These little statistics and calculations really drive home the message. I always keep today’s .food file on my desktop, and I have my .bashrc set up to show me my dietary information whenever I login or open a shell like so:

Read more →

Half a line of shell to display to screen while compressing output... The most useful shell I've written in forever

~2 min read

Ok, so here’s the deal. I write a lot of C in my line of work, so when I get the chance to write some clever shell script, I relish it. I do a lot of long supercomputer simulations, which tend to be hard to debug (especially when a problem arrises 3 days into a 4 day run). This is where logfiles come in handy, I know I’m not alone in this. Unfortunately, for really long runs these logfiles can add up to hundreds of gigs of space, which is a hard to come by commodity on supercomputing clusters. I found numerous solutions online, all of them tending to be long and overly complex shell scripts… No thanks!, when I want something done on shell it needs to follow the shell paradigm, small and powerful.

Read more →

Easy Execution Library - c++ class library for spawning processes

~1 min read

Easy Execute – An extremely easy to use C++ library for spawning processes and executing arbitrary commands. This library is intended for developers who wish to simply execute some command, without worrying about the underlying fork/exec/system calls, string parsing, setting up timers, recording the run time of the command, etc. This library makes it all completely plug and play. GPLv3.

Read more →

Re-Writing the laser pointer paint program (image processing) in C/C++ - 10x speed improvement

~1 min read

This should significantly increase our capture and processing speed. First, install libcv1 in ubuntu, I like to get the documentation and python bindings as well, and these will install libcv1 anyway. ` sudo aptitdue install python-cv opencv-doc ` Now we’ll start writing some C code. As I have the benefit of writing this article after the code, I know that one can render/display 30fps without processing, and can render/display without lag with processing as well (thank you compiled code!). You can compile opencv code in linux using the following command:

Read more →