Eubolist's Blog

about IT, Linux, the web and much more

Posts Tagged ‘Linux

MythNetTV-Status Page

leave a comment »

I wrote a little script the other day so I could sporadically check on the progress and last downloaded shows of mythnettv on my mythtv-box.  The package “mythnettv-gui” sets up a nice cronjob that creates a log file, which my script uses to deliver the information. You can download the script here.

All you have to do is put the script in place and tell your system with crontab -e to execute it every now and then:

# m h  dom mon dow   command

* * * * * /usr/local/bin/mythnetstatus.py

For the lazy reader here is a complete set of commands, just copy-paste in a terminal to download and set everything up:

wget http://content.wuala.com/contents/Eubolist_/www/mythnetstatus.zip?dl=1 && mv mythnetstatus.zip?dl=1 mythnetstatus.zip && unzip mythnetstatus.zip && sudo mv mythnetstatus.py /usr/local/bin && sudo cp var/www/mythnettv-status /var/www && rm -Rf var && crontab -l > cron.tmp && echo “* * * * * /usr/local/bin/mythnetstatus.py” >> cron.tmp && crontab cron.tmp && rm cron.tmp

Written by eubolist

2010/12/24 at 12:36

AnkiMiniSync Version 0.1, an ‘offline’ sync script for AnkiMini (on the iPad)

with one comment

Since I didn’t want to use the Anki Online service to sync AnkiMini on my jailbroken iPad and Anki on my Laptop I always had to copy the recent version from/to my iPad over ssh (sshfs). To automate that task a bit and save me some time I wrote this little sync script. It basically compares the two .anki decks in the local and the remote folder and replaces the older with the newer version. It does however -NOT- read the .anki file and merge the files properly. That means you can only work on one machine and then have to sync before you start working on the other one. It also means working on more than one mobile device is not possible (well, it’s possible but you’ll lose data through the sync process).
There are still some restrictions in this first version:
-Your username and directory where the Anki deck is stored must not contain any whitespaces (will be hopefully be solved in v.0.2)
-You can only sync one deck at a time (functionality to sync whole folders is planned for v.0.2)
-The .anki folder must be directly in the mounted directory of the sshfs volume
-You should have public key authentification turned on
-As far as I know this script only works on *nix systems, I have only tested it on OSX so far
If you encounter any bugs or problems besides the above don’t hesitate and write a comment! Don’t write any bug reports in the Anki support forums or to the developers of Anki (or AnkiMini), they have nothing to do with this.
Contributions to the code are always welcome of course. You are also allowed to use the code or parts of the code anywhere else, though it’d be nice to notify me somewhere along the way.
AnkiMiniSync IconLink to ankiminisync-0.1.py

Howto: Create a bootable Linux USB flash drive (USB-stick) in Mac OSX

with 7 comments

For Windows and Linux there’s UNetbootin, in OSX you have to rely on the terminal to create your USB flash drive.

Step 1: Download the image of the distro you want to use. In my case XUbuntu 10.04.

Step2: If there is data that you still need on your flash drive, save it on your desktop or somewhere else on your harddrive. I created a folder ‘Data’ on my desktop.

Step3: Open a terminal and type in mount . This should give you a list of mounted drives on your Mac, like this:

eubolists-macbook-pro:~ eubolist$ mount
/dev/disk0s2 on / (hfs, local, journaled)
devfs on /dev (devfs, local, nobrowse)
map -hosts on /net (autofs, nosuid, automounted, nobrowse)
map auto_home on /home (autofs, automounted, nobrowse)
/dev/disk0s3 on /Volumes/BOOTCAMP (fusefs, local, synchronous)
/dev/disk1s2 on /Volumes/Time Machine-Backups (hfs, local, nodev, nosuid, journaled)
/dev/disk3 on /Volumes/8GB DRIVE (msdos, local, nodev, nosuid, noowners) <– This is the one we want
Step 4: Unmount the drive: diskutil umountDisk /dev/disk3 Of course you may have to change disk3 to whatever disk your flash drive is.
Step 5: Write the image: dd if=/Users/eubolist/Downloads/xubuntu-10.04-desktop-i386.iso of=/dev/disk3 bs=1m
Again, change the command as needed. The path to your image is in all probability different as well as the path to your flash drive.
Now you should see the light of your flash drive flashing and after a while an output that looks similar like the following:

681+1 records in
681+1 records out
714168320 bytes transferred in 225.925632 secs (3161077 bytes/sec)

If that’s the case, congrats! You should have a bootable flash drive now. If you want to, you can create another partition if you have enough space and put the data saved earlier in Step 2 back on your usb drive now.
NOTE: If you have an older PC it might still not boot from your flash drive, even if you did everything well. Some older BIOSes just don’t support booting from USB flash drives.

Written by eubolist

2010/05/24 at 19:42

Ubuntu Lucid Lynx 10.04 LTS is out!!

leave a comment »

Download the newest Ubuntu long term support (LTS) release on http://releases.ubuntu.com/releases/10.04/. If possible choose a torrent download to save Canonical some server bandwidth and you some time.

Tests about the new Ubuntu will be on my blog soon!

Written by eubolist

2010/04/30 at 22:18

Ubuntu 10.04 LTS (Lucid Lynx) Beta 2 released

leave a comment »

Ubuntu 10.04 Beta 2 Has just been released. Why don’t you head over to http://releases.ubuntu.com/10.04/ and download a copy?

If you want to upgrade your existing Ubuntu installation to the newest Beta version type “gksu update-manager -d” in a terminal.

Written by eubolist

2010/04/08 at 15:01

Howto: Ubuntu Lucid Lynx Beta 1 Encrypt System Partition using Live CD

with 5 comments

In case the alternate installation doesn’t work for you (there have been some bugs reported in the current Beta 1 version) or you only downloaded the Desktop CD and now suddenly decided to install Ubuntu on an encrypted partition, this is the right guide for you. If you just like pretty GUIs that’s okay too, but be aware that for this tutorial you should be comfortable working from the terminal. (though most of this tutorial you can just copy – paste into a terminal window).

Let’s start by installing lvm2 on your live system (the desktop cd doesn’t have that by default), open a terminal and type:

sudo su

aptitude update && aptitude install lvm2

If that fails check your network connection. You need a working internet connection to download the package. Now you need to set up (at least) two partitions:

  • /dev/sda1: an unencrypted /boot partition (around 250 MB) and
  • /dev/sda2: one encrypted LVM volume for your / filesystem and swap.

In your system it may be /dev/sdb or whatever you choose: Adjust the following commands to your system configuration:

cryptsetup -c aes-xts-plain -s 512 luksFormat /dev/sda2

When choosing a password take a long, safe password which is not prone to dictionary or brute force attacks. But also make sure you won’t forget it – if you forget your password all your files and settings will be lost.

cryptsetup luksOpen /dev/sda2 lvm

pvcreate /dev/mapper/lvm

vgcreate ubuntu /dev/mapper/lvm

lvcreate -L 1300M -n swap ubuntu

You can change the size of the swap partition, usually a value 1.3-1.5x your RAM size is fine.

lvcreate -l 100%FREE -n root ubuntu

If you want more than one partition (eg. a seperate /home partition) don’t use 100%FREE but the value you wish and define the additional partitions using the above scheme before proceeding to the next step.

mkswap /dev/mapper/ubuntu-swap

mkfs.ext4 /dev/mapper/ubuntu-root

Now start the installation process (don’t close the terminal yet, we’ll need it later). In the partitioning step choose /dev/mapper/ubuntu-root -> Mount point: / and reformat the partition with ext4. Choose /dev/sda1 -> Mount point: /boot and also reformat the partition.

Then continue your installation. On my system it wasn’t able to install the bootloader – don’t worry, we’ll fix that later, just continue with the installation. Once it’s finished don’t restart the system: Close the window and go to the terminal again.

mount /dev/mapper/ubuntu-root /mnt
mount /dev/sdX1 /mnt/boot
mount -o rbind /dev /mnt/dev
mount -t proc proc /mnt/proc
mount -t sysfs sys /mnt/sys
chroot /mnt

Now you’re chrooted in your new installation and able to modify it in order to boot into the encrypted partition. Install the necessary software:

aptitude install cryptsetup lvm2

Then you need to write the UUID of the encrypted partition into /etc/crypttab

echo “lvm UUID=VOLUME_ID none luks” >> /etc/crypttab

You can find out the volume id by typing blkid /dev/sda2 in your terminal. Lastly you need to update the initramfs with

update-initramfs -u -k all

If you were able to install the bootloader grub during the installation process you’re done now, you can exit the terminal and reboot. If not there are three more commands you need to run before exiting:

aptitude install grub2

grub-install /dev/sda

update-grub

If all went well you have a 10.04 installation with an encrypted system drive now. Congratulations!

NOTE: The last part of this tutorial (chrooting plus installing grub) may also serve as a workaround if you encounter any problems or bugs setting up grub during the regular installation process.

Written by eubolist

2010/04/05 at 18:51

Anki: An Intelligent Study Card System For Any OS

with 3 comments

A month ago I was looking for a new computer-based method to improve my study schedule. After a bit of searching in the endless depth of the web I discovered Anki, a flash card application that has several very useful features:

  • It is written in Python and available for Windows, Linux, Mac OS X and FreeBSD – which means it runs on virtually any computer.
  • There are a lot of  “Decks” (=sets of flashcards built by other users) already available on the web
  • The interface is really nice and intuitive, adding sound, video or pictures to your cards is very easy, thus can be accomplished by people with little experience with computers. Also there are many options to adjust the program to your study habits.
  • Anki uses spaced repetition. After each card you have to say how well you remembered it – based on that Anki will set the interval after which the card will be brought up again. With this technique facts will be pushed into your long-term memory. That means you won’t experience black outs in exams anymore as the hormone cortisol, released by your body in situations of psychological stress, only affects the short term but not the long term memory.

If that made you curious, why don’t you give it a try! Here are the download links:

Windows

Ubuntu (you can also install it with apt-get/aptitude, but the version in the repositories is pretty old)

Linux

Mac OSX

FreeBSD

Written by eubolist

2010/03/14 at 21:10

Ubuntu 10.04 Lucid Lynx: Dual Screen with nVidia GeForce MX 460 and nvidia-glx-96 legacy driver

with one comment

Uprgrading to Lucid Lynx Alpha 2 somehow messed with my dual screen configuration, here is what you have to do to reconfigure it again:

1. Install the proprietary driver: sudo aptitude install nvidia-glx-96

2. Backup your xorg.conf file sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf.backup

3. Change your xorg.conf file to the following (sudo nano /etc/X11/xorg.conf):

Section “ServerLayout”
Identifier     “Layout0”
Screen      0  “Screen0”
InputDevice    “Keyboard0” “CoreKeyboard”
InputDevice    “Mouse0” “CorePointer”
EndSection

Section “Files”
EndSection

Section “InputDevice”
# generated from default
Identifier     “Mouse0”
Driver         “mouse”
Option         “Protocol” “auto”
Option         “Device” “/dev/psaux”
Option         “Emulate3Buttons” “no”
Option         “ZAxisMapping” “4 5”
EndSection

Section “InputDevice”
# generated from default
Identifier     “Keyboard0”
Driver         “kbd”
EndSection

Section “Monitor”
Identifier     “Monitor0”
VendorName     “Unknown”
ModelName      “Unknown”
Option         “Twinview” “True”
Option         “TwinviewOrientation” “RightOf”
Option         “UseEdidFreqs” “True”
HorizSync       30.0 – 110.0
#    VertRefresh     50.0 – 150.0
VertRefresh     60.0
Option         “DPMS”
EndSection

Section “Device”
Identifier     “nVidia Corporation NV17 [GeForce4 MX 460]”
Driver         “nvidia”
VendorName     “NVIDIA Corporation”
EndSection

Section “Screen”
Identifier     “Screen0”
Device         “Device0”
Monitor        “Monitor0”
DefaultDepth    24
SubSection     “Display”
Depth       24
Modes      “1280×1024” “1024×768”
EndSubSection
EndSection

You might need to play around a little with the options (such as the resolution). My advice is to use a second computer (preferably a laptop) and ssh into the first computer that you want to configure. That way you can comfortably comment out or add single lines to your xorg.conf even if you don’t have a visual picture.

If everything fails just revert back to the default xorg.conf with either one of the following commands:

sudo cp /etc/X11/xorg.conf.backup /etc/X11/xorg.conf

or

sudo dpkg –reconfigure -phigh xserver-xorg


Google plans on releasing a tablet PC running Chromium os

leave a comment »

The new Google Chromium Tablet PC

Looks like a few days after the presentation of the Apple iPad, Google published some design studies of their very own tablet pc. The drafts on their page are still very vague, but it certainly looks very promising:

The idea of a 10-finger compatible virtual keyboard would definitely be a relief for a lot of frequent pc users

Check out all the pictures and a video simulation at Chromium.org

Written by eubolist

2010/02/03 at 21:42

Set up LIRC to control your Ubuntu/MythTV Box with a Microsoft Media Center Edition (MCE) infrared remote control

with one comment

I wanted to control my MythTV-Box like I used to control my old receiver with a good old fashioned IR remote rather than with keyboard and mouse. That’s why I went to eBay and bought myself a cheap MCE remote, you can have them shipped from China for less than 20 bucks:

I didn’t know whether the device was Linux compatible, so I just plugged it in and took it from there:

~$ lsusb

Bus 003 Device 002: ID 045e:006d Microsoft Corp. eHome Remote Control Keyboard keys

Looks good. Let’s install the latest version of lirc:

~$ sudo aptitude update && sudo aptitude install lirc

Then let’s check whether lirc picks up correct signals from our remote:

~$ irw

Then press the OK or any other button and the output should look somewhat like this:

000000037ff07bdd 00 OK mceusb

If it does: Congratulations, you’ve got a lirc compatible infrared remote! Exit irw by pressing [Ctrl + C].

LIRC normally runs at system start as a daemon (=runs in background). It reads a file called “.lircrc” in your home directory, in this file you can specify a command for each button. You can even specify custom keybindings for different programs, let’s have a look at my .lircrc file:

~$ cat .lircrc

include /home/eubolist/.mythtv/lircrc                             –> Here we specify which configuration
include /home/eubolist/.lircfiles/vlc                                       files to include in addition to this one
include /home/eubolist/.lircfiles/rhythmbox

begin
prog = irexec                –> irexec means that lirc will
button = Home                   pick up your command no matter which program is running
config = python /home/eubolist/ir-scripts/mythfrontend.real.py 
end

begin
prog = irexec
button = TV
config = python /home/eubolist/ir-scripts/miro.py
end

begin
prog = irexec
button = Videos
config = python /home/eubolist/ir-scripts/vlc.py
end

begin
prog = irexec
button = Music
config = python /home/eubolist/ir-scripts/rhythmbox.py
end

begin
prog = irexec
button = Power
config = python /home/eubolist/ir-scripts/onoff.py
end

Now you may ask yourself why I have some Python scripts specified as actions when I press certain buttons. The reason is simple, let’s have a look at vlc.py:

##!/usr/bin/python
import commands
import os
import sys
import subprocess

output = commands.getoutput(‘ps -A’)

## Check whether vlc is running:              –> As I usually don’t need multiple instances of the same
if ‘vlc’ in output:                                    program running I want to check whether it’s already open

## If yes: either shut the process down
#       os.system(‘/usr/bin/killall vlc’)

## or do nothing:
sys.exit(0)

## If not: Open vlc and end this script:

else: pid = subprocess.Popen(‘/usr/bin/vlc’).pid       –> If you just use os.system() again here the
sys.exit(0)                                        script will just stay open and keep irexec busy, if you press the button again it woud get queued and run again once you exit vlc

Now have fun toying around with Ubuntu and your ir remote control. If you have any questions, thoughts or criticism you are welcome to write a comment.