[ØMQ] Getting started with ØMQ and Python on Windows 7, x64

ØMQ (zeroMQ) is one of these sexy “new” Message Queue Systems. I wanted to dive into it right away, starting with Java. However, building zeroMQ with Java Binding on Windows 7, x64 is a pain (read: Did not work out fast enough – as I wanted to get my feet wet fast!) – so I switched over to Python. Well. Getting that to work is quite easy.

1.) Download and install latest zeroMQ
You can get the Windows Downloads on http://zeromq.org/distro:microsoft-windows, i choose the Stable Release 4.0.4 for Windows, x64 Release for Vista and newer. Just download and install it.

2.) Download and install Python
As I really like the 2.7 branch, I went for Python 2.7.9 which can be downloaded at https://www.python.org/downloads/.
You should install it with all default settings, but enable the “Add Python to System Path”.
After installation you should check that the Path Variables for your Python Install are added correctly, i.e. “C:\Python27;C:\Python27\Scripts”
( More information on how to add path variables on http://www.computerhope.com/issues/ch000549.htm)

3.) Download and install the Python Binding pyzmq
Open a cmd / command prompt and enter pip install pyzmq. That should install pyzmq.

4.) Final words
After that you can open your Python IDLE and start with some demo code, which can be found on the Github of pyzmq: https://github.com/zeromq/pyzmq/tree/master/examples

The getting started guide is also an awesome source of information:
http://zguide.zeromq.org/py:all

Common Problems:
If you get an “pip not found”, you most probably have not set the Path / Enviromental Variables correctly.

[RaspPi] Minibian Basic Setup

For basic appliances with an very specific task, an complete Raspbian Installation can be too heavy weight and unnecessary. Striping down Raspbian of things like Mathematica can be time consuming. Enter Minibian: Just download the Image at https://minibianpi.wordpress.com/ and flash it to your SD Card like a normal Raspbian Image. Following is the procedure to setup Minibian with raspi-config, rpi-update and sudo / Default User pi.

How much resources does Minibian need after installation?
About 469 MB of space on the SD Card.
About 60 MB of RAM.
I think that is way better than Raspbian.

apt-get update
apt-get install -y raspi-config
raspi-config
# Default Configuration and Expand Filesystem using raspi-config
# Enter Finish and press Yes on Reboot the Device

apt-get install -y rpi-update sudo
apt-get -y upgrade
reboot

rpi-update

# Create Default User pi
adduser pi
# Enter Password as wanted, i.e. raspberry
# Add user to default groups
usermod -a -G pi,adm,dialout,cdrom,audio,video,plugdev,games,users pi
# Add sbin Paths to pi
echo ‘export PATH=”$PATH:/sbin:/usr/sbin:usr/local/sbin”‘ >> /home/pi/.bashrc
# Add user to sudo
visudo
# Add under
# # User privilege specification
# root ALL=(ALL:ALL) ALL
pi ALL=(ALL:ALL) ALL
# Save and Exit
reboot

# Disable root login
sudo passwd -l root

[ESXi5.5U2] Install ESXi on VMWare Host with less than 4 GB of RAM

I found this solution in the Spiceworks VMWare Forum by User ZEFiR and after testing it succesfully with ESXi 5.5 Update 2, I wanted to preserve it for future use. The Original Post can be found
here. Thanks a lot to ZEFiR for sharing this very useful piece of knowledge :)!

1. Boot from VMware ESXi 5.5

2. wait “Welcome to theVMware ESXi 5.5.0 Installation” screen

3. Press Alt+F1 for enter console and login as “root” (no password needed)

4. go to:
cd /usr/lib/vmware/weasel/util/
delete file:
rm upgrade_precheck.pyc;

5. remove readonly flags:
mv upgrade_precheck.py upgrade_precheck.py.def
cp upgrade_precheck.py.def upgrade_precheck.py

6. set permissions:
chmod 755 upgrade_precheck.py

7. open script in ‘vi':
vi upgrade_precheck.py

8. find “MEM_MIN_SIZE”, pres “a” (edit mode. “(4 * 1024 – 32)” change to “(2 * 1024 – 32)”, pres ‘ESC’, run command “:wq” (save & exit)

9. look installer PID:
ps -c | grep weasel

10. kill installer (PID = process Nr.):
kill PID

Installer process run automatically (with modified config script).

Continue from “Welcome to theVMware ESXi 5.5.0 Installation”

SSH Socks Proxy

Very easy and handy is to use an SSH Server as Socks Proxy:
ssh -D 8080 username@my_ssh_server

Or use Putty:
Enter the IP Address of your SSH Server, Port and go to Connection -> SSH -> Tunnels.
In Source Port enter the Port where the Proxy should be available. I.e. 8080
Then choose “Dynamic”.
Leave Destination Port Empty and the IP Configuration on “Auto”.

After connecting to your SSH Server, you can configure i.e. Firefox to use your Socks 5 Server on IP 127.0.0.1 and Port 8080.

[RaspPi] Virtual Accesspoint on Xbian

Little How To to get an Virtual AP running on XBian.
I did NOT choose to install an DHCP Server on Xbian, as I just wanted to use the central one in my network.

1.) Install software
sudo apt-get update
sudo apt-get install install hostapd hostap-utils iw bridge-utils

2.) Update hostapd
cd ~
wget http://www.adafruit.com/downloads/adafruit_hostapd.zip
unzip adafruit_hostapd.zip
sudo mv /usr/sbin/hostapd /usr/sbin/hostapd.ORIG
sudo mv hostapd /usr/sbin
sudo chmod 755 /usr/sbin/hostapd

3.) Configure hostapd
sudo vi /etc/hostapd/hostapd.conf

interface=wlan0
bridge=br0
driver=rtl871xdrv
ssid=MY_SSID
hw_mode=g
ieee80211n=1
channel=11
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=3
wpa_passphrase=MY_PASSWORD
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP

sudo vi /etc/default/hostapd

Change
#DAEMON_CONF=””
to
DAEMON_CONF=”/etc/hostapd/hostapd.conf”
and save file

4.) Configure hostapd autostart
sudo update-rc.d hostapd enable

5.) Configure IPv4 Forward
sudo vi /etc/sysctl.conf

add
net.ipv4.ip_forward=1
to the end of the file and save

6.) Configure interfaces
# You will need to change the IP address and network to your networks settings!
sudo vi /etc/network/interfaces

auto lo br0
iface lo inet loopback

iface eth0 inet dhcp
allow hotplug wlan0
iface wlan0 inet manual

iface br0 inet static
bridge-ports eth0 wlan0
address 192.168.1.75
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1

7.) Configure rc.local for boot
sudo vi /etc/rc.local

add before exit 0

ifup br0
/etc/init.d/hostapd restart

save and exit

8.) Reboot
sudo reboot

Material used and thanks to:
https://learn.adafruit.com/setting-up-a-raspberry-pi-as-a-wifi-access-point/overview
http://www.instructables.com/id/How-to-make-a-WiFi-Access-Point-out-of-a-Raspberry/#step1
https://wiki.debian.org/BridgeNetworkConnections

Vagrant on Windows 7

So I wanted to try out some “new technologies” as Docker and Vagrant, so I decided to install Vagrant on my Windows 7 machine. It turned out to be not that “just install and go” as written down in the tutorial.

So, the short version to get you up and running:
1.) Install VirtualBox VirtualBox-4.3.12-93733-Win
Yes, 4.3.16 is current, no – you can’t use something higher than 4.3.12 because of an error with ssh…
2.) Install some software which comes with ssh
So if you haven’t installed git until, that should be the perfect time to do that.
Oh, and please include the bin folder with the ssh.exe in the PATH Variable of your Windows machine. Vagrant needs to call it to connect to your “VM”.
3.) Install Vagrant 1.6.5
4.) After doing all that, you should reboot your pc.

Your first vagrant session:
1.) Open up your CLI / cmd.exe
2.) Create an new folder and enter it
3.) Init vagrant, i.e.
vagrant init
4.) Start the vagrant vm
vagrant up

After all that, you will be able to connect to your VM with:
vagrant ssh

If you want to stop your machine, enter
vagrant destory

And that is it.
Oh, by the way: Vagrant may use VMWare Workstation instead of Oracles Virtual Box – if you’re willing to pay 79 Bucks per PC…

[Linux] Delete old SSH Keys and recreate them

If you are downloading an Linux Image for i.e. Embedded Systems like Raspberry Pi, sometimes, the SSH Keys are still on the system and are not recreated.
To do that manually, just enter:

sudo rm /etc/ssh/ssh_host_*
sudo dpkg-reconfigure openssh-server
sudo service ssh restart