Schwarzwald in winter

A few weeks ago we were in the Schwarzwald for a few days, and since we got a fair amount of snow while we were there I took some pics. I’ve uploaded my 30 favorite here ….

Continue reading

Mythtv and IR Blaster

We use a set-top-box as the video source for mythtv. And while this works perfectly fine, we have to manually make sure the right channel is set for what mythtv wants to record. This can turn out to being a pain at time, especially when multiple things are planned to be recorded on different channels. So I went and ordered a IR transmitter from irblaster.info to give mythtv the possibility to change channels itself.

Since a bunch of the infos I found online were a bit out dated, here are a few tips for anyone using current versions of the software (I’ve got mythtv-backend 0.22 and lirc 0.8.4a running on a mythbuntu based system when I wrote this)

Hardware is easy to set up, just plug it into a free serial port.
1st we will head over to http://lirc.sourceforge.net/remotes/ and grab the file for our reciever set-top-box if we don’t already have them.
Then go edit /etc/lirc/hardware.conf and add the transmitter settings, these were mine:

 Bash |  copy code |? 
1
TRANSMITTER="Skymaster_XL10"
2
TRANSMITTER_MODULES="lirc_dev lirc_serial"
3
TRANSMITTER_DRIVER=""
4
TRANSMITTER_DEVICE="/dev/lirc1"
5
TRANSMITTER_LIRCD_CONF="skymaster/XL10"
6
TRANSMITTER_LIRCD_ARGS=""

now include the reciever settings to /etc/lirc/lircd.conf
I edited my /etc/init.d/lirc to execute the following line before starting the daemon (was needed to ensure the lirc_serial module can be loaded):
 Bash |  copy code |? 
1
/bin/setserial /dev/ttyS0 uart none

Restart lircd and you can then start testing if transmitting codes work with irsend works. here is a little wrapper script I wrote around irsend for mythtv to use. You may have to twiddle around with the sleeps and change the $Remote to your reciever. If the sleeps are too long (-> the script takes to long to finish switching channels), then mythtv will timeout and not display live tv.

 Bash |  copy code |? 
01
#!/bin/bash
02
 
03
Remote="Skymaster_XL10"
04
 
05
send="irsend -d /dev/lircd1 SEND_ONCE"
06
 
07
if [[ "$(echo $1|grep -c "^[0-9]")" = "0" ]]
08
then # non-numeric command
09
  $send $Remote $1
10
else # numeric
11
  for digit in $(echo $1 | sed -e 's/./& /g'); do
12
    $send $Remote $digit
13
    sleep 1.5
14
  done
15
fi
16
sleep 2

If everything is working fine, then go ahead and tell mythtv to use the script to change channels. This is done in the tuner card setup of mythtv-backend (mythtv-setup).

Continue reading

,

Snow

We went for a walk through the snow and some sledding today, here are the pics i shot ….

Continue reading


Farmville

Farmvill can be a fun way to pass some time, but if your fields get to be a bit big clicking on every single field can get to be a bit tiresome. I found this autohotkey script in the depths of the internet. It simplifies the process greatly ;-)

 Text |  copy code |? 
01
 
02
!^c::
03
GoSub GetFarmSq
04
GoSub Getfirstsq
05
 
06
i=1
07
 
08
SetMouseDelay, 0
09
 
10
cycle := farmy/2
11
newx=%startx%
12
newy=%starty%
13
loop, %cycle%
14
{
15
Click %newx%,%newy%
16
Loop, %farmx%
17
{
18
newx+=25
19
newy-=12
20
Click %newx%,%newy%
21
}
22
newx+=25
23
newy+=12
24
Click %newx%,%newy%
25
Loop, %farmx%
26
{
27
newx-=25
28
newy+=12
29
Click %newx%,%newy%
30
}
31
newx+=25
32
newy+=12
33
}
34
 
35
return
36
 
37
GoSub Getfirstsq
38
 
39
GetFarmsq:
40
Inputbox, farmy, Hi, Enter the number of fields to the right to click on,,200,150,,,,,6
41
if ErrorLevel
42
   GoSub Esc
43
Inputbox, farmx, Hi, Enter the number of fields upwards to click on,,200,150,,,,,6
44
if ErrorLevel
45
   GoSub Esc
46
farmx--
47
return
48
 
49
Getfirstsq:
50
Msgbox, Click on the leftmost field to start with ("9 O'clock" position).
51
KeyWait, LButton, D
52
KeyWait, LButton, D
53
MouseGetPos, startx, starty
54
return
55
 
56
Esc:
57
!^x::reload
58
Return
59

Continue reading

, ,

bash scripting … switching into directory of the script

Sometimes it is useful to switch into the directory of the script e.g. when we need to call or include further files and don’t want to go through the hassle of searching for the script in the file system. Especially when symlinks are involved everything get a bit more interesting. This little snippet switches into the directory of the script, using readlink to dereference symlinks if the script is called via a symlink.

 Bash |  copy code |? 
01
## a small snippet to switch into script directory
02
SCRIPTDIR=${0}
03
if [[ -L ${SCRIPTDIR} ]]
04
then
05
# dereference the symlink
06
SCRIPTDIR="$(readlink -e ${0})"
07
fi
08
# chop off the scriptname and switch into the directory
09
cd ${SCRIPTDIR%/*}
10

Continue reading

, ,

Bash scripting, traps and sleep

Today I ran into any old problem: you have a script that should do something when it recieves a signal (e.g. if someone sends it USR1 it should write to a log/syslog), but the script uses a long sleep because it normally only checks/calculates stuff every x min. If you send it a kill -USR1 $pid it will normally execute the trap AFTER the sleep is done, not so great. I figured of the following solution today: put the sleep in a while loop that checks if the full time was slept, and inside the loop a sleep that sleeps the X seconds remaing in the background followed by a wait.

If the script now recieves a USR1 it can kill the wait, execute the trap and will continue the remaining sleep on the next iteration of the loop.

 Bash |  copy code |? 
01
#!/bin/bash 
02
 
03
initialize() { 
04
  set -o nounset 
05
  trap cleanup INT TERM EXIT 
06
  trap print_foo USR1 
07
} 
08
 
09
cleanup() { 
10
  exit 0
11
} 
12
 
13
print_foo() {
14
  echo "foo"
15
} 
16
 
17
initialize
18
 
19
# sleep 1 min
20
SLEEPTILL=$(date '+%s' --date="+1 min")
21
 
22
while [[ $(date '+%s') -lt ${SLEEPTILL} ]]
23
do
24
  sleep $(bc <<< "${SLEEPTILL} - $(date '+%s')") &
25
  BACKGROUND=$!
26
  wait $BACKGROUND
27
done
28

Continue reading

, , ,

Cookies …

I made some of my cookies this evening and used the opportunity to take some pictures. The lighting wasn’t perfect, so everything has a slight yellow tint. I decided to leave the pictures that way instead of trying to correct the problem in Photoshop.

Continue reading

, ,

Wordpress -> Facebook addon

I’m currently trying out the “Status Updater” addon for Wordpress since the latest version supports adding the status as a link to the facebook page …

Continue reading

Serverdown

Server was down for the last 6 hours due to me updating a few stuff that really really didn’t work out too well (grub, xen and kernel at the same time). I gave up and afer a few hours of work managed to revert back to the old configuration so I can recieve mail again till I figure out what went wrong. Server may be down tomorrow a bit too while I try to figure out what exactly broke and try to at least get grub and xen updated.

Continue reading

, ,

Schwetzingen Castle

Yesterday we made a short trip to the castle in Schwetzingen, while we were there I took some photos around the castle.

Continue reading

, ,

prev posts