Piping a cyphered gzipped sql file into MySQL

$ gpg -d /path/to/file.sql.gz.gpg | gunzip | mysql -u root mydb

and the other way round

$ mysqldump -u root mydb | gzip | gpg -e -r my@id.com > mydb.sql.gz.gpg

Replace accordingly 🙂

Advertisements

Convert hi-res/hdtv video for mobiles

Here’s how to convert and HDTV/Hi-Res video into one that can be easily viewed onto a limited resources hardware like a mobile.

It uses ffmpeg. To install it on debian-like

$sudo aptitude install -P ffmpeg

while to convert the video

ffmpeg -i holiday.avi -sameq -s wvga -ac 2 -ab 192K holidays-low.avi

it works as well with mkv files.

if you get the message like

[mpeg4 @ 0x99e1e80]timebase not supported by mpeg 4 standard

try adding the following flag before the output file

-r 25

Weekly link 2011-08

AeroVironment/DARPA Nano Hummingbird UAV flying

Hello JavaFX 2! – A TableView Component

London Stock Exchange in historic Linux go-live

Microsoft: Absolutely NO (GPLv3-or-compat-licensed) Free Software for Windows Phone and Xbox Apps.

BMW Wants to Be the Ultimate Green Machine

Intel’s Light Peak May See the Light This Week.

Intel details Thunderbolt, says Apple has full year head start

LaCie announce Intel Thunderbolt-equipped Little Big Disk

Ubuntu and Compose Key on macbook

Ok, it seems there’s a bug in ubuntu 9.10 (and maybe earlier) with the apple macbook keyboard. The goal should be to map the right command (apple) key as ALT-GR.

A simple workaround is getting to System->Preferences->Keyboard. Select the Layout tab and layout options. Then select the key to choose 3rd level and enter on keypad. Now you can use the enter key (just beside the right apple key) as ALT-GR.

Install Ubuntu (9.10) via Floppy

Introduction

If you  are in hurry you can skip this section. 🙂

I had an old laptop with no capabilities of booting via USB and with a broken cd-rom, but a working floppy. So the main goal was to boot the computer from a floppy then tell the computer to boot via the ubuntu live installed on an USB key.

What you need.

  • A computer that can boot from cd and a USB port.
  • A computer with a running floppy drive.
  • An empty USB key (>=1Gb).
  • An empty Floppy (1.44Mb).

Create the bootable USB

Boot the pc with the desktop live cd-rom. Plug-in the empty usb key and make it bootable. From Applications menu there’s a voice like create USB key. Otherwise you can have a look at the Installation from USB stick on ubuntu official site.

Create the bootable floppy

I’ve tried many way to have a bootable floppy, that can recognize the USB key for booting (dsl, sbm, …) but the only one that had worked was: plop bootmanager. As advised me on the TiLUG Mailing List (Italian).

Download the latest version of plop boot manager (at the time of writing: 5.0.5), expand the obtained zip wherever you like and write the image on the floppy: dd if=plpbt.img of=/dev/fd0.

Booting

Now insert floppy, plug the usb key into the computer with broken cd-rom and boot it via floppy. When asked, select USB from the menu and that’s all folks!

Make an ISO image

Here is how to create an ISO image (file .iso) on your hard disk. Useful when needed to make multiple copy of a CD. The following example starts create it directly from CD but since in Linux everything is a file… 🙂

mkisofs -D -o ~/my-cool-cd.iso /cdrom

the -D option allow the deep ISO9660 directory nesting.

You can easily use this command even from windows by installing the cygwin with the mkisofs package.

UPDATE

The command above it’s a bit strict. In order to create a more “relaxed” cd-rom you could use the following command

mkisofs -l -D -N -relaxed-filenames -V “Volume Label” -o ~/my-cool-cd.iso /cdrom

Here the options:

  • -l: Allow full 31-character filenames.  Normally the  ISO9660
    file-name  will  be in an 8.3 format which is compatible with MS-DOS,
    even though the ISO9660 standard allows filenames of  up  to  31
    characters.   If  you use this option, the disc may be difficult to
    use on a MS-DOS system, but will work on most other  systems. Use
    with caution.
  • -D: Do not use deep directory relocation, and instead just pack them in
    the way we see them. If ISO9660:1999 has not been selected, this
    violates the ISO9660 standard, but it happens to work on many
    systems.  Use with cau- tion.
  • -N: Omit version numbers from ISO9660 filenames. This  violates  the
    ISO9660 standard, but no one really uses the version numbers anyway.
    Use with caution.
  • -relaxed-filenames: Allows  ISO9660  filenames to include all 7-bit
    ASCII characters except lowercase letters. This violates the ISO9660
    standard, but it happens  to  work  on many systems.  Use with
    caution.