Aug 272014
 

This post is based on my previous blog post, Updating DNS Entries (with nsupdate or alternative implementations) – Run Your Own DDNS, and on Cédric Félizard’s post “Your Own Dynamic DNS“.

Running your own DynDNS (DDNS) server is easy when you have your own domain registered and an own Linux server up and running. A .de domain, for example, costs only about 6 EUR per year if you register at an inexpensive domain hoster in Germany. Let’s say you have registered example.com. Now you can use a subdomain such as d.example.com to contain all your dynamic IPs. An individual host could then be named something like eric.d.example.com. The advantage of using a subdomain .d.example.com instead of example.com itself is that you can refer the authority for this subdomain to your own server while the upper zone example.com can still be managed by the DNS hoster. The following sections will describe how to set this up in detail.

Aug 262014
 

Since Python 3.3 venv is a module found in the standard library of Python. It can replace virtualenv / virtualenvwrapper. Creating a virtual environment is as simple as this:

python3 -m venv ~/.pyvenv/iplogger-3.4
source ~/.pyvenv/iplogger-3.4/bin/activate
# I didn't need the step below, don't know when it is required:
#curl https://raw.githubusercontent.com/pypa/pip/master/contrib/get-pip.py | python

### If you want to include site packages of your system:
python3 -m venv --system-site-packages ~/.pyvenv/system-3.4
source ~/.pyvenv/system-3.4/bin/activate
# I didn't need the step below, don't know when it is required:
#curl https://raw.githubusercontent.com/pypa/pip/master/contrib/get-pip.py | python

Resources

Aug 262014
 

This is a follow up post for that one: Hosted Raspberry Pi at PCExtreme – Reinstalled with Raspbian.

I crashed my original OS and asked the kind people at PCExtreme to reinstall my RPi. They did and here is what I did when I received the credentials for the newly set up system:

elk:WhatsMyIP pklaus$ ssh root@bigpi
Warning: Permanently added the RSA host key for IP address '36.29.81.60' to the list of known hosts.
root@bigpi.klaus.pw's password: 
Welcome to Arch Linux ARM

     Website: http://archlinuxarm.org
       Forum: http://archlinuxarm.org/forum
         IRC: #archlinux-arm on irc.Freenode.net

Last login: Wed Dec 31 17:01:01 1969 from firewall-gyro.office.pcextreme.nl

OK, so the time is not correct, but that can be fixed. They connected from firewall-gyro.office.pcextreme.nl last time for login.

Aug 182014
 

My Raspberry Pi running Arch Linux ARM hosted by PCExtreme in the Netherlands wasn’t reachable anymore after a forced reboot from their side. Most probably I didn’t adapt the configuration of the static IP to newer releases of the network configuration system when I installed upgrades on the RPi. The forced reboot then meant that the system didn’t come up anymore or that it didn’t set the IP right. So I asked them if they could reinstall the operating system on the SD card (preferably Arch Linux ARM). They told me they could reinstall the OS and asked me if I wanted to pay 24,20 EUR (incl. tax). I said Yes and had my RPi up and running again. But this time on Raspbian. They didn’t tell me they were NOT going to install ArchLinuxARM but just installed Raspbian instead. I was using it for some days (how I set it up is described in this post) but then asked via email if they could install it with Arch Linux ARM as requested. They did and now I’m back on Arch Linux ARM.

Aug 152014
 
showmount -e 192.168.12.162
sudo mkdir /private/nfs

sudo mount -o rw,resvport -t nfs 192.168.12.162:/NASdata /private/nfs
#or
sudo mount -o rw -t nfs 192.168.12.144:/mnt/md1 /private/nfs

open /private/nfs

If you cannot write to the share, your numeric user ID may not match a user on the target machine and thus you may not have permission to write to the directory. Fix it by setting chmod 777 /mnt/md1.

Resources

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
Aug 142014
 

Check out OpenWRT port for Raidsonic IB4220 and IB4210

OpenWrt images to download

Getting started

Setting up the disks

Partitioning and RAID

ssh root@yak
dev=/dev/sda
parted -s $dev mktable gpt
parted -s $dev mkpart primary 2MiB 512MiB
parted -s $dev mkpart primary 512MiB 100%
parted -s $dev set 1 raid on
parted -s $dev set 2 raid on
parted -s $dev unit MiB print

mdadm --create --verbose --level=1 --metadata=1.2 --raid-devices=1 --force /dev/md0 /dev/sda1
mdadm --create --verbose --level=1 --metadata=1.2 --raid-devices=1 --force /dev/md1 /dev/sda2

mdadm /dev/md0 -Gb internal
mdadm /dev/md1 -Gb internal

mkfs.xfs /dev/md1

Set up the mount point in the web interface at System -> Mount Points. You can mount /dev/md1 to /mnt/md1, for example.

Aug 122014
 

Network Call Monitor

http://www.wehavemorefun.de/fritzbox/Callmonitor

Activate the feature by calling:

#96*5*    activate call monitor support
#96*4*  deactivate call monitor support

Then you can connect to the FB7490 and get notified about calls:

nc 192.168.178.1 1012
# or on Mac OS X:
nc 192.168.178.1 1012

Keycodes

http://www.wehavemorefun.de/fritzbox/Tastencodes (German)

Sending a FAX (from the command line)

It seems like capifax does not exist anymore?
https://zignar.net/2012/04/16/capifax/

It would basically work like this:

Activate CapiOverTCP by calling #96*3* and test it using Telnet: telnet fritz.box 5031

Aug 122014
 
# Install memcached on Arch Linux ARM:
pacman -S memcached
# Start the memcached daemon:
memcached -d -m 128 -l 127.0.0.1 -p 11211 -u nobody
# Install the memcache bindings for Python3:
pip install python3-memcached

Now modify your application to include the following:

# ... create Bottle app object

import memcache
MC = memcache.Client(['127.0.0.1:11211'], debug=0)
MC_PREFIX = "PBMC_"
MC_NS_KEY = MC.get(MC_PREFIX + "namespace_key");
if not MC_NS_KEY :
    MC_NS_KEY = 1
    MC.set(MC_PREFIX + "namespace_key", MC_NS_KEY)
def caching(callback):
    def wrapper(*args, **kwargs):
        if request.path.startswith('/some/path/to/cache') or \
          request.path.startswith('/other/path'):
            key = MC_PREFIX + str(MC_NS_KEY) + request.path
            obj = MC.get(key)
            if not obj:
                obj = callback(*args, **kwargs)
                MC.set(key, obj)
            return obj
        else:
            return callback(*args, **kwargs)
    return wrapper

# add caching plugin to the Bottle app
app.install(caching)
Jul 112014
 

With Python Standard Library Methods

http://www.swharden.com/blog/2011-07-08-create-mono-and-stereo-wave-files-with-python/

from struct import pack
from math import sin, pi
import wave
import random

RATE=44100

## GENERATE MONO FILE ##
wv = wave.open('test_mono.wav', 'w')
wv.setparams((1, 2, RATE, 0, 'NONE', 'not compressed'))
maxVol=2**15-1.0 #maximum amplitude
wvData=b""
for i in range(0, RATE*3):
   wvData+=pack('h', round(maxVol*sin(i*2*pi*500.0/RATE))) #500Hz
wv.writeframes(wvData)
wv.close()

## GENERATE STERIO FILE ##
wv = wave.open('test_stereo.wav', 'w')
wv.setparams((2, 2, RATE, 0, 'NONE', 'not compressed'))
maxVol=2**15-1.0 #maximum amplitude
wvData=b""
for i in range(0, RATE*3):
   wvData+=pack('h', round(maxVol*sin(i*2*pi*500.0/RATE))) #500Hz left
   wvData+=pack('h', round(maxVol*sin(i*2*pi*200.0/RATE))) #200Hz right
wv.writeframes(wvData)
wv.close()

With scikits.audiolab

References

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
Jul 042014
 

Alain Kelder mentioned this command employing mencoder in his blog post (see resources section):

MOVIE=your-movie.mp4
mencoder -fps 60 -nosound -ovc copy $MOVIE -o $(basename -s .mp4 $MOVIE)_60p_no-re-enc.mp4

Alternatives

Or use MP4Box if it’s available for your platform:

# http://askubuntu.com/a/370826/6326
MP4Box -add source.mp4#video -raw 1 -new test
# Then save it as an MP4 again:
MP4Box -add test_track1.h264:fps=30 -new dest.mp4). You

(Alternative) Commands that DO re-encoding

If you are OK with re-encoding, however, you can also use ffmpeg:

MOVIE=your-movie.mp4
ffmpeg -i $(basename -s .h264 $MOVIE).mp4 -r 60 -filter:v "setpts=(1/20)*PTS" $(basename -s .h264 $MOVIE)_60p_re-enc.mp4

assuming the input file has a framerate of 3 fps and the one to write should have 60 fps (thus speedup = 60/3 = 20).