Finding corresponding functionality in bash for perl’s grep and substitution.

Updating the variables, since they don’t get automatically changed like in perl. E.g. in Perl the expression grep { /$piece/ && /$move/ && /\d${piece}?\d/ } @wins would at the same time filter @wins and alter it.

Placing the returns in the appropriate places and to clear the variables used for accumulation.

Note: You can use cygwin64 to run this script in windows. However, DO NOT copy and paste the script, as windows introduces \r characters. Rather, rename the script from tttbot_blog.doc to tttbot_blog.sh or tttbot_blog and run it in bash.

To-do: The performance of the bash program is slow. Please wait for up to 15 seconds in the second player’s move and 10 or less for subsequent moves.

I have been using bash recently, and it turned out that some powerful regex options are available via awk. I looked around and found a book written by the original awk authors Aho, Weinberger, and Kernighan:“The AWK Programming Language”

I found a graph in Chapter 6 that called my attention and I wanted to reproduce it:

So I copied the code from this old book and soon found out that parts of the code were not copied, parts were copied incorrectly (instead of $ y got 5, or instead of } I got ), etc), so I set off to debug it.

Finally I got it to work and after making up some entries for the data, there are two files you need to run it. Only docx format is allowed in wordpress, so the files below have the extension docx but they are just plain text files.

This post shows the steps needed to upgrade from Windows 8.0 into 8.1.

The motivation for this is to be able to bypass the lock screen and the applications screen and to go directly to the Desktop. This appears to be possible only with Windows 8.1 as it is explained in the link below:

Make sure that your power settings are such that the disk never go to sleep or hibernate and the display never turns off.

With my internet connection it took several hours to download the 3.5 GB upgrade. I left it overnight downloading. It appears that after it finished downloading, it automatically restarted the laptop, which was unattended. The day after I found out that the installation had finished.

1. I have created a script that collects the temperature every 10min. Twice a day it sends it to an email specified in mailpy2.py.
2. The modified script also adds the file temp_start to /etc/init.d/ so that the script starts when the rpi is connected.

The contents of temp_start are:
sudo python /home/pi/temp4.py

To move the file to the init.d folder and to make it executable:

sudo mv /temp_start /etc/init.d/

sudo chmod +x /etc/init.d/temp_start

sudo update-rc.d temp_start defaults

##temp4.py is shown at the end.

3. Make sure to change your email address and password in mailpy2.py. Script is shown at the end.
4. Change the UK time:
sudo dpkg-reconfigure tzdataScripts:

Well here we go.

follow the instructions to add a server password confirm the password say no to the view only option

Close your putty window but leave your RPi running if you reboot shutdown or restart your RPi you will need to re-run vncserver from the command line as it’s not added automatically to the start up script.

NOTE: If you use sudo su or sudo bash or one of the other commands to change to a root login to install vnc-server you need to get back to a pi login before you run vncserver to set the password it goes through the motions if your logged in as root but if you look at the response root is debarred from this action.

Setting up the PC

Now you need to get some software for your PC use your browser and visit

2. install the wifi usb using the $10 usb device. I mind you, there are two pitfalls in running the otherwise excellent script http://www.raspberrypi.org/phpBB3/viewtopic.php?f=26&t=6256

Hence, first backup /etc/network/interfaces file. I copied it to interfaces.bkup

The first problem is, don’t copy and paste it to a windows text editor. That process introduces strange characters. Just download the file to your pc and then copy it to the rpi via: scp script.sl pi@x.y.z.a://home/pi/script.sl .

The second problem is, if you enter the password for your router incorrectly then the usb wifi is partially installed and it doesn’t work properly. You will need to remove the /etc/network/interfaces file and restore the original interfaces.

3. Once you run the script and enter the proper user id and password for your wifi network, you can find out the ip address with: ifconfig. That’ll give you the inet addr of your wifi connection to the rpi !

Note: For additional details about installation, check out the instructions given in: http://contractorwolf.wordpress.com/raspberry-pi-radio/

The WordPress.com stats helper monkeys prepared a 2012 annual report for this blog.

Here’s an excerpt:

600 people reached the top of Mt. Everest in 2012. This blog got about 6,900 views in 2012. If every person who reached the top of Mt. Everest viewed this blog, it would have taken 12 years to get that many views.