All posts by johan

netgear router, no internet – reboot.

Script to check if the netgear router is working:

[root@srv01 ~]# crontab -l
#starta om netgear router om det är problems
*/15 * * * * /opt/scripts/ >> /dev/null 2>&1


ping -c2

if [[ $? -gt 0 ]];

URL=$(curl -u USERNAME:PASSWORD "" 2>&1 | grep 'method="POST"' | awk {'print $4'} | grep -oE "lan.*\"" | sed 's/"//g')

echo "need to restart the router..."
/bin/mail -s "Rebooted Router" "root@localhost" < $EMAILMESSAGE rm -rf $EMAILMESSAGE echo "$(date +'%Y-%m-%d %H:%M:%S') NEED TO REBOOT ROUTER!" >> /root/reboot.log
#echo "$(date +'%Y-%m-%d') NEED TO REBOOT ROUTER!" >> /root/reboot.log

echo "everything works..."


Back to OpenBSD

I reinstalled my harddrive and installed OpenBSD once again.
After that I noticed that OpenBSD now supports tmpfs, so i mounted tmp and .cache directory in ram instead:

$ cat /etc/fstab
c62268885862ee35.b none swap sw
c62268885862ee35.a / ffs rw 1 1
c62268885862ee35.g /home ffs rw,nodev,nosuid,noatime 1 2
#c62268885862ee35.d /tmp ffs rw,nodev,nosuid,noatime 1 2
c62268885862ee35.f /usr ffs rw,nodev,noatime 1 2
c62268885862ee35.e /var ffs rw,nodev,nosuid,noatime 1 2
tmpfs /tmp tmpfs -m777,rw,nodev,nosuid,noatime 0 0
tmpfs /home/johan/.cache tmpfs rw,nodev,nosuid,noatime 0 0

Wpa_supplicant + FreeBSD + Eduroam

Download this:

Edit wpa_supplicant.conf:

key_mgmt=WPA-EAP IEEE8021X

Code for the project presentation

Code for the project presentation:

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>

#define TEXTER 4

char texten[TEXTER][255] = {
"Wake up, Matrix...",
"They are coming...",
"Follow the room edges...",
"Knock knock Matrix..."

int main(void){
int i,j = 0;
for(i=0;i < TEXTER;i++)
j = 0;
while(texten[i][j] != 0)
printf("%c", texten[i][j]);


OpenBSD gone, FreeBSD is my new laptop OS

I left the OpenBSD as a laptop project and installed FreeBSD instead.

The main thing that made me install FreeBSD instead of keep using OpenBSD is that i couldn’t use Matlab (this is used in my education) and Mplabx (which I use for programming PIC ciruits).

I installed virtualbox and installed ubuntu, and from there i installed both Mplabx and matlab with success.

If bhyve will come to OpenBSD, perhaps i can use USB passthrough and install a Linux machine from there and use X forwarding.

OpenBSD as a laptop

Im trying to get OpenBSD running as a laptop but there are some problems that i came across. The first one is OpenBSD x64 cannot run linux compability mode which makes it alot harder to use MatLab. Im thinking of running in under QEMU but i think that it will have worse performance though.

To compile projects with Arduino works good, its console based but i dont care about that. I will check if there is any possibility to use geany as an IDE for arduino.

I also want to be able to program microcontrollers, specificly the microchip controllers. I have bought an PICKIT3 and im trying to make it work under OpenBSD now. I noticed that QEMU does not support USB passthrough, that makes it alot harder to make it work though.


Lets see where it goes!

OpenBSD apmd patch and thinkpad x201 patch

I have sucessfully merged those two patches to work with openbsd 5.5 current. Thanks to jcs who made the original patch for the x201 laptop. and thanks for the patch from jjjesss who made that apmd patch.

Original links is here:

My customized patches can be found here: