Poor Franz

October 3rd, 2009

It’s a sad day when a random one-hit wonder band who stole your name gets a higher page rank in Google than you do.

franz

Poor Franz Ferdinand.  I’ll bet he’s rolling in his grave.  He should Black (back)Hand that band.


, , , , , ,

Importing MySQL 1.4 Amarok data into Amarok 2.2 Nightly

September 28th, 2009

I was having a bunch of trouble today importing my old MySQL amarok database into the new nightly version of amarok I installed.  The Amarok Wiki had a great section on how to convert a MySQL Amarok collection into an SQLlite one.  This was the key to importing my old 1.4 collection into the new 2.2 nightly version of Amarok.


, , , , , , ,

How to make Chrome bearable in Ubuntu Jaunty 9.04

September 25th, 2009

So, there I was, watching Firefox 3 thrash my CPU and IO, when I decided that I needed a replacement.  Something elegant, fast, preferably threaded… oh!  Google Chrome!  So, I finally found a link to download the unstable version of the browser based on the latest revisions, of which I got version 4.0.213.1-r27053.

Now, I’ve used Chrome in Linux before, and a few things about Firefox kept me hooked.  Today, though, I was on a mission to change all that.  I wanted basically all the functionality I got from Firefox in my Chrome experience as well.  This article should help others do the same.

Read more…


, , , , ,

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

September 9th, 2009

This is possibly the best one-liner I’ve ever written:

gcc -x c -o /tmp/out - -lgmp <<< '#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include <gmp.h>
void omg_i_love_leonardo_of_pisa(uint32_t num, mpz_t * result) { mpz_t retval, last, tmp; mpz_init(retval);
 mpz_init(last); mpz_init(tmp); uint32_t i = 1; if(num == 0) return; mpz_set_ui(retval, 1U);
mpz_set_ui(last, 0U); for(; i < num; i++) { mpz_set(tmp, retval); mpz_add(retval, retval, last);
mpz_set(last, tmp); } mpz_set(*result, retval); } int main() { uint32_t num; mpz_t fibo; mpz_init(fibo);
omg_i_love_leonardo_of_pisa(1000001, &fibo); mpz_out_str(stdout, 10, fibo); printf("\n"); return 1; }
' && time /tmp/out

It compiles a C program given from STDIN, puts it in /tmp/out, and runs it with time to find the time it takes to run. It generates the 1,000,000th Fibonacci number. Try it!

, , , , , , ,

Reading compressed files with postgres using named pipes

September 4th, 2009

Postgres has the same type of ability MySQL has to read in files, yet much nicer syntax. LOAD DATA INFILE from MySQL is just COPY in postgres. I decided to try having it read from a named pipe today, and it worked out nicely.
Read more…

, , , , ,

Ruby to generate RSS feeds for sites that don’t offer them

August 23rd, 2009

There’s this site that has an equipment exchange I wanted to keep track of. Yet, it’s done with what seems to be a custom php file rather than vbulletin, so none of the usual RSS feeds from the site apply to it. So, I decided to make a scraper/feed-generator to get me the latest version every 5 minutes and generate a nice RSS feed, so I can view it in Google Reader. The volume of posting is low enough that this won’t be annoying to see in my daily feeds.

I usually use Ruby for this because it offers Hpricot, a very nice and fast scraper and XPath interface. This time, I resolved to find something that does RSS generation better, and I stumbled upon RubyRSS, which happens to be in the core ruby distribution!
Read more…

, , , , , , , , ,

Good Passwords with GnuPG

August 22nd, 2009

I found out from this site that GPG can be used to generate random text for passwords. Here’s the command:


 gpg --gen-random 1 20 | gpg --enarmor | sed -n 5p

Very simple. I may have to use this in the future.

WARNING

This limits you to the Base64 character set, greatly limiting the search space for password cracking.  One should really use something other than enarmor to spit out a random printable ASCII string…

Update

OK, I did it.  It took some time, but it works nicely now, and generates MUCH better passwords:


hank@tardis:/nexus/tardis/hank$ for i in 1 2 3 4; \
  do gpg --gen-random 1 20 | \
  perl -ne's/[\x00-\x20]/chr(ord($^N)+50)/ge;s/([\x7E-\xDB])/chr(ord($^N)-93)/ge;s/([\xDC-\xFF])/chr(ord($^N)-129)/ge;print $_, "\n"';
done
p8$K`frjdkp;i-c2]2a2
glj#""I/eY\aYe3p}2y@
U2cXL&2^2/@7P2d#;?E=
kG)|N?[ZP2t2'bH22e;$

I know that probably looks like gobbledy-gook, but the main part of it is this:

gpg --gen-random 1 20 | perl -ne'print "Your password: ";s/[\x00-\x20]/chr(ord($^N)+50)/ge;s/([\x7E-\xDB])/chr(ord($^N)-93)/ge;s/([\xDC-\xFF])/chr(ord($^N)-129)/ge;print $_, "\n"'

Run that in a terminal, and profit.

,

Citibank says checks are cleared as soon as you see them online…

August 10th, 2009

I called Citibank tonight to confirm that one of my checks I deposited was finally collected.  This is a good thing to ask your bank if you are concerned that a check might bounce.  They indicated, as is said in the following audio recording, that if a check shows up in your transaction log online, it’s cleared.

Audio clip: Adobe Flash Player (version 9 or above) is required to play this audio clip. Download the latest version here. You also need to have JavaScript enabled in your browser.

, , , ,

How to set the RTC max_user_freq in newer kernels

July 19th, 2009

I found out today how to set the real time clock max frequencies in Ubuntu since they removed the possibility to do it from sysutil.conf from newer kernels. Add the following to your /etc/rc.local or another startup script:

echo 2048 >/sys/class/rtc/rtc0/max_user_freq
echo 2048 >/proc/sys/dev/hpet/max-user-freq

Reboot, and you should get better performance from things like mplayer.

, , , ,

DDWRT WPA2 AES Repeater Bridge Setup

July 5th, 2009

I found this awesome video today that explains step by step how to make a repeater for any wireless router using DDWRT! I’m currently doing it with WPA2/AES to boot!

After everything seemed to be working, I made sure by running a quick scan with my wireless card on my laptop. Sure enough, there’s now 2 different routers with the same SSID, and connecting to either one yields the same results.


eth1      Scan completed :
          Cell 01 - Address: 00:1F:90:CA:F7:84
                    ESSID:"KB3RXM"
                    Mode:Master
                    Channel:11
                    Frequency:2.462 GHz (Channel 11)
                    Quality=81/100  Signal level:-53 dBm  Noise level=-61 dBm
                    Encryption key:on
--
          Cell 04 - Address: 00:1A:70:75:E7:E6
                    ESSID:"KB3RXM"
                    Mode:Master
                    Channel:11
                    Frequency:2.462 GHz (Channel 11)
                    Quality=98/100  Signal level:-25 dBm  Noise level=-61 dBm
                    Encryption key:on

So, I want to thank daovertaker for his great tutorial. Now maybe I can get better reception in the back yard!