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 even tell me they were NOT going to install ArchLinuxARM but just installed Raspbian instead. Well – that’s not a desaster, but they could at least have told me about it beforehand.

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).

Jun 272014
 
from ipaddress import IPv4Network, IPv6Network

a = IPv4Network('192.168.0.0/24')
b = IPv4Network('192.168.1.0/24')
c = IPv4Network('127.0.0.1')

x = IPv6Network('2000::/64')
y = IPv6Network('2000:0:0:1::/64')
z = IPv6Network('::1')

# -> https://gist.github.com/pklaus/8f702a6042f8f3fcf7e7
from iphelpers import optimize

nets = [a, b, c]
nets = optimize(nets)
# -> [IPv4Network('127.0.0.1/32'), IPv4Network('192.168.0.0/23')]

netsv6 = [x, y, z]
netsv6 = optimize(netsv6)
# -> [IPv6Network('::1/128'), IPv6Network('2000::/63')]

Resources

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

Kann direkt aus dem Browser gedruckt werden (bei 100%):

“Arbeitsblatt für die Tagesplanung”

(Nicht vergessen, beim Drucken einzustellen, dass keine URL, Datum etc. auf den Ausdruck kommen soll.)

Referenzen

Einige gedankliche Anstöße für die Art, das Blatt in HTML und CSS umzusetzen, habe ich aus dieser Vorlage für eine Rechnungserstellung in HTML entnommen: The HTML5 Invoice (2012-06-25). (Auch als html5-invoice auf Github zu finden.)

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

Printing with CUPS

sudo pacman -S cups gutenprint
sudo systemctl enable cups
sudo systemctl start cups

Go to http://localhost:631 and add printer as root

before that I installed cups-bjnp from AUR. don’t know if needed…

Scanning with Sane

Support is decent according to Sane:

Model Interface USB id Status Comment
PIXMA MP970 USB Ethernet 0x04a9/0×1726 complete All resolutions supported (up to 4800DPI). Full TPU support (negative and slides) at 24 or 48 bits.
pacman -S xsane

scanimage -L reports:

device `pixma:MP970_192.168.178.130' is a CANON Canon Pixma MP970 multi-function peripheral

./bjnp from cups-bjnp reports: