Aug 15: Tip for Git No. 1 - Copy files from one branch to the current
Since I have been working with git lately, I find myself searching the web for some little tweaks which are pretty handy during my work with git.
So let's see if there will be a No. 2, 3 or even more in this series.
Today I stumbled over this problem:
checked in a file -> switched branch -> needed this file also in current branch
Solution:
Now you have this file in this branch also. It's now like a new file which you can add to your branch.
So let's see if there will be a No. 2, 3 or even more in this series.
Today I stumbled over this problem:
checked in a file -> switched branch -> needed this file also in current branch
Solution:
git checkout [branch name] <file(s)>
Now you have this file in this branch also. It's now like a new file which you can add to your branch.
Jan 16: ARD-Mediathek offline
Ganz im Stil von ZDF-Mediathek offline jetzt auch was für die ARD.
Diesem Script einfach die Url der Mediatheksseite übergeben auf der sich der gewünschte Beitrag befindet. Somit kann man dem Depublizieren entgegenwirken.
#!/bin/sh
LINE=$(wget -q -O - $1 |grep "mediaCollection.addMediaStream(0, 2,")
MPATH=$(echo $LINE|sed 's/.*"\(.*\)");/\1/'|tr -d '\r')
URL=$(echo $LINE|sed 's/.*"\(.*\)",.*);/\1/'|tr -d '\r')$MPATH
OUTFILE=$(echo $MPATH|sed 's/.*\/\(.*\)/\1/').mp4
echo "Save $URL to $OUTFILE .."
flvstreamer -o $OUTFILE -r $URL -y $MPATH
Diesem Script einfach die Url der Mediatheksseite übergeben auf der sich der gewünschte Beitrag befindet. Somit kann man dem Depublizieren entgegenwirken.
Jan 15: IPv6 on OpenWRT based router
Recently I thought about playing around with IPv6 again, after I read the release notes from the latest openwrt firmware which runs on my wireless router. At first I was a little confused because there are multiple ways to provide your router and all the clients behind it with route-able IPv6 addresses even when your ISP just gives you a dial-in with one IPv4 address. There is for example 6in4 tunnel, which is a IPv4 point-to-point tunnel to a IPv6 broker which gives you a IPv6 address block for your internal network. The second way, which I choose, is 6to4. Here your router is configured to encapsulate each IPv6 packet in a IPv4 packet and sends it to a 6to4 relay server (and vice versa). You will not get a IPv6 address space from someone, you just take it by calculating it from you IPv4 address. The IPv6 address block which belongs to each IPv4 address starts with 2002: and counts about 1.2 septillion addresses.
For my setup I used my broadcom based wireless router with the latest openwrt firmware. After installing the packets 6to4, 6scripts, radvd and ip6tables I enabled IPv6 for the wan device using the web-interface. After that I attachted the following
to the file /etc/config/network.
After a reboot I could already verify the IPv6 connection with a ping6 ipv6.google.com at the router. Now when you reconnect your computer to the router you should notice that in addition to the IPv4 address your computer now has an additional IPv6 address also starting with 2002:. A ping6 ipv6.google.com should also work. When you now open a web browser using this page http://www.six.heise.de/netze/tools/ip you should see the very same IPv6 address on the website.
For my setup I used my broadcom based wireless router with the latest openwrt firmware. After installing the packets 6to4, 6scripts, radvd and ip6tables I enabled IPv6 for the wan device using the web-interface. After that I attachted the following
config 'interface' '6to4'
option 'proto' '6to4'
to the file /etc/config/network.
After a reboot I could already verify the IPv6 connection with a ping6 ipv6.google.com at the router. Now when you reconnect your computer to the router you should notice that in addition to the IPv4 address your computer now has an additional IPv6 address also starting with 2002:. A ping6 ipv6.google.com should also work. When you now open a web browser using this page http://www.six.heise.de/netze/tools/ip you should see the very same IPv6 address on the website.
Sep 19: Claws Mail and dark gtk themes
I recently switched to a darker gtk2 theme but claws mail did not look that good afterwards. The file tree view and the message listing had bright text color and the contrast to the background color was not good enough to read it clearly.
After some research I came up with the following fix:
Create a file called .gtkrc.mine in your home directory (it should be included via the file .gtkrc-2.0 at the same place) with this content:
Restart claws mail and the text color should have changed to #1F1F1F (you can choose a different color which fits better to your theme).
After this I could read claws mail better again :-)
After some research I came up with the following fix:
Create a file called .gtkrc.mine in your home directory (it should be included via the file .gtkrc-2.0 at the same place) with this content:
style "clawsfix"
{
fg[NORMAL] = "#1F1F1F"
}
class "*Tree*" style "clawsfix"
Restart claws mail and the text color should have changed to #1F1F1F (you can choose a different color which fits better to your theme).
After this I could read claws mail better again :-)
Nov 28: How to move Contacts and SMS from WindowsMobile to Android
First of all a short disclaimer: I've done all this for myself. This is no general solution but just for my own purpose. The code is really a hack I post it here just as an inspiration.
I got myself a new Smartphone with Android 2.0 and wanted to transfer all my Contacts and SMS from my old WM6 - without Google.
First the contacts: To transfer contacts, there is a wonderful standard called vcard. The android address book is able to import .vcf (vcard) files from the telephones sd card and WM6 can create a vcard if you send a contact via bluetooth. But there are three problems: 1. Android can't receive contacts via bluetooth, 2. WM6 can only send one contact at once, so it's no fun if you have more than 20 contacts and 3. the vcard implementation of WM6 is not correct, so that contacts exported like this can't be imported by android.
So the solution to export the contacts from the WM6 phone is the very good program PIM Backup, which I already used to backup the phone. The app stores its backups in a zip-compressed file, in which the data is stored in a plain text file. For each contact you have a new line and the values are stored separated with semi-colons.
I wrote some code in perl to convert the backup file to multiple vcard files, one for each contact. After this i just copied these files to the Android sd-card and used the contact import function.
Contact pictures are not supported, but feel free to extend and/or rewrite the code!
The second thing are the SMS: I again used the PIM Backup application to export the SMS, because WM6 has no solution to export SMS. The file structure is like the one from the contact backup, one line for each message, fields are separated with semi-colons. But this time there is a field with the message text inside and it the text contains a line break you'll have one in the backup file too. I edited the file with vim and its string substiturion function to replace line breaks in the message text with the string <BR>. In the perl script later on it will be replaced again to a line feed.
Now we have the input data, but how can we import it into the Android SMS software? There is no import function in the application itself, but there is a backup software for SMS in the Android Marketplace called SMS Backup & Restore. This app stores its backup in a very neat XML file called sms.xml.
My perl code now converts the backup file from the WM6 phone to the sms.xml format. All you have to do is replace the sms.xml on the sd-card with the generated on and restore it with the Android application. Et voila, all SMS are on the Android phone and it looks like you had received all the messages with this phone :-)
I got myself a new Smartphone with Android 2.0 and wanted to transfer all my Contacts and SMS from my old WM6 - without Google.
First the contacts: To transfer contacts, there is a wonderful standard called vcard. The android address book is able to import .vcf (vcard) files from the telephones sd card and WM6 can create a vcard if you send a contact via bluetooth. But there are three problems: 1. Android can't receive contacts via bluetooth, 2. WM6 can only send one contact at once, so it's no fun if you have more than 20 contacts and 3. the vcard implementation of WM6 is not correct, so that contacts exported like this can't be imported by android.
So the solution to export the contacts from the WM6 phone is the very good program PIM Backup, which I already used to backup the phone. The app stores its backups in a zip-compressed file, in which the data is stored in a plain text file. For each contact you have a new line and the values are stored separated with semi-colons.
I wrote some code in perl to convert the backup file to multiple vcard files, one for each contact. After this i just copied these files to the Android sd-card and used the contact import function.
Contact pictures are not supported, but feel free to extend and/or rewrite the code!
The second thing are the SMS: I again used the PIM Backup application to export the SMS, because WM6 has no solution to export SMS. The file structure is like the one from the contact backup, one line for each message, fields are separated with semi-colons. But this time there is a field with the message text inside and it the text contains a line break you'll have one in the backup file too. I edited the file with vim and its string substiturion function to replace line breaks in the message text with the string <BR>. In the perl script later on it will be replaced again to a line feed.
Now we have the input data, but how can we import it into the Android SMS software? There is no import function in the application itself, but there is a backup software for SMS in the Android Marketplace called SMS Backup & Restore. This app stores its backup in a very neat XML file called sms.xml.
My perl code now converts the backup file from the WM6 phone to the sms.xml format. All you have to do is replace the sms.xml on the sd-card with the generated on and restore it with the Android application. Et voila, all SMS are on the Android phone and it looks like you had received all the messages with this phone :-)
Nov 22: ZDF-Mediathek offline
Flash als Web-Technologie ist nett, aber nie für videoabspielen erfunden. Dementsprechend gut funktioniert es aus *hust*. Leider benutzen nur selten Webseiten den mit HTML5 dazugekommenen Video-Tag sondern eben Flash. Um die eingebetteten Videos aber dennoch ohne Flashplayer abspielen zu können kann man diese herunterladen und dann dem Player seiner Wahl vorwerfen. Für Youtube und Co gibt es da für Linux cclive.
Nun bieten die Öffentlich-Rechtlichen Fernsehsender ihre Sendungen auch Online an, ganz vorne dabei ZDF mit seiner Mediathek. Leider auf Grund des eher nationalen Charakters und der eingesetzten Streamingtechnologie (rtmp) nicht von cclive unterstützt.
Da heisst es selbst ist der Linux-Bastler :-)
Um ein Video aus der Mediathek herunterzuladen muss man zuerst die genaue Stream-URL herausbekommen. Wenn man den Firefox mit dem Plug-In Ad-Block Plus nutzt ist dies aber recht einfach: Man öffnet das Video seiner Wahl im Browser, öffnet dann das "blockable items" Fenster vom Ad-Block Plug-In und sucht nach smil. Die gefundene URL kopiert man sich nun und übergibt sie folgendem Script, welches ich geschrieben habe:
Anschließend beginnt der Download, der in seiner Geschwindigkeit nur vom eigenen Internetanschluss begrenzt wird :-) Zu beachten ist noch, dass man hierfür das Programm flvstreamer benötigt.
Nun bieten die Öffentlich-Rechtlichen Fernsehsender ihre Sendungen auch Online an, ganz vorne dabei ZDF mit seiner Mediathek. Leider auf Grund des eher nationalen Charakters und der eingesetzten Streamingtechnologie (rtmp) nicht von cclive unterstützt.
Da heisst es selbst ist der Linux-Bastler :-)
Um ein Video aus der Mediathek herunterzuladen muss man zuerst die genaue Stream-URL herausbekommen. Wenn man den Firefox mit dem Plug-In Ad-Block Plus nutzt ist dies aber recht einfach: Man öffnet das Video seiner Wahl im Browser, öffnet dann das "blockable items" Fenster vom Ad-Block Plug-In und sucht nach smil. Die gefundene URL kopiert man sich nun und übergibt sie folgendem Script, welches ich geschrieben habe:
#!/bin/sh
URL=$(wget -q -O - $1|grep 1700000 |sed 's/.*src=\"\(rtmp.*\.mp4\)\".*/\1/')
OUTFILE=$(echo $URL|sed 's/.*\/\(.*\)/\1/')
MPATH=$(echo $URL|sed 's/.*\(mp4:zdf.*\)/\1/')
flvstreamer -o $OUTFILE -r $URL -y $MPATH
Anschließend beginnt der Download, der in seiner Geschwindigkeit nur vom eigenen Internetanschluss begrenzt wird :-) Zu beachten ist noch, dass man hierfür das Programm flvstreamer benötigt.
May 31: PDF-Formulare in PDF speichern
Mir ist es jetzt schon vermehrt aufgefallen, dass es doof ist, wenn man PDF-Formulare ausfüllt, sie immer gleich drucken muss. Denn es kommt beim Öffnen des Dokuments immer ein riesen Hinweis, dass man die eingetragenen Daten nicht speichern kann.
Als Linuxuser denkt man sich: Dann drucke ich das doch einfach in eine PS-Datei und wandel diese nachträglich mit ps2pdf wieder in ein tolles PDF. Pustekuchen, denn Adobe schreibt beim Drucken irgendwas in die PS-Datei, sodass ps2pdf mit folgender Meldung den Dienst verweigert:
Nach einem Blick ins Internet bin ich auf folgende Lösung gestoßen:
In der Datei /usr/share/ghostscript/[VERSION]/lib/gs_pdfwr.ps sucht man nach den Zeilen
und ändert /pdfwrite in irgendetwas anderes, z.B. /pdfwritedrm.
Anschließend verrichtet ps2pdf ohne Zwischenfälle seinen Dienst wie gewohnt und man bekommt ein ausgefülltes PDF zurück.
Als Linuxuser denkt man sich: Dann drucke ich das doch einfach in eine PS-Datei und wandel diese nachträglich mit ps2pdf wieder in ein tolles PDF. Pustekuchen, denn Adobe schreibt beim Drucken irgendwas in die PS-Datei, sodass ps2pdf mit folgender Meldung den Dienst verweigert:
This PostScript file was created from an encrypted PDF file.
Redistilling encrypted PDF is not permitted.
Nach einem Blick ins Internet bin ich auf folgende Lösung gestoßen:
In der Datei /usr/share/ghostscript/[VERSION]/lib/gs_pdfwr.ps sucht man nach den Zeilen
% Patch 'where' so that the distiller operators are only visible
% if the pdfwrite device is the current one.
{ currentdevice .devicename dup /pdfwrite eq exch /ps2write eq or{
.where
und ändert /pdfwrite in irgendetwas anderes, z.B. /pdfwritedrm.
Anschließend verrichtet ps2pdf ohne Zwischenfälle seinen Dienst wie gewohnt und man bekommt ein ausgefülltes PDF zurück.
Jan 3: GKrellM-Ersatz: Conky

Conky wird in der Datei $HOME/.conkyrc konfiguriert. Im oberen Teil der Datei werden allgemeine Einstellungen vorgenommen, die das Verhalten (Refreshintervall, Fenstermodus, Position) von Conky beeinflussen. Ab dem Schlüsselwort TEXT wird alles formatiert in Conky dargestellt.
Man "formatiert" sich das Aussehen von Conky, wie man einen Text formatiert. Die verschiedenen Informationen erhält man hierbei in Variablen geliefert, die entweder nur Text oder auch ganze Graphen enthalten. Eine Übersicht aller Variablen gibt es hier: Conky Variablen
Für ein klein wenig Dynamik kann man if/else Klauseln einarbeiten, sodass einige Textbausteine nur unter bestimmten Bedingungen in Conky erscheinen. Mit $if_empty kann man beispielsweise eine Variable auf einen Leerwert überprüfen und gegebenenfalls nicht ausgeben lassen.
Wenn einem die Informationen die Conky sammelt, nicht ausreichen, kann man auch externe Programme ausführen lassen.
Im Großen und Ganzen gefällt mir Conky sehr gut, da man es sehr vielfälltig gestalten kann. Allerdings fehlt mir die Dynamik von GKrellM ein wenig, besonders was die Netzwerkkarteneinbindung betrifft. Man muss alle Devices per Hand einbinden und diese sind dann immer in Conky zu sehen, auch wenn sie nicht aktiv sind.
Ein $if_network, welches überprüft ob ein Device "up" ist, wäre schön gewesen.
Für alle, die ein wenig Anlaufhilfe bei der Konfiguration benötigen, hier meine conkyrc zum Schnuppern.
Nachtrag [2008-01-04]:
Soeben ist mir ein weiterer Vorteil von Conky ins Auge gefallen: Meine Akkulaufzeit verlängert sich.
Ich habe also gleich mal powertop gestartet und gesehen, dass die CPU mit Conky zu fast 90% im C4 Modus ist (ruhender Desktop). Mit GKrellM ist die CPU hauptsächlich in einem weniger tiefen Schlafzustand C2.
Dies macht ca. 1 Watt Mehrverbrauch aus oder grob überschlagen 20min Laufzeit.
Jan 17: GPS für Google Earth Linux
Vor einiger Zeit habe ich ein Tool gesucht, um mit Hilfe eines GPSEmpfängers die derzeitige Position in Google Earth anzeigen zu lassen.
Leider konnte ich nichts Dergleichen finden und die Plus Version, die GPS unterstützt, wollte ich mir nicht zulegen.
Also habe ich die tolle kmz Schnittstelle genutzt und ein wenig in Perl programmiert.
Heraus kam GPS2GEL, ein kleines Script das einen kleinen lokalen Webserver öffnet, auf welchem die aktuellen Koordinaten im GoogleEarth-Format zur Verfügung gestellt werden.
Man benötigt allerdings die Perlmodule Net::GPSD und HTTP::Daemon, die man aber leicht über CPAN oder als Debianpaket herunter laden kann.
Download: gps2gel.tar.bz2
Leider konnte ich nichts Dergleichen finden und die Plus Version, die GPS unterstützt, wollte ich mir nicht zulegen.
Also habe ich die tolle kmz Schnittstelle genutzt und ein wenig in Perl programmiert.
Heraus kam GPS2GEL, ein kleines Script das einen kleinen lokalen Webserver öffnet, auf welchem die aktuellen Koordinaten im GoogleEarth-Format zur Verfügung gestellt werden.
Man benötigt allerdings die Perlmodule Net::GPSD und HTTP::Daemon, die man aber leicht über CPAN oder als Debianpaket herunter laden kann.
Download: gps2gel.tar.bz2
Jan 13: RFID-Readersoftware für Linux

Deswegen habe ich mir vorgenommen eine eigene Software dafür zu schreiben. Alle nötigen Informationen dazu gibt es glücklicherweise vom Hersteller.
Ich habe mir gedacht das Ganze in C zu schreiben, mit einer Benutzeroberfläche in GTK2.

Ich bin selbst gespannt, was da heraus kommt, deshalb hab ich auch schon mal eine Preview von der Oberfläche erstellt :-)
In unregelmäßigen Abständen werde ich vom Fortschritt berichten.
Bleibt dran, ich hoffe ich werde es auch.
« previous page
(Page 1 of 1, totaling 10 entries)
next page »