Tag Archives: python

Source code formatter in Python

This is the latest version of the script I use to format the code blocks on this blog.

Posted in Programming | Tagged | Leave a comment

Translating a DECnet address to a MAC address

There are several web sites that will do this for you, but I decided to put together a python script to do the job for me.

Posted in Networking, Programming, VMS | Tagged , , , | Leave a comment

A Python class for the MCP9801 Temperature Sensor

Having brought a couple of Temperature Sensors based on the Microchip Technology MCP9801 to use with my Rasperyy Pi. I decided to see if I could write a simple class to encapsulate the code needed to control them.

Posted in Hardware, Linux | Tagged , , | Leave a comment

Setting up I2C on a Raspberry Pi

How to load the necessary kernel modules, configure user access, and install the necessary packages to allow python programs to use the I2C bus is documented in several different places. I just thought I’ll pull together the various steps I … Continue reading

Posted in Hardware, Raspbian | Tagged , , | Leave a comment

Python dumping data in hex using list comprehensions

Recently I wanted to display the contents of a buffer in hex using Python, and ended up writing a short routine to dump the contents of a string in hex and ASCII, to which I added a few more lines … Continue reading

Posted in Linux, Programming | Tagged | Leave a comment

Bouncing Balls in Python

Another python class! This time I’ve created a class to represent the position and motion of a ball in two dimensions. The graphical effect created when a number of balls are dropped together is strangely mesmerising…

Posted in Programming | Tagged , | Leave a comment

Working with cookies in a Python CGI script

If you are using server side scripting then sooner or later you are going need to store some information somewhere, and the most convenient way to do this is to use a cookie which is a small named block of … Continue reading

Posted in Linux, Programming, Raspbian | Tagged , | Leave a comment

Where it all began…

Sometimes it take me a little longer than planned to finish a project, but in this case a it has taken me a LOT longer. I decided to start writing the blog around the same time as I received my … Continue reading

Posted in Hardware, Linux | Tagged , , | Leave a comment

Implementing ‘i2cdetect’ in Python

Having discovered that the simplest way to check to see if a device was present on an I2C bus is to simply try reading from it, I decided to see if I could implement a version of ‘i2cdetect‘ in python.

Posted in Linux, Programming | Tagged , | Leave a comment

An analogue clock in Python

It probably still needs a bit of tidying up but this is one of my first attempts are writing a python class which I wrote in order to be able to draw an analogue clock face using ‘pygame‘.

Posted in Linux, Programming | Tagged , | Leave a comment