Saturday, April 02, 2011

Download HQ or HD video from Youtube and convet to mp3

Well the title says it all. Copy the Youtube URL, and go to www.keepvid.com where you paste it into the search field. Click the "high definition" mp4 file link to download (sometimes it's just "high quality") but it's going to be enough for the treadmill or car stereo.

When you've saved enough videos to one directory, use the following script to convert them to mp3. You will need faad and lame (or twolame)

#!/bin/bash
#hacked by adrian (at) javaguru [dot] org
if [ -f /usr/bin/faad ]
        then
if [ -z $1 ]
        then
                echo "Usage: mp3-to-mp3 / all"
                exit 0
fi
if [ $1 != "all" ]
        then
if [ -f $1 ]
        then
                echo Processing $1
                faad $1
                #filename change
                FNAME_LENGTH=${#1}
                FEXT_INDEX=$((FNAME_LENGTH-4))
                echo Filename length: $FNAME_LENGTH
                WAVFILE=${1:0:$FEXT_INDEX}.wav
                echo $WAVFILE created. Processing...

                # Running lame encoder
                echo Running lame mp3 encoder with 256kbps and HQ settings
                lame -h -b 256 $WAVFILE

                # process filenames
                MP3FILE=$WAVFILE.mp3
                NEWMP3FILE=${MP3FILE:0:$FEXT_INDEX}.mp3
                mv $MP3FILE $NEWMP3FILE
                echo Deleting intermediate WAV file
                rm -v $WAVFILE
                echo $NEWMP3FILE created. Enjoy!
        fi
else
        if [ $1 == "all" ]
                then
                # removing keepvid.com tag
                find . -name "*keepvid*" -exec rename -v 's/\_\[www.keepvid.com\]//'$
                find . -name "*.mp4" -exec mp4-to-mp3 {} \;
        fi

fi
else
        echo /usr/bin/faad missing! Exiting
fi

Wednesday, February 16, 2011

Tuesday, January 25, 2011

OpenSSH root from localhost

restrict root to only be able to use ssh from localhost
Try out following entry:
AllowUsers root@localhost
If the pattern takes the form USER@HOST then USER and HOST are separately checked, restricting logins to particular users from particular hosts.

Sunday, January 23, 2011

Packning för MC-resa

Packa smart = det du behöver ofta längst upp
Kolla kedjan - spänn om nödvändigt
Extra pass & pengar i styrändarna
Foto på pass och körkort i GMails inbox kanske redan laddat i telefonen
Whiskey i plastflaska
2-4 öl
Stödplatta
Ficklampa
Klart visir
Karta/kartbok
Kamera
Kniv
Vattenflaska
Reparationskit (punkaspray, verktyg, straps, multiverktyg, silvertejp)
Liten kedjesprej

Extra handskar, varma
Mikrofiberduk/handduk
Yllestrumpor Stadium
Extranyckel till motorcykeln, förvaras på annan plats (halskedja)
Tandborste, tandkräm, deo
Tvättlapp

Thursday, December 23, 2010

Friday, November 26, 2010

Thursday, October 21, 2010

joker.com dynamic dns updater client

I've written a small app which updates the dynamic dns service at joker.com with your latest real IP.
check it out here:
http://code.google.com/p/jokerupdater/downloads/list

Monday, October 11, 2010

Socialdemokratisk avbildning

Olof Palme staty i Folkets Park, Malmö

Snyggt, kolla tiggaren. Speglar den socialdemokratiska skattepolitiken finfint, stå med handen utsträckt till svenska folket och ta deras pengar. ..
Published with Blogger-droid v1.6.1

Friday, September 24, 2010

Evening ardelenesc

Dumnezeiesc de bun.. Ciabatta, jumåri sirbesti, ceapå suedezå si votcå americanå. Fuck, yea!
Published with Blogger-droid v1.5.9

Monday, August 30, 2010

Good quality code vs value for customer

In our programmers discussion forum, the following discussion emerged: one party argues that value for customer really means "quick and dirty" solutions. Code that works, and is fast to write. The customer never knows the difference, and is happy that the job was done fast. The other party argues that so called "good quality code" written "by the book", following good design principles, such as using interfaces, patterns, well written comments, and naming standards, might not take much longer to implement, but will be cheaper to maintain, and be of better use to the customer.

Proffessionally, I've seen a couple of combinations:
* Uninterested customer & technical leadership, some interested developers. This implicitly means quick and dirty
* Uniterested developers. This means that everything will be barely usable, regardless of interest from customer, or technical leadership.
* Technical leadership that is into name dropping, or buzzword bingo. Here, if you (the developer) are interested, you could actually do some good. You can write good quality code, because the technical leader doesn't understand what you're doing, and when you're done, you explain nicely in a short email how well the code is written, which principles you have used, and your technical leader will be happy to use that in his report to the customer. Job well done, everyone is happy.
* Interested customer, less interested technical leadership, or lack of development skill. This usually ends bad.

The analogy with good quality code vs bad quality code: it's like good or bad engineering in cars. First, when the car is new and shiny, a Renault Clio is very nice. Smells new, spins like a cat, and life is good. After a couple of months, things start to happen. A rubber sealing falls off. A plastic knob cracks. "It was cheap, I can live with that" , you say. Then, the headlight goes out. No worries, I'll stop by the gas station, and buy a lamp. You buy the lamp, and start fiddling, but you can't really reach inside to pull out the bulb, because there's no clearance between the battery and the headlight. So you have to take it to the mechanic, who will HAVE TO lift it up, UNSCREW THE WHOLE WHEEL ARCH PANEL (!!! this is actually true) in order to get to the headlight. This will cost you an hour, and probably around 150€ or so. And this every time a headlight goes out, so to be on the safe side, you have to replace all three lamps at the same time.
Combine this with some notoriously bad french car electronics, and you have lamps going off pretty often.

Now compare this with a slightly more expensive Volkswagen. On the VW, you could change the bulb in about 5 minutes. Yes, you've payed 3-4.000€ more. Will that money be a waste? How many times can you change bulbs on a Clio for 3000€ ? Say 300€ a year, because the bulbs could burn out on both sides in one year, as on my old Mitsubishi Galant. So 300€ a year, times 10 years. In ten years, you've saved 3000€ on bulb changes only. What about the other bits and pieces that work right now, but on a 10 year old Renault, they need to be changed? What about the rust on 10 year old french tin can ?

How much does that 3-4.000€ extra mean when you start thinking like that ?
Why do people understand the logic when it comes to their own car, but not software ?

I've yet to see interest in good quality code from all parties. It must be as in all other businesses, most of the people are mediocre, and just want to go to work, worry as little as possible, make sure they don't have to answer any difficult questions so noone notices how stupid they really are, and hurry home to collect their paycheck.

Please take your time and comment on the above

Project description

"Mitt HP SM projekt är som en Rubiks kub med några extra dimensioner. Och med färger som inte riktigt passar ihop."

Eng: "My HP SM project is like a Rubik's cube with a few extra dimensions. And with colors that do not quite fit together"

Boy, I don't envy him ..

Thursday, August 19, 2010

KTM wishlist


I just tried the KTM 990 SMT, and as I am positively impressed, I am equally amazed how stupid KTMs can be designed and built.
The chassis is fantastic, it's quick, light steering, stable, powerful, and wheelie prone. Unfortunately there are some build and design issues:
The mirrors will probably fall off before your test drive is over. Why ? The mirrors on my Yamaha have never vibrated off. Are the Japanese smarter, or do they just give a shit?
The brake pedal is model 80's, like it's made in a shool workshop, kindof like it's bent from one piece of tin can, with a serrated edge. I know that KTM says they're about "Ready to Race" and such, but they should be equally about quality, since people are used to buying the Japanese passive quality, where everything stuck together stays that way, and engines never break down.

Another stupid thing is the instrument console, it's unreadable, and doesn't have a fuel meter. Why ? Why is that so hard ?

Until my here wishlist is complete, I'll stick to Yamahas:
- Fuel meter
- mirrors that don't vibrate off
- readable instruments
- better quality rearsets
- Better fuel economy
Peace!

Saturday, July 31, 2010

Monday, July 19, 2010