bubbles

BASH script collection

In den letzten Jahren als Linux User hat sich bei mir eine kleine Toolbox aus BASH (Bourne Again Shell)  Skripten angesammelt. Einige habe ich bereits in Blog-Posts vorgstellt. Jetzt habe ich sie mal in einem git-Repository zusammengefasst.

Viel Spaß damit!

fnordlicht vu meter

Last time, I showed you my new fnordlicht’s. Today, I’ve a little gift for you: I’ve written a small c program to control the lights according to the current peak level.

The software analyses the audio signal of my system (Ubuntu 10.10 with pulseaudio). So you can dance to everything that can play audio..

Update: As preparation for a exam, I added a discrete fourier analysis (DFT). Unfortunatly the serial bus is to slow to visualize the audio spectrogram in real time The bars are colored with their complex phase->hue (HSV) aquivalent.

The software uses and is distributed together with my fnlib (fnordlicht library) available under: http://web.git.0l.de/libfn.git

Some technical details (in german):

Ich benutze PulseAudio um mich in die Soundkarte des Systems einzuklingen. Das Programm tarnt sich als Recording-Tool. Und kann dadurch den kompletten Audio-Output oder nur bestimmte Programme visualisieren. Sogar das Mikrofon kann ich benutzen :p

PulseAudio liefert mir einen einfachen PCM Stream (44,1kHz Samplingrate, Mono & 16-Bit signed Integers). Derzeit addiere ich immer nur x Werte dieses Bytestreams und mittele diese Summe dann über einen kurzen Zeitraum.

Geplant ist noch eine FFT-Analyse um  die Amplituden verschiedener Frequenzen gemäß der “Ohrkurve”, der Empfindlichkeit des menschlichen Gehörs, gewichten zu können. Der Schritt zur Spektraldarstellung (jedes meiner 10 fnordlichter als VU-Meter für ein bestimmtes Frequenzband) ist dann hoffentlich auch nicht mehr so weit.

Ohrkurve

Hints (for me)

simple mounting of encrypted partitions with encrypted keyfiles

My external HDDs are encrypted with LUKS. The keyfiles to decrypt these partitions are encrypted by GnuPG with a private key which is stored on a smartcard.

To easily mount my external HDDs I use this small bash script:

/snippets/blob/master/bash_scripts/mountcrypt
#!/bin/bash
gpg -d /media/usbstick/.secret/luks.key.enc | sudo pmount -p - $1 $2

Tutorial

Thats a quite simple tutorial. Most steps have been described in others howtos. Feel free to link them in the comments.

Setup

  1. Create a PGP keypair
  2. Generate a keyfile for the LUKS partition
  3. Make a copy  of your PGP keyring and the LUKS keyfile and safe them in a safe location
  4. Move your keys to your smartcard and replace your private keys by stubs
  5. Create your LUKS partition
  6. Add the keyfile to a LUKS key slot
  7. Encrypt the LUKS keyfile
  8. Move the encrypted keyfile to an USB stick
  9. Add the script from above to your USB stick

Usage

  1. Insert your smartcard, USB stick and the LUKS encrypted harddisk
  2. Call the script from above from your USB stick
  3. Enter your smartcard pin
  4. Enjoy!

Have fun!