Så kan du ikke brokker dig over at jeg ikke opdateret min blog, Phillip

October 5th, 2012

Min vrede over DSBs behandling af pendlere

August 9th, 2011

I dag blev min kollega rullet på Nørreport station ved 19 tiden ca., lige ved den runde dims som præger det døde beton helvede, men dette handler nu om DSB.

Han pendler dagligt mellen Næstved og Nørreport, og har gjort så i gennem ca. 5 år.
Han havde netop fornyet sit pendlerkort (to dage forinden), og det er alligevel små 2.000kr,-
DSB vil ikke udstede et nyt!

Jeg har været ude for lignende hændelse, men der tabte jeg blot kortet i en brandert. Der manglede kun en uge, men jeg fik samme besked.

DSB har valgt at kortet er personligt med billede ID. Der er et unikt nummer på hvert kort, pga. pendlergaranti.

Alligevel er det umuligt at få tildelt en kopi af kortet!

Det er jo ikke fordi man beder dem om at smide pengene i hånden på een, blot at få en kopi af det man allerede har betalt for.

WBFS disk-cloner script

November 11th, 2010

Obtain the wbfs program from the interwebs and make an appropriate link or path to it. Now this incredible script should clone the drives, slooowly but it’ll get there!

#!/bin/bash
SOURCE="/dev/disk1s2"
DEST="/dev/disk2s2"
STXT="source.txt"
DTXT="dest.txt"
 
EXT=~/Mine\ Programmer
PATHWBFS=$EXT/WBFS\ for\ MacOS\ X\ v1.2/WBFS\ for\ MacOS\ X.app/Contents/Resources/
PATH=$PATH:$PATHWBFS
 
 
function getList()  {
	LIST=`wbfs -p $1 ls 2>$2`
         sort $2 > $2".sort"
	mv $2".sort" $2
}
getList $SOURCE $STXT
getList $DEST $DTXT
 
LIST=`diff source.txt dest.txt|sed "s/</ /" |sed "s/|/ /"   |awk '{print $1}'`
 
 
for i in $LIST; do
	if [[ "$i" =~ [A-Z0-9]{6} ]]; then
		wbfs -p $SOURCE extract $i
		wbfs -p $DEST add *iso
		rm *iso
fi
done
 
rm $STXT $DTXT

Set tags on current title in iTunes based on top3 from last.fm

June 6th, 2010

I kinda lacked a function that would automaticly set tags on my tracks according to e.g. last.fm

I therefore wrote a bashscript that leeches the three most popular tags for a given bandname and applied them to the track.
I can then just use iTunes to use these tags for the entire album.

It is not perfect but it is a start for making tagging easier, for me atleast.
I hope some of you will find it useful or inspiring.

#!/bin/bash
TAGS="extract.txt"
 
 
TITLE=`exec osascript <<\EOF 
tell application "iTunes"
	get artist of current track
		--set genre of current track to "HORSE POP"
 end tell`
 
echo "Fetching tags for: "  $TITLE
 
TITLE=`echo $TITLE|sed 's/\ /+/g'`
wget -q  http://last.fm/music/$TITLE/+tags  
sed -n  's/rel="tag"//p' +tags >> $TAGS
TAGLIST=`awk '{print $4,$6,$7,$8,$9,$10}' $TAGS |sort -r|head -3|sed 's/.*\" >//g'|sed 's/<\/a>//g'`
TAGLIST=$( echo "${TAGLIST}" | awk '{for(i=1;i<=NF;i++)sub(/./,toupper(substr($i,1,1)),$i)}1' )
echo $TAGLIST > $TAGS
 
 
echo "Setting tags to :" $TAGLIST
NEWTAGS=`exec osascript <</EOF 
set tags to do shell script "cat extract.txt"
tell application "iTunes"
	set genre of current track to tags
end tell`
 
rm +tags
rm $TAGS

Søvnløs og scripting

April 7th, 2010

Jeg baksede et hurtigt javascript sammen som hentede det nuværende nummer som spiller fra min favorit radiostation. Det er hverken kønt eller specielt brugbart men det slog da en times tid ihjel.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
 
 
function HttpRequest(url){
var pageRequest = false //variable to hold ajax object
if (!pageRequest && typeof XMLHttpRequest != 'undefined')
   pageRequest = new XMLHttpRequest()
if (pageRequest){ //if pageRequest is not false
   pageRequest.open('GET', url, false) //get page synchronously 
   pageRequest.send(null)
   embedpage(pageRequest)
   }
}
 
function embedpage(request){
//if viewing page offline or the document was successfully retrieved online (status code=2000)
if (window.location.href.indexOf("http")==-1 || request.status==200)
	var ebmContent = request.responseText;
	var re = /<p\s*[^>]*>([\S\s]*?)<\/p>/g;
	var match = re.exec(  ebmContent.substring(2200, 3000)   );
	var CurrentTrack = match[1];
 
	CurrentTrack = CurrentTrack.replace(/&(lt|gt);/g, function (strMatch, p1){ return (p1 == "lt")? "<" : ">";});	//remove tags
   CurrentTrack = CurrentTrack.replace(/<\/?[^>]+(>|$)/g, "");
 
	CurrentTrack = CurrentTrack.replace(/^\s*|\s*$/g,'');	//remove additional whitespaces
	CurrentTrack = CurrentTrack.replace(/\s/g,'+');			//turn whitespaces into +
 
		window.location = "http://www.twitter.com/home?status=EBM-radio+is+playing+:::+"+ CurrentTrack;
}
 
HttpRequest("http://www.ebm-radio.de/scripts/latest_tracks/scxml_onlydata.php") //include "external.htm" onto current page