zondag 19 mei 2013

history command without the history line numbers

A handy one-liner to remove history "line" numbers from the history command:


history | cut -c8-

Should work on any Linux, and probably other Unix-es too. Handy if you want to put your commands in a document.

HTH

zaterdag 4 mei 2013

Sony TV running Linux MIPS

Funny: in my webserver log there is this UserAgent logging:

"Opera/9.80 (Linux mips; U; InettvBrowser/2.2 (00014A;SonyDTV115;0002;0100) KDL32EX650; CC/NLD; nl) Presto/2.10.250 Version/11.60"

So apparently a Sony KDL-32EX650 LED TV is running Linux on MIPS?

zaterdag 30 maart 2013

Belastingaangifte op Ubuntu 64-bit

Op mijn Ubuntu 64-bit kreeg ik de volgende foutmelding toen ik de Belastingaangifte 2012 (downloaden) wilde starten:


$ ./ib2012ux 
bash: ./ib2012ux: No such file or directory

Handig. Not. 


sudo apt-get install libxext6:i386 libsm6:i386

Daarna lukt starten wel.

Tags: bdienst, BA, Linux, Ubuntu, 64-bit

zaterdag 23 maart 2013

Enrich your Ubuntu by creating short-hands for "sudo apt-get ..." commands:


Handy short-cuts for Ubuntu and Debian:

echo "alias sagusagu='sudo apt-get update && sudo apt-get upgrade'"  >> .bash_aliases

echo "alias sadu='sudo apt-get dist-upgrade'"  >> .bash_aliases
echo "alias sagi='sudo apt-get install $1'"  >> .bash_aliases


You now have three new commands (after starting a new shell):

  • sagusagu: updates and upgrades your system
  • sadu: does a dist-upgrade (needed if you see "kept back" messages)
  • sagi ... : installs a software package


I can now run my daily update by typing "sagusagu".

zondag 17 maart 2013

Ubuntu shortcuts for "sudo apt-get ..."

As I often use "sudo apt-get update && sudo apt-get upgrade" and "sudo apt-get install ...", I created some shortcuts for those commands:


-rwxr-xr-x 1 sander sander 27 mrt 17 12:10 /usr/bin/sadu*
-rwxr-xr-x 1 sander sander 25 mrt 17 12:09 /usr/bin/sagi*
-rwxr-xr-x 1 sander sander 45 mrt 17 12:08 /usr/bin/sagusagu*

with the following contents:


/usr/bin/sagusagu

sudo apt-get update && sudo apt-get upgrade


/usr/bin/sagi

sudo apt-get install $1


/usr/bin/sadu

sudo apt-get dist-upgrade


I can now run "sagusagu" to update & upgrade my Ubuntu system. :-)


zondag 2 december 2012

Software Defined Radio on Linux

Here are some easy steps to get Software Defined Radio (SDR) working on Linux for FM radio. No need to install drivers, and no need to dive into GNU Radio Companion (GRC).

Step 1 Get an USB stick that's SDR capable, so with the Realtek chipset RTL2838

I bought this one for 11 Euro on DX.com

http://dx.com/p/dvb-t-digital-tv-receiver-usb-dongle-w-fm-remote-control-antenna-black-149928



Step 2 Compile the SDR-RTL code

The make for rtl-sdr uses 'cmake', so the make is a bit different than with the normal make:


sudo apt-get install cmake libusb-1.0-0-dev

git clone git://git.osmocom.org/rtl-sdr.git

cd rtl-sdr/
mkdir build
cd build
cmake ../ -DINSTALL_UDEV_RULES=ON
make
sudo make install
sudo ldconfig

Now you should have the rtl_* executables installed. You can test that by typing "rtl" followed by pressing TAB.

Step 3 Tune to a frequency and listen to FM radio

Now you can listen to FM Radio, in the case below: 96.9 MHz:


$ rtl_fm -f 96.9e6 -W -s 150e3 -r 48e3 - | aplay -r 48k -f S16_LE -t raw -c 1 
Found 1 device(s):
  0:  Realtek, RTL2838UHIDIR, SN: 00000013

Using device 0: ezcap USB 2.0 DVB-T/DAB/FM dongle
Found Rafael Micro R820T tuner
Oversampling input by: 2x.
Oversampling output by: 4x.
Buffer size: 6.83ms
Tuned to 97215000 Hz.
Sampling at 1200000 Hz.
Output at 48000 Hz.
Tuner gain set to automatic.


I had to put the -s parameter to 150000 to get the best sound.

Remarks

I needed a good antenna (read: the cable company's) for a noiseless signal; the accompanied antenna resulted in a lot of noise.
My ultimate goal is to get DAB radio working.




vrijdag 30 november 2012

Expect script to execute commands on a Zyxel modem

Below is an 'expect' script to execute commands on a Zyxel modem (a Zyxel P-2812HNU-F1, to be precise), for example to find the ARP addresses or IP address in use.

Example usage:

expect zyxel-command.exp admin mypassword 192.168.1.254 'show arp'
expect zyxel-command.exp admin mypassword 192.168.1.254 'show hosts'

So, the general format is:

expect zyxel-command.exp admin

Example extended usage and output:


sander@R540:~$ expect zyxel-command.exp admin mypassword 192.168.1.254 'show arp' | grep Ether | grep br0 | sort
192.168.1.38     Ether       C      FC:0F:E6:55:E7:38  *        br0
192.168.1.39     Ether       C      28:37:37:54:0E:8D  *        br0
192.168.1.45     Ether       C      00:37:6D:01:ED:9A  *        br0
192.168.1.49     Ether       C      00:06:DC:44:57:F3  *        br0
192.168.1.50     Ether       CM     B8:27:EB:10:21:56  *        br0
192.168.1.52     Ether       CM     B8:27:EB:87:A0:A2  *        br0
192.168.1.54     Ether       C      18:F4:6A:9C:CE:D4  *        br0
192.168.1.60     Ether       C      5C:59:48:84:E4:16  *        br0
192.168.1.61     Ether       C      04:46:65:7A:9D:55  *        br0
sander@R540:~$


The full script:


#!/usr/bin/expect -f

set timeout 9

set timeout 9
set username [lindex $argv 0]
set password [lindex $argv 1]
set hostname [lindex $argv 2]
set command [lindex $argv 3]

if {[llength $argv] == 0} {
  send_user "Usage: scriptname username password hostname command\n"
  exit 1
}

spawn ssh $username@$hostname

match_max 100000
expect "password:"
send -- "$password\r"
expect "ZySH>"
send -- "$command\r"
expect "ZySH>"
send -- "exit\r"
expect eof



dinsdag 20 november 2012

Listening to FM radio via Software Defined Radio


Cool: I'm able to listen to FM radio using "Software Defined Radio" (SDR). With SDR, a computer does most of the radio/frequency handling (like demodulation). Thanks to Realtek, you only need a 12 Euro USB stick, and some open source software.

Command to listen to 98.9 MHz:


$ sudo rtl_fm -f 98900000 -W -s 200000 -r 48000 - | aplay -r 48k -f S16_LE -t raw -c 1
Found 1 device(s):
  0:  Realtek, RTL2838UHIDIR, SN: 00000013

Using device 0: ezcap USB 2.0 DVB-T/DAB/FM dongle
Found Rafael Micro R820T tuner
Oversampling input by: 2x.
Oversampling output by: 4x.
Buffer size: 5.12ms
Tuned to 99315000 Hz.
Sampling at 1600000 Hz.
Output at 48000 Hz.
Tuner gain set to automatic.
Playing raw data 'stdin' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono

Signal is quite noisy at the moment, but that is probably caused by a bad antenna.

zondag 11 november 2012

Calculating pi on the Pi

Here's a way to calculate pi (3.141592...) on the Raspberry Pi:

First get the source:

wget http://myownlittleworld.com/miscellaneous/computers/files/pi_css5/pi_css5_src.tgz
tar xvzf pi_css5_src.tgz
cd pi_css5_src/


If you would now run 'make', you would get errors. That's because of this line in Makefile:


CFLAGS += -march=i686 -malign-double


These flags are x86-only, which do not work on our Raspi's ARM. So let's get rid of that line: use an editor like vi or nano to comment out that line (put a # in front of it), or use the command line:


cp Makefile Makefile.org
sed -i -e "s/^CFLAGS +=/#CFLAGS +=/g" Makefile
grep march Makefile


The last command should now give (and note the "#" at the beginning of the line):

#CFLAGS += -march=i686 -malign-double

You should now run make:

make

If that goes without errors, the pi calculation can start:

./pi_css5 100000


The output should look like this:

pi@raspberrypi ~/pi_css5_src $ ./pi_css5 100000
Calculation of PI using FFT and AGM, ver. LG1.1.2-MP1.5.2a.memsave
initializing...
nfft= 32768
radix= 10000
error_margin= 0.000620286
calculating 131072 digits of PI...
AGM iteration
precision= 48: 0.48 sec
precision= 80: 0.49 sec
precision= 176: 0.48 sec
precision= 352: 0.49 sec
precision= 688: 0.48 sec
precision= 1392: 0.49 sec
precision= 2784: 0.48 sec
precision= 5584: 0.49 sec
precision= 11168: 0.48 sec
precision= 22336: 0.49 sec
precision= 44688: 0.48 sec
precision= 89408: 0.49 sec
precision= 178816: 0.48 sec
writing pi131072.txt...
7.61 sec. (real time)
pi@raspberrypi ~/pi_css5_src/ $ 


So that's 131072 digits of PI in 7.61 seconds. The result is in the file pi131072.txt

FWIW: on my laptop with Core i3 M370 2.40GHz laptop the same calculation only takes 0.29 seconds ...


dinsdag 9 oktober 2012

NNTPgrab on Raspberry Pi with Raspbian

NNTPgrab is a program to download and process NZB files from newsservers. Below is a instruction how to get NNTPgrab running on a Raspberry Pi with Raspbian armhf.

The easy way: use the precompiled binary:

sudo dpkg -i nntpgrab_0.7.2-1_armhf.deb 
sudo ldconfig 

nntpgrab_gui 
nntpgrab_server

That should work.



However, if you would like to compile your own NNTPgrab (which can take quite some time), do this:

sudo apt-get update
sudo apt-get install libgtk-3-dev libsoup2.4-dev intltool libsoup-gnome2.4-dev par2 libgnutls-dev

bunzip2 nntpgrab-0.7.2.tar.bz2 
tar xvf nntpgrab-0.7.2.tar 
cd nntpgrab-0.7.2/

./configure
make
sudo make install


You might need this:


sudo ldconfig


If you want to create your own *deb file, continue with:

sudo apt-get install checkinstall
sudo checkinstall -D make install
ls -al nntp*deb


HTH

zondag 23 september 2012

Raspberry Pi: overclocking made easy

You can overclock the Raspberry Pi by setting a few parameters in /boot/config.txt . See http://elinux.org/RPi_config.txt for details.

In the new Raspbian distribution the overclocking has been really easy: the config tool "raspi-config" has an overclock menu item. By selecting that menu item, you can select which overclock config you want.

You can monitor at which speed the CPU is running by:


pi@raspberrypi ~ $ cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
900000
pi@raspberrypi ~ $

The CPU frequency will only be higher when it needs to.

See screenshots below.



woensdag 29 augustus 2012

Running FirefoxOS b2g on a Raspi with Raspbian armhf

On http://eva-quirinius.blogspot.nl/2012/08/installing-firefoxos-on-raspi.html I gave a description how to run FirefoxOS on a Raspi with Wheey armel. Thanks to Oleg, there is now a FirefoxOS b2g for Raspbian armhf. Here's an instruction how to get it running.

First get and unpack b2g for armhf:

cd
tar -xvzf b2g-17.0a1.linuxgl-gnueabi-armhf_v6.tar.gz 
cd b2g/
ldd b2g

The last command should give a output look below. Note the "hf" in the libraries:

pi@raspbian-armhf-SJ ~/b2g $ ldd b2g
/usr/lib/arm-linux-gnueabihf/libcofi_rpi.so (0x40207000)
libpthread.so.0 => /lib/arm-linux-gnueabihf/libpthread.so.0 (0x400d3000)
libdl.so.2 => /lib/arm-linux-gnueabihf/libdl.so.2 (0x400f2000)
libstdc++.so.6 => /usr/lib/arm-linux-gnueabihf/libstdc++.so.6 (0x400fd000)
libm.so.6 => /lib/arm-linux-gnueabihf/libm.so.6 (0x40210000)
libgcc_s.so.1 => /lib/arm-linux-gnueabihf/libgcc_s.so.1 (0x401ca000)
libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0x40281000)
/lib/ld-linux-armhf.so.3 (0x400a0000)
pi@raspbian-armhf-SJ ~/b2g $ 

Then get and unpack the profile (while you're still in the ~/b2g directory)

tar xvzf profile.tar.gz 

Then (still in ~/b2g) start b2g, which needs an environment variable set:

LD_LIBRARY_PATH=/opt/vc/lib:/home/pi/b2g:$LD_LIBRARY_PATH ./b2g -profile profile

That should give the FirefoxOS screen on your Raspbian running Raspi.

Here's a ugly screendump of it running on my CRT TV. If you a HDMI display, things should work fine.



Update:

Thanks to Oleg, I used the "--screen=" option to get a much better display

LD_LIBRARY_PATH=/opt/vc/lib:/home/pi/b2g:$LD_LIBRARY_PATH ./b2g -profile profile --screen=656x545

Result:



A bit of explanation: if you don't specify --screen, b2g uses the default value "320x480".

The image is still a bit off-screen on the left side. I tried to solve that with the overscan parameters in /boot/config.txt, but that doesn't influence b2g.

PS: If you get

pi@raspbian-armhf-SJ ~/b2g $ ./b2g -profile profile
XPCOMGlueLoad error for file /home/pi/b2g/libxpcom.so:
libxul.so: cannot open shared object file: No such file or directory
Couldn't load XPCOM.
pi@raspbian-armhf-SJ ~/b2g $

you did not set the LD_LIBRARY_PATH environment variable like I described. Or libxul.so is not in the directory LD_LIBRARY_PATH is pointing to (/home/pi/b2g).


dinsdag 21 augustus 2012

Reminder: Duitse films "Edition Deutscher Film" kijken!

Zo, lijstje van 50 Duitse top-films. Uitgegeven op een DVD-reeks "Edition Deutscher Film" (zie foto), dus vast her en der verkrijgbaar.

01 Der letzte Mann (Friedrich, Wilhelm Murnau, 1924)
02 Metropolis (Fritz Lang, 1926)
03 M - Eine Stadt sucht einen Mörder (Fritz Lang, 1931)
04 Die Mörder sind unter uns (Wolfgang Staudte, 1946)
05 Die Sünderin (Willi Forst, 1950)
06 Der Untertan (Wolfgang Staudte, 1951)
07 Der Verlorene (Peter Lorre, 1951)
08 Des Teufels General (Helmut Käutner, 1955)
09 Die Halbstarken (Georg Tressler, 1956)
10 Das Mädchen Rosemarie (Rolf Thiele, 1958)
11 Es geschah am hellichten Tag (Ladislao Vajda, 1958)
12 Die Brücke (Bernhard Wicki, 1959)
13 Der junge Törless (Volker Schlöndorff, 1966)
14 Spur der Steine (Frank Beyer, 1966)
15 Rote Sonne (Rudolf Thome, 1969)
16 Katzelmacher (Rainer Werner Fassbinder, 1969)
17 Aguirre - Der Zorn Gottes (Werner Herzog, 1972)
18 Die Legende von Paul und Paula (Heiner Carow, 1973)
19 Lina Braake (Bernhard Sinkel, 1975)
20 Die verlorene Ehre der Katharina Blum (Volker Schlöndorff und Margarethe von Trotta, 1975)
21 Im Lauf der Zeit (Wim Winders, 1976)
22 Nordsee ist Mordsee (Hark Bohm, 1976)
23 Deutschland im Herbst (A. Kluge, Volker Schlöndorff, Rainer Werner Fassbinder..., 1978)
24 Die Ehe der Maria Braun (Rainer Werner Fassbinder, 1978)
25 Die Blechtrommel (Volker Schlöndorff, 1979)
26 David (Peter Lilienthal, 1979)
27 Lili Marleen (Rainer Werner Fassbinder. 1980)
28 Theo gegen den Rest der Welt (Peter F. Bringmann, 1980)
29 Die bleierne Zeit (Margarethe von Trotta, 1981)
30 Das Boot (Wolfgang Petersen, 1981)
31 Christiane F. - Wir Kinder vom Bahnhof Zoo (Uli Edel, 1981)
32 Die weisse Rose (Michael Verhoeven, 1982)
33 Fitzcarradlo (Werner Herzog, 1982)
34 Stammheim (Reinhard Hauff, 1986)
35 Der Himmel über Berlin (Wim Wenders, 1987)
36 Out of Rosenheim (Percy Adlon, 1987)
37 Jenseits der Stille (Caroline Link, 1996)
38 Die innere Sicherheit (Christian Petzold, 2000)
39 Die Stille nach dem Schuss (Volker Schlöndorff, 2000)
40 Die Unberührbare (Oskar Roehler, 2000)
41 Good bye, Lenin! (Wolfgang Becker, 2003)
42 Gegen die Wand (Fatih Akin, 2004)
43 Alles auf Zucker! (Dani Levy, 2005)
44 Der freie Wille (Matthias Glasner, 2006)
45 Sehnsucht (Valeska Grisebach, 2006)
46 Vier Minuten (Chris Kraus, 2006)
47 Wer früher stirbt, ist länger tot (Marcus H. Rosenmüller, 2006)
48 Auf der anderen Seite (Fatih Akin, 2007)
49 Yella (Christian Petzold, 2007)
50 So glücklich war ich noch nie (Alexander Adolph, 2009)

Foute informatie van Telfort over Interactieve TV Online

Telfort zegt op https://www.telfort.nl/internet/interactieve-tv/ het volgende:

Interactieve TV Online kijken op je computer of tablet

Met Interactieve TV Online kijk je via je eigen internetverbinding de 20 meest populaire zenders via je computer, iPad of Android tablet.

Dat klopt niet: Ik heb iTV van Telfort, maar ik kan geen TV kijken op mijn computer of Android tablet. Waarschijnlijke redenen: 
  • mijn computer draait Linux, en daarvoor levert Microsoft geen Silverlight DRM. Resultaat: via http://telfort.itvonline.nl/ krijg ik een foutmelding. Zie screendump.
  • de Telfort TV app lijkt alleen beschikbaar voor Android tablets van Samsung. Voor mijn Android tablet zegt Google Play  "This item is not compatible with your device."


Dus: de correcte uitspraak van Telfort zou zijn:

Interactieve TV Online kijken op je computer of tablet

Met Interactieve TV Online kijk je via je eigen internetverbinding de 20 meest populaire zenders via je Windows-computer, iPad of Samsung Android tablet.

Het zou netter en duidelijker zijn als Telfort dat zo zou communiceren.

PS: Ik weet niet of Telfort TV het wel doet op Max OS X. Als iemand daar ervaring mee heeft, dan hoor ik het graag.