orreMBA 2014-04-17 kl. 10.35.42

Docker image “WordPress NGiNX SSH” updated

Yesterday I updated my Docker image docker-wordpress-nginx-ssh github so it adds memcached and the superb WordPress plugin WP-FFPC to WordPress.

This makes NGiNX serve cached pages straight from memcached without going into PHP and WordPress. It’s amazingly fast (try to reload this page you’re on now).

One thing though, you have to login and press the “Save” button on the settings page of WP-FFPC to activate it. But that’s all there’s to it, all NGiNX settings are already there.

To try it, just type docker pull oskarhane/docker-wordpress-nginx-ssh or to start a container straight away: sudo docker run -p 80 -p 22 -d -t oskarhane/docker-wordpress-nginx-ssh

Matrix in the terminal

Paste this your terminal.

echo -e "\e[1;40m" ; clear ; while :; do echo $LINES $COLUMNS $(( $RANDOM % $COLUMNS)) $(( $RANDOM % 72 )) ;sleep 0.05; done|awk '{ letters="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#$%^&*()"; c=$4; letter=substr(letters,c,1);a[$3]=0;for (x in a) {o=a[x];a[x]=a[x]+1; printf "\033[%s;%sH\033[2;32m%s",o,x,letter; printf "\033[%s;%sH\033[1;37m%s\033[0;0H",a[x],x,letter;if (a[x] >= $1) { a[x]=0; } }}'

orreMBA 2014-04-02 kl. 10.35.49

Inspecting the firmware of a D-Link DWR-923 4G Modem

This will be a step by step on how to extract different parts of the firmware on a D-Link 4G router. This is just for fun and out of curiosity to see what they are using.

First, let get some tools. When inspecting/extracting and reverse engineering something you can’t live without a tool called binwalk. I downloaded 1.2.2 from here and after brew install libmagic I got it to compile on OS X Mavericks.

Remember to edit your ~/.bash_profile and add export PYTHONPATH=/usr/local/lib/python2.7/site-packages:$PYTHONPATH to it to get it to compile.

The firmware for the modem I got from this Swedish tech site.

Read more…

orreMBA 2014-03-28 kl. 11.05.04

Nginx as a reverse proxy in front of your Docker containers

I have and create a lot of WordPress sites for clients. As of now, I manually create new Docker container, create a nginx (or HAProxy) config file so the site can be reached on port 80 from the outside. And it’s a pain.

So I created this Python script that takes care of the container and config file creation. All you have to do i to reload nginx and the site will be up.

Check it out: Script to create wordpress docker container and nginx config file as reverse proxy.

This image illustrates what the setup will look like.
nginx reverse proxy

Here’s how you use it.

Read more…

orreMBA 2014-03-20 kl. 10.02.34_orreMBA.local_Mar-20-1004-2014_Conflict

Going from audio to waveform image and back to audio

In my last post I showed how I found a great audio to waveform plugin and I also created a .PNG image with the waveform so I could save it.
But what if I wanted to read the waveform and create audio from it, i.e. convert it back.

The sampling frequency / resolution of the waveform plays a important role of course. In my last post the resolution was 100 pixels / second which is way too low (CD quality would be 44100 px/s).
Since it’s Javascript run in the browser it takes some time to generate an waveform image of decent resolution. My MBA seemed to take a resolution of 4000 px/s but not more.
So, I had to go with that.

Read more…