Setup wlan with CentOS 7 on a Banana Pi using a TP-Link USB adapter

There is a Banana Pi 1st generation, that was sitting in my drawer for too long. So I decided to bring it back to life with CentOS to which I’m a newbie. My first target is to use a TL-WN725N Nano-USB Wlan Device to connect to my local network. This guarantees fun and learning, so here we go 🙂

If you need a faster network connection, consider switching to a SD-WAN.

First I downloaded the CentOS BananaPi Image. I used the link provided in their announce last december and grabbed


Then used `dd` to load it on a SD card, put it in the banana and boot that nifty little box.

The first login had to be done with credentials user:’root’ and password:’centos’.
Then install the ‘usbutils’ package to get the ‘lsusb’ command.

%sudo lsusb
Bus 001 Device 002: ID 0bda:8179 Realtek Semiconductor Corp. RTL8188EUS 802.11n Wireless Network Adapter

Continue reading “Setup wlan with CentOS 7 on a Banana Pi using a TP-Link USB adapter”

tails of fortune 1 (aka tof1)

Avoid the Gates of Hell. Use Linux.
– unknown source

When your write scripts, debug code or deloy software there comes a point of boredomeness beyond fun. This is the time to install fortune and get a smile in the detection time of a keystroke.

And if you want your bash scripts to output something nice after it finished work, just put this on the line after your Shebang.

#!/bin/env bash
trap $(hash fortune && echo fortune) SIGINT SIGTERM EXIT

And if you like if colorfull and crazy.

#!/bin/env bash
function fun {
    hash fortune && hash cowsay && hash toilet && clear && fortune | cowsay -f apt | toilet --gay -f term    

Be sure to install fortune, cowsay and toilet.

SSH Keygen Infos

I havent’t wrote in a while. To keep it short: I’m still alive.
This is just a short note on ssh keygen and ssh-copy which I was not aware of.

Let’s assume you have your keys an need to change the passphrase:
cd ~/.ssh/
(keys can be ~/.ssh/ or ~/.ssh/

ssh-keygen -f id_dsa -p

And copy the key to remote host:

ssh-copy-id -i USER@REMOTE_HOST

That’s it 🙂 now you can connect to the remote machine without hassle.


Why to choose nfs over vboxsf for mounting host folders inside a VirtualBox VM!

Simple answer: SPEED

Long answer:

Most projects I work on a the moment are web related and I like my development environment to be as close to production as possible.

Therefore I set up a Debian Jessie some time ago and mounted my whole /Users/cb0/Sites directory into the VM. So I configured the shared folders inside the VirtualBox and used this code inside /etc/fstab inside the Debian.

Sites /Users/cb0/Sites vboxsf defaults,rw,uid=33,gid=33 0 0

This worked fine for custom php apps and even for symfony 1.4. Now I’m working on a symfony 2 project which seems to generate a whole bunch of cache files before starting to deliver the webpage.

This resulted in an average load time of 45s (yes seconds) which I could not bear for more than 2 pageloads. So I search for the bottleneck and found out that the creation of the cache files took too long. After reading some documentations I decided to try to mount the share over nfs instead of the vboxsf.

Here’s how to do it:

1. [Host] Create or open the file “/etc/nfs.conf” and insert the following line:

nfs.server.mount.require_resv_port = 0

2. [Host] Edit the /etc/exports file and configure your desired share folder like this:

/Users/cb0/Sites -mapall=501:20 -network -mask

Replace “192.168.56” with the address you have chosen for your Host-only Adapter.

3. [Host] Run the following 3 commands:

> sudo nfsd update
> sudo nfsd checkexports
> showmount -e

The ‘showmount’ command will output something like this if everything went fine:

# Exports list on localhost:

4. [GUEST] Install necessary software. (As mentioned I use debian jessie)

sudo apt-get install nfs-common

5. [GUEST] Add the mount infos into the file /etc/fstab /Users/cb0/Sites nfs soft,intr,rsize=8192,wsize=8192 0 0

This tells debian to mount the directory /Users/cb0/Sites located on my host machine into the exactly same directory on my linux. (Note: You have to create the folder inside the guest first.) I do this for convenience, you could mount it somewhere else.

6. [GUEST] Now mount this share.

sudo mount /Users/cb0/Sites

and you are done.

After these simple steps and no other tuning my sf2 web project load in about 580ms. This is more than 70times faster than before.
I also noticed a small speedup in my other web apps. Now I can relax, sit back and continue my work on this project.

Create symlinks inside a VirtualBox shared folder

While working inside debian, which is installed inside a VirtualBox and shares a folder with it’s host machine, I repeatingly got errors while creating symlinks. (I use “os x 10.7” as host and “debian wheezy” as guest os.)

Until now I accepted it but today I got tired of creating these symlink in the host system.

Here’s the solution I found:

1. Shut down the virtual machine. Debian in my case.
2. You need to close the VirtualBox GUI.
3. Type this into your preferred command line.

VBoxManage setextradata DEBIAN VBoxInternal2/SharedFoldersEnableSymlinksCreate/FOLDER_SHARE 1

4. Reboot your virtual machine.
5. Enjoy the stunning power of symlinks again*

* You ask why again ? Because this was possible by default prior to VirtualBox 4.1.8. It has been added for additional security.

Port Forwarding to a VirtualBox Debian

Set up port forwarding:

VBoxManage modifyvm "VM name" --natpf1 "to_ssh,tcp,,22,,22"
VBoxManage modifyvm "VM name" --natpf1 "to_http,tcp,,80,,80"
VBoxManage modifyvm "VM name" --natpf1 "to_https,tcp,,443,,443"

Replace “VM name” and <GUEST IP> with your desired configuration. If your guest OS use DHCP then can be omitted. natpf1 stands is the network interface to use. In my case NAT is Network Adapter 1.

To remove them again:

VBoxManage modifyvm "VM name" --natpf1 delete "to_ssh"

‘VBoxManage’ should be installed on your host os by the VirtualBox installer.

debian root set display

it’s been a while since my last post …
here just a short solution of a problem i had with some debian boxes:


emacs /etc/inetd.conf
Invalid MIT-MAGIC-COOKIE-1 keyemacs: Cannot connect to X server :0.0.
Check the DISPLAY environment variable or use `-d'.
Also use the `xhost' program to verify that it is set to permit
connections from your machine.


cb0@localhost:~$ su -
root@localhost:~# xauth merge ~cb0/.Xauthority #replace cb0 with your username
root@localhost:~# export DISPLAY=:0.0
#now you are able to open emacs
root@localhost:~# emacs .bashrc

awk and word frequencys

I have a list that I use for making gnuplots. The structure is the following

wordId wordWeight

e.g. 101 34.342 = Word with id 101 has a calculated weight of 34.342 times.

The bad thing is that this list is unordered. Now I wan’t to order this list getting the greatest weight and their corresponding word id. Bash doens’t seem to be the best solution for this so I made up my first awk script.

Here is it, it prints the most common word from file toPlot.stats.

awk ‘ BEGIN{ max=0; w=-1 } { if ( $2 >= max) { max=$2; w=$1 } } END{ print “id”,w,”has  most often with count of”, max; }’ toPlot.stats

and the output:

id 1545 has greates weight with  28199.40186090438

My file has 1.722.913 lines, execution time:

real    0m1.618s
user    0m1.576s
sys     0m0.032s

move svn repository with revisions

When moving your favorite svn repository from Server A to Server B there are several possibilities. I use the following way which I think is the best.

1. Create a dump

svnadmin dump your_repository/ > your_repository.svn.dump

2. Somehow transfert your ‘dump’ file to the Server B

3. Create new svn repository on Server B

svnadmin create your_repository

4. Load your dump

svnadmin load your_repository < your_repository.svn.dump

that’s it

#move more than one svn repository at once
for repo in $(ls /home/web/svn)
svnadmin dump $i/ > $i.dump
scp $i.dump cb0@ServerB:/svn/
ssh -t cb0@ServerB svnadmin create /svn/$i
ssh -t cb0@ServerB svnadmin load /svn/$i < /svn/$i.dump

synergy, ssh and port forwarding

How to use synergy over ssh with a gateway server, or
How to make port fowarding over a gateway ?

Ok then, someone last week showed me the great tool “synergy”. With it, two ore more computers can be controlled by one keyboard and one mouse. So that’s nothing new.
The nice thing is that if you move your mouse over the boarder of screen 1 if will appear on screen 2 just like this screen was connected to your computer.
It’s working great and I wanted to have this everywhere my MacBook goes.
Setup and Config is real easy and descibed at

The problem is that it’s build upon a server client architecture and you need to have a direct connection between your server and your client. Yes well that should be no problem but I’m working in an office where the networks for hosted computers and the computers ones bring in  are seperated. The only option to get a connection from my macbook to the linux machine I’m sitting right next to, is a connection over a gateway Server that’s somewhere else.
So ssh from my macbook -> gateway
and then from gateway -> to office local linux box
But if i do it this way I won’t be able to establish a direct connection. After some research on the net I came up with this:
Box1 = MacBook
Box2 = Gateway Server
Box3 = office linux box

1st of all start the Server on Port 8033 (or sth. else), Type this on bash in BOX3

synergys -a localhost:8033 -f –config ../conf/synergy.conf

then make a port forwarding from Box2 port 8033 to Box3 port 22. Type this on bash in BOX1

ssh -L 8033:BOX3:22 cb0@BOX2

Then make a port forward from localhost port 24810 to port 8033 on localhost which redirects us directly to Box3. Type this on bash in BOX1

ssh -p 8033 -v -f -N -L localhost:24810:localhost:8033 cb0@localhost

Now on Box1 type this to connect synergy to localhost on port 24810 which redirects it to Box 3.

./synergyc -f localhost:24810

thats it.
Hope you enjoy your new productivity with synergy 😉

A nice project I thought of was to teach my macbook to atomatically connect to a specific server dependent on the enviroment i’m in. This should somehow be possible using apple script but at the moment I have no Idea how.