Sierpinski (2011-08-11)

Not as short as some others, but valid C99, and only one variable :)

unsigned M=32,i;int printf(char*,...);int main(){for(i=M*M;i--;printf(" %s%s",~i%M<i/M?"":i&i/M?"`":"#",i%M?"":"\n"));return 0;}

Really simple intervalometer for Nikon cameras (2010-11-04)

Due to my huge lack of motivation to buy an expensive intervalometer like the Pclix (140 USD, yeah right) I decided to look up the sequence that triggers my D40's infrared sensor and build my own:

Schematic

Voltage is supplied by two 1.5V batteries.

The LED I'm using is red - seems like the sensor of the D40 is sensitive enough to receive that, although I have to tape it directly to the camera to make it work. As a bonus, this allows me to use the same LED as display for the interval, which is changed by pressing the button.

(See comments) The interval cycles through 1, 2, 5, 10, 30 seconds, and 1, 2, 5, 10, 14 minutes by pressing the button, and is displayed by simply blinking the LED t/10 and then t%10 times.

If you're interested, you can grab intervalometer.c, but you should probably add a quartz to get rid of the timing issues ;)

PS: If you happen to have a decent idea how to get the ┬ÁC into sleep mode when it's not doing stuff, without fucking the timing up, please let me know!

New app: sfc (2010-08-24)

Added a small project of the last three or so days: sfc, a program for learning languages with flashcards.

Maybe as a cleaning cloth? (2010-04-08)

thumbnail

Look ma, books! (2010-02-22)

My unread books... bought most of them in December. I think I'm gonna be busy for a while, especially if you take this studying physics thing into consideration. ;)

Click for a larger image:

thumbnail

Edit: Finished books:

Mathematica function to make error propagation easier (2009-06-17)

err[F_,w__]:={F[Map[First,List[w]]/.List->Sequence],Block[
{parms=Table[Unique[],{x,1,Length[List[w]]}],
values=Table[List[w][[i,1]],{i,1,Length[List[w]]}],
errors=Table[List[w][[i,2]],{i,1,Length[List[w]]}]},
Sqrt[Total[
Table[(D[F[parms/.List->Sequence],parms[[i]]]*errors[[i]])^2,{i,1,Length[values]}]
/.Table[parms[[i]]->values[[i]],{i,1,Length[values]}]]]]}

This takes a function F_ and a bunch of lists {xi,si}, where _xi is some value and si its error, and calculates

sum(i)(dF/dx_i(x_1...x_n)*s_i)

For example,

f[x_,y_]:=Sin[x]*y^2
err[f,{x,xs},{y,ys}]

will return

stuff

Binary Clock (2008-04-15)

My new hobby: Microcontrollers.

I just finished my first project: a binary clock. It displays the time in three columns with six LEDs each, which show (from left to right) seconds, minutes and hours. The time can be set using two buttons.

I wrote the code myself, with occasional help from HK. The microcontroller I used is an ATmega8.

Obligatory picture:

binary clock

The code is at time1.c (public domain).