Tuesday, March 03, 2009
nh
Predicting and controlling NetHack's randomness. Wow, and I thought I was obsessive about Nethack.
Actually, I don't play Nethack anymore, except for once a year for the tourament. I have too much other cool stuff to do now, for the first time evar.
Monday, March 02, 2009
convert
A little bit of C++ that I whipped up to convert to and from binary, since I didn't find anything too inspiring online:
string binary(int v, int bits) {
int p;
string s = "";
for (int i = bits; i >= 0; i--) {
p = pow(2,i);
if (v & (1 << i)) {
s += "1";
} else {
s += "0";
}
}
return s;
}
Convert a bitstream to a floating point number between 0 and 1. It's a smart little function
because it figures out the range from the length of the input string
float convert_bitstring_to_float(string s) {
float v = 0;
int len = s.length();
for (int i = 0; i < len; i++) {
cout << "i=" << i << " s[i]=" << s[i] << endl;
if (s[len-i-1] == '1') {
v += (1 << i);
}
}
return v / (pow(2,len));
}
latex
Whenever you use figures, always (and I mean ALWAYS EVER FOREVER ALWAYS) put \caption first, and \label second like this:
\begin{figure}[htp]
\centering
\includegraphics{image.eps}
\caption{Some Image}
\label{fig:some-image}
\end{figure}
Sunday, March 01, 2009
record
recordmydesktop --on-the-fly-encoding --full-shots -fps 29.97 -width 720 -height 528 -x 20 -y 40
keyjnote -f -g 724x532 python-before-eggs.pdf
mencoder out.ogv -ovc libdv -oac pcm -vf scale=720:480 -o editme.dv
cinelerra (or After Effects, Adobe Premier, Final Cut Pro)
mencoder cinelerra.ogg -vf scale=640:480 -af volnorm=1:0.5 -ovc lavc -oac twolame -o final.avi
screencast
How To Produce A Linux Screencast
1) Use "recordmydesktop"
2) Convert to raw .dv format (which is huge)
3) Edit in some program
4) Convert to something that YouTube or Vimeo likes
getting tail
Tail Recursion
Which I found by looking at:
Clojure
Which led to:
Getting started with Clojure
But what led me to all of this was:
Ruby's Most Underused Keyword (spoiler, it's "redo")
Subscribe to:
Posts (Atom)