Your phone company is watching


This TED-video is from back in July 2012, but I thought I would re-post it since it’s 100% relevant today. The Norwegian government has put aside over 200 million NOK (half of the whole budget for Justisdepartementet) next year to implement “Datalagringsdirektivet” which will put all citizens in Norway under surveillance, and the principle of innocent until proven guilty is suddenly put in reverse…

Disappointing TEDx in Croatia


This man was banned from going to all TEDx in Croatia after pointing out pseudo-science in a talk that was going to happen.

This is really not good for the fantastic TED brand…

Prime Numbers


Another fantastic TED-talk about monster prime numbers and why science is cool!



Fantastic TED-talk about why sleep is important. Scary stuff. People need to sleep more.



Fantastic TED-talk about how to be more happy. Change the formula for happiness!

Imported from Posterous


Since Posterous closed down, I just imported all my posts into WordPress.

Official address on wordpress is, but the old addresses and are being redirected here as well.

Hope everything works, please leave me a comment if you notice anything weird.

Fixing drive failure when using mdadm/raid1 on boot device (CentOS 5)



I am using CentOS 5 for one of my servers, and use raid1 and md for
the mirroring between two drives.

Then one of the drives fail (which they eventually will), here is how
you fix it:

I have taken info from these pages for this blog post:…

In this example I have two hard drives, /dev/sda and /dev/sdb, with
the partitions /dev/sda1 and /dev/sda2 as well as /dev/sdb1 and
/dev/sda1 and /dev/sdb1 make up the RAID1 array /dev/md0.
/dev/sda2 and /dev/sdb2 make up the RAID1 array /dev/md1.
/dev/sda1 + /dev/sdb1 = /dev/md0
/dev/sda2 + /dev/sdb2 = /dev/md1
/dev/sdb has failed, and we want to replace it.

First of all: ‘cat /proc/mdstat’ is your friend – it will show you the
status of your raid during the whole process.

In the output from ‘cat /proc/mdstat’ you will see an (F) behind a
failed device, or it will be missing alltogether.

First, fail and remove the failed device(s):
mdadm –manage /dev/md0 –fail /dev/sdb1
mdadm –manage /dev/md0 –remove /dev/sdb1
Repeat for other MD-devices containing sdb-parts.
Now the output from ‘cat /proc/mdstat’ should only contain parts from sda.

Power down, change the drive, and turn it back on.

To make the same partitions on sdb as you have on sda, do this:
sfdisk -d /dev/sda | sfdisk /dev/sdb

‘fdisk -l’ should now show the same partitions on sda and sdb.

Next, add the proper parts from sdb to the relevant md-device. So if
md0 contains sda1, do this:
mdadm –manage /dev/md0 –add /dev/sdb1
Repeat for all md-devices so you have the same parts from sda and sdb
in all of them.
Check with ‘cat /proc/mdstat’.

Let is sync back up (check with ‘watch -n 10 cat /proc/mdstat’ until
it finishes).

Now, fix grub:
grub>root (hd0,0)
grub>setup (hd0)

If you’re unlucky and can’t’ boot because the wrong device is first
(trying to boot from the clean/new hard drive), follow these steps:

First boot into a live cd with your os.
Then activate the RAID:
1) mkdir /etc/mdadm
2) mdadm –examine –scan > /etc/mdadm/mdadm.conf
3) mdadm -A –scan

Then reinstall grub. In this example, you have /boot on md0 and / on md1:
1) mkdir /mnt/sysimage
2) mount /dev/md1 /mnt/sysimage
3) mount -o bind /dev /mnt/sysimage/dev
4) mount -o bind /proc /mnt/sysimage/proc
5) chroot /mnt/sysimage /bin/bash
6) mount /dev/md0 /boot
Then fix grub (same as above):
grub>root (hd0,0)
grub>setup (hd0)

Voila, you have a working raid again with grub managing to boot your system 🙂


Som de fleste geeks bruker jeg adblock til å surfe uten plagsomme reklamer.

Jeg skjønner at antakelig blir hardere rammet enn andre av
at deres brukere i stor stil bruker adblock. Men etter et forsøk på å
laste websiden deres uten adblock har jeg ingen sympati for de lenger.
Og når de putter en stor plagsom panda og tekst øverst for alle som
bruker adblock, så måtte noe gjøres.

Løsningen er å installere dette greasemonkey-scriptet. I Firefox må
man installere GreaseMonkey addon’en først. I Google Chrome bare
trykker man install så kommer den inn som en egen extension.

Vips så er pandaen på og medfølgende tekst borte vekk…

Android 4 and Calendar crash


After I got a new phone with Android 4 (ICS), my calendar crashed as
soon as I enabled sync of my google calendar. After *lots* of
googling, I finally found the cause: At least one of the events in the
calendar is “corrupt”, and in earlier Android versions this has been
handled better than in the new Android. In the new, it gets real sad
and the whole calendar application crashes.

The solution (also found after *lots* of googling):
1) Log into your google calendar on a PC in a browser.
2) Go to calendar settings and export the whole calendar to an ICS-file.
3) Make sure you have the ICS-file (open it in a text editor)
4) Delete your calendar (or all events in it if it’s your main
calendar) on the web / google calendar
5) If you have more than one calendar, repeat steps 2-4
6) Import your ICS-file back to the google calendar 
7) If you have more than one calendar, repeat step 7 

For me this solved everything. From what I read, some will get an
error when importing back in, and then it will state the line number
the problem is in. This can be a malformed time zone, some funky
recurring event and so on. In that case:
a) Open the ICS-file in an editor
b) Fix the malformed line
c) Go to step 6)

Hope that was helpful, it solved all my problems at least 🙂

PS: I read that most of these errors come from using programs that
sync your outlook/exchange calendar to google. It probably messes up
recurring events and timezones sometimes, and the event ends up
corrupt. For some reason Google doesn’t detect this, and you get a
big problem on the Android that crashes when it gets to such a
malformed entry.

amixer in ubuntu


If you want to change the volume in Ubuntu 11.10 it seems that amixer
is kind of bugged when it comes to toggle (mute/unmute). When
toggling Master, it also mutes all the separate groups (Front,
headphone, PCM and so on), but when toggled again it only unmutes
Master, which leaves the rest muted…

I came across a nice workaround that i wanted to share. The solution
was written by Jim Hunziker on this page:

1) Make a with the following content:

#!/bin/bash CURRENT_STATE=`amixer get Master | egrep 'Playback.*?[o' | egrep -o '[o.+]'|head -n 1`if [[ $CURRENT_STATE == '[on]' ]]; then    amixer set Master muteelse   amixer set Master unmute   amixer set Front unmute   amixer set Headphone unmute   amixer set PCM unmutefi

2) chmod u+x

3) Bind it to some key (f.ex. XF86AudioMute) to run



%d bloggers like this: