Archive for Uncategorized

Convert Apple Lossless files to FLACs

Quick shell snippet to convert those Apple Lossless files to FLACs:


for filename in *.m4a; do
    avconv \
        -i "$filename" \
        -acodec flac \
        -compression_level 12 \
        "$(basename "$filename" ".m4a").flac";
done

Comments off

Configuring fingerprint reader in Ubuntu 13.04

Compared to Ubuntu 11.10, this is much-much easier. Just install PAM fingerprint module:

sudo apt-get install libpam-fprintd

No need to run pam-auth-update anymore, because fingerprint login is enabled immideately after the module is installed.

Final step is to enroll your fingerprints:

fprintd-enroll

Comments off

Ubuntu 12.04, LTSP ja ID-kaart

Juhend eeldab Ubuntu 12.04 desktop paigladust. Uuenda pakette:

apt-get update
apt-get dist-upgrade

Paigalda LTSP serveri metapakett, see paigaldab DHCP serveri ja muud LTSP jaoks tarvilikud teenused:

apt-get install ltsp-server-standalone

Seadista võrk failis /etc/network/interfaces, asenda 192.168.77.1 omale sobiliku IP-ga:

echo "auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

auto eth1
iface eth1 inet static
    address 192.168.77.1
    netmask 255.255.255.0" > /etc/network/interfaces

Asenda DHCP serveri seadistuste failis 192.168.0.0/24 alamvõrk:

sed -i "s/192\.168\.0\./192.168.77./g" /etc/ltsp/dhcpd.conf

Taaskäivita võrguteenused:

/etc/init.d/networking restart
/etc/init.d/network-manager restart
/etc/init.d/isc-dhcp-server restart
/etc/init.d/nbd-server restart

Paigalda modifitseeritud OpenSSH server LTSP serverisse:

add-apt-repository -y ppa:v6sa/ltsp-hacks
apt-get update
apt-get install -y openssh-server

Lisa Eesti ID-kaardi ametliku tarkvara varamu:

echo deb http://ftp.id.eesti.ee/pub/id/signed_repository/ubuntu precise main >
     /etc/apt/sources.list.d/ria-repository.list
wget https://installer.id.ee/media/install-scripts/ria-public.key -O - |
     apt-key add -
apt-get update
apt-get install -y estonianidcard

Lisa Xsession skript mis näitab uut PCSC-lite sokkli asukohta:

echo "export PCSCLITE_CSOCK_NAME=\$HOME/.pcscd.comm" > /etc/X11/Xsession.d/80-pcsclite

Loo terminali juurfailisüsteem:

MIRROR="http://fi.archive.ubuntu.com/ubuntu/" \
LANG=C \
ARCH=i386 \
ltsp-build-client

Sisene terminali juurfailisüsteemi:

chroot /opt/ltsp/i386 /bin/bash

Lisa modifitseeritud OpenSSH klient ka terminali juurfailisüsteemi:

apt-get install -y python-software-properties
add-apt-repository -y ppa:v6sa/ltsp-hacks
apt-get update
apt-get install -y openssh-client

Paigalda muud ID-kaardi jaoks tarvilikud komponendid

apt-get install -y pcscd

Uues PC-SC Lite teegis käivitatakse pcscd deemon automaatselt, see ei sobi LTSP jaoks:

sed -i "s/exit 0/#exit 0 # Reverted to 1.6.0 behaviour for LTSP/g" /etc/init.d/pcscd
touch /etc/default/pcscd

Lisa SSH kliendi seadistused, asenda 192.168.77.1 oma serveri IP-ga:

echo "Host 192.168.77.1
    RemoteForward [~/.pcscd.comm] :[/var/run/pcscd/pcscd.comm]" >> /etc/ssh/ssh_config

VIA terminalide UniChrome graafika tüürelite seis on suht halb seega ma lülitaks välja ka 3D kiirenduse:

echo "Section \"Module\"
    Disable \"glx\"
    Disable \"dri\"
EndSection" > /etc/X11/xorg.conf

Välju terminali juurikast

exit

Uuenda terminali juurfailisüsteemi SquashFS tõmmist:

ARCH=i386 ltsp-update-image

NB! Ubuntu Unity on üsna uimane LTSP peal, soovitan valida Gnome Classic (No effects) sessioni sisselogimishalduris.

No comment »

Configuring fingerprint reader for Ubuntu 11.10

Here’s another hopefully useful how-to for getting Thinkpad T420 fingerprint reader running under Ubuntu 11.10:

Install required packages:

sudo apt-get install fprint-demo libpam-fprint

Add udev rule for setting the group ownership of fingerprint reader device:

echo "ATTRS{idVendor}==\"147e\", ATTRS{idProduct}==\"2016\", MODE=\"0664\", GROUP=\"fingerprint\"" \
    | sudo tee /etc/udev/rules.d/99-fingerprint.rules

Create group and add user to that group:

sudo groupadd fingerprint
sudo gpasswd -a lauri fingerprint

Reconfigure PAM and enable “Fingerprint reader”:

pam-auth-update

Reboot the machine so the udev would create the fingerprint reader device node with proper permissions. At the moment I am not familiar how to force udev to recreate the node and unplugging the fingerprint reader is not “feasible”.

Finally scan your fingerprints:

fprint_demo

Both, authentication in the login manager and sudo, should work with fingerprints now!

No comment »

Configuring Evolution for Gmail

There’s many different guides for setting up Evolution for Gmail, but I haven’t found a perfect one. So here goes yet another one:

Receiving mail

Server type: IMAP+
Server: imap.gmail.com
Port: 993
Username: first.last@gmail.com
Use secure connection: SSL encryption
Authentication type: Password

Sending mail

Server type: SMTP
Server: smtp.gmail.com
Port: 587
Server requires authentication: yes
Use secure connection: SSL encryption
Authentication type: Login
User Name: first.last@gmail.com

No comment »

Bricking Samsung Galaxy S2

Hey everyone, it has been a long time since my last post. There’s much fuss around installing custom firmware on Samsung Galaxy S2, so I wanted to figure out how it exactly works.

First of all most Android customized ROM’s, eg. CyanogenMod, VillainROM, DarkyROM aren’t exactly ROM images, they’re zipped filesystem overlays of the original stock firmware root filesystem. This means that in order for the customization to work, you first need to have properly booting stock firmware.

To install these customizations you need to have a rooted phone. Rooted phone basically meanss that you can run the classic UNIX command “su” to become the root user. There are hacked kernel images available on the XDA developers for various versions of Galaxy S2.

Utilities called Odin and Heimdall are available for directly manipulating the built-in flash storage of Samsung Galaxy phones. Odin seems to be available only for Windows so it’s out of the scope of this blogpost. Heimdall is a cross-platform command-line utility with similar purpose.

Rooting Samsung Galaxy S2 is easy as booting it into the download mode, this means turning the phone off and holding Volume down and Home buttons while powering up the phone and uploading the hacked kernel using Heimdall:

# This kernel should work with stock Android 2.3.4 firmware of Galaxy S2 sold in Europe
http://attachments.xda-developers.com/attachment.php?attachmentid=651559&d=1310388033 \
    -O CF-Root-SGS2_XX_OXA_KG1-v4.1-CWM4.zip
unzip CF-Root-SGS2_XX_OXA_KG1-v4.1-CWM4.zip
tar xvf CF-Root-SGS2_XX_OXA_KG1-v4.1-CWM4.tar
echo "3a70ced0c96d947b4cb1983dcebd1584 zImage" | md5sum -c -
sudo heimdall flash --kernel zImage

The yellow warning sign is shown while booting with the hacked kernel – it’s okay. The hacked kernel image also installs two apps: ROM Manager and Superuser. First one allows the user to (re)boot into ClockworkMod Recovery. It is also possible to directly boot into ClockworkMod Recovery, just hold Volume up and Home while powering up the phone. It is always good idea to back up the current system. Move around in the ClockworkMod Recovery menus with volume up/down buttons.

The phone’s internal flash storage is called “SD Card” in the ClockworkMod Recovery although it’s not an actual SD card plugged into the SD card socket, so this means that you don’t need an SD card to install custom ROM. While running ClockworkMod, it is possible to mount the internal flash storage to your PC, this way you can upload the ROM zip to your phone. Once having the right zip file in your phone just select “Install zip from sdcard” while running ClockworkMod Recovery.

There are many custom ROM’s for Galaxy S2, the most popular CyanogenMod seems to be built from scratch and does not have the optimizations enabled for S2, it’s also rumored that is does not have support for hardware accelerated video decoding. I haven’t tried out VillainROM yet, but DarkyROM that is based on the original Samsung firmware seems to be running just fine.

OH AND OF COURSE YOU VOID ANY WARRANTY IF YOU FLASH ANY FUNKY STUFF ON YOUR PHONE

VillainROM
Darky’s ROM
Hacked kernels with CWM and SU on XDA developers
Heimdall
Root Galaxy S2 with Heimdall on Linux
Tips at CyanogenMod
Default PIT (Partition Information Table)

No comment »

Räniorg

Seekord siis jälle üks rääkimata lugu. Märtsi lõpp kuni aprilli algus käisime Ettevõtluse Arendamise Sihtasutusega USAs, täpsemini Silicon Valleys, Kalifornia osariigis.

Alustada võiks ehk ettevalmistustest – USAsse minekul on kaks varianti, kas biomeetriline pass või traditsiooniline viisa. Biomeetrilist passi sai teha kodakondsus- ja igratsiooni ametis, nüüdsest on KMA liidetud kokku Politsei- ja Piirivalveametiga. Maksma läheb ta umbkaudu 30€, kiirpassi varianti pole mõtet võtta, sest lubatud kuu asemel saab passi kätte paari päevaga ka tavamenetluses. Järgmine samm on ESTA (Electronic System for Travel Authorization) avalduse täitmine, mille eest küsitakse 14 USD ehk umbkaudu 10€. Veider on see et Eestil peaks olema viisavabadus USAga kuid ESTA avaldus näeb väga välja viisa moodi, ärge unustage siis “have you been involved in terrorist activites” juures märkida “no”.

Meie lend läks läbi Munichi/Münheni, Tallinnast sinna lend kestab umbkaudu 2-3 tundi. Peale seda järgnesid piinarikkad 8 tundi oodates ühenduslendu ning kogu lend kulmineerus 12 tunnise transatlantilise lennuga kus jalgu liigutada ega ka magada ei saa sest aknast paistab päike ning me lendame päikesega kaasa. Kui meil on siin hetkel 22:31 õhtul siis neil on seal päeval 12:30, mis tähendab et sinna jõudes on unetsükkel täiesti sassis ja tõenäoliselt ärkad hommikul kell 5 hommikul üles mõttega “okei mis nüüd?”. Moodsas keeles nimetatakse seda nähtust jet lagiks aga see selleks.

Esimesteks päevadeks oli planeeritud O’Reilly korraldatud Web2.0 EXPO kus oli mitmeid huvitavaid seminare ning erinevad startupid oma putkad püsti ajanud kus nad oma nänni jagasid ja maakeeli külastajaid spämmisid. Õhtustel aegadel toimusid konverentsihoones ja kõrval business networking üritused. Astusin ka mina siis korraks oma koorikust välja, networkisin ja tutvustasin Povi ning meie tegemisi. Suhtlusvõimete overclockimise jaoks oli õnneks tasuta õlut!

Peale konverentsi käisime külas Google peamajas, kus meile tegi väikese intro Chris DiBona rääkides Google edulugu avatud lähtekoodiga tarkvara kasutamisest Google infrastruktuuris. Kokkuvõttes oli jutt umbes selline et Oracle andmebaasitarkvara ka kõige soodsama pakkumise juures oleks olnud kordades kallim kui avatud lähtekoodiga tarkvara kohandamine Google vajaduste tarbeks. Teine oluline aspekt oli ka see et Google ei ehitanud oma taristut üles traditsioonilisele kallile serveririistvarale, vaid kasutas odavat PC riistvara ning lahendas kõik sellest tulenevad probleemid tarkvaras. Chris DiBona on muuseas ka üks Google Summer of Code organisaatoritest ja intervjuu temaga leiab GSoC kodulehelt. Sealses Google kontoris on tööl ka neli eestlast.

Sain läbi astutud ka Kalifornia ülikooli Berkeley osakonnast. Sellest ülikoolis on näiteks avastatud 8 keemilist elementi ning Nobeli preemia laureaatidel on tasuta parkimine. Ühiskohtumine oli Stanford ülikooli professori Keith Devliniga kes ühel slaidil tõi välja ka Stanfordi aastase 3 miljardi dollarilise ehk umbkaudu 33 miljardi kroonise eelarve, võrdluseks oli Eesti riigi eelarve aastal 2008 umbkaudu 85 miljardit krooni.

Kokku olime USAs umbkaudu 10 päeva, mille aja jooksul sai päris palju huvitavat nähtud ja kogetud. Kalifornia pole kindlasti stereotüüpne USA, mingil määral ehk sarnane Amsterdamiga kus on palju kohanenud sisserändajaid, ettevõtlus vohab ning kanepi omamine on legaalne.

No comment »

Cooling DELL laptops with dellfand

For long time I had my laptop running rather hot. The problem was that BIOS was handling the cooling and not so well. First I tried loading i8kfan module but it crashed the whole machine. Finally I found dellfand utility which allows the user to control fan speed. Altough my DELL Studio 1535 wasn’t listed in the supported models list it still worked.

First I downloaded dependencies on my Ubuntu install:
sudo apt-get install build-essential

Then compiled the program since it wasn’t available in the APT repositories:

wget -c http://dellfand.dinglisch.net/dellfand-0.9.tar.bz2
tar xvf dellfand-0.9.tar.bz2
cd dellfand-0.9
make
sudo cp dellfand /usr/local/bin

Finally started it up with following parameters:

sudo dellfand 1 10 25 30 35

The cooling has three modes – turned off, low speed, max speed. In this case the fan is turned off 25-30C, in low mode 30-35C and at max speed when the temperature raises over 35C. More information here.

Comments (1) »