Paul Sutton

Personal Blog

Tinkerers Meeting – April 2025 – Write up

Today was really productive

It was Myself, Helen and Ben. Ben gave an overview of his CNC project, and brought along the Arduino control unit and display unit. We had a discussion around this and other topics such as Containers, Kubernetes, git and how we can manage projects using git and gitlab, github.

The quality of these is not very good due to lighting, but the first photo shows the control board, the 2nd shows the display from the front.

CNC

CNC

Helen gave a review of what happened when she visited the UK Micromouse and Robotics Society contest in Stratford, and that she will be attending the next meeting in a few weeks, this led to a discussion on hosting a similar event in Torbay.

Helen has also taken the Obstacle avoiding robot, to change the motor as the one current installed in faulty, I had a space so that was taken too. Fingers crossed that next meeting it will behave a little better.

Next Meeting

The next meeting of the Tor bay Tinkerers group will Saturday,Saturday May 24th at 9:30

We meet at:-

STEAM Cafe & Discovery Centre 13 Torbay Road, Paignton.

Related Links

Tags

#Torbay,#Tinkerers


MastodonPeertubeJoin Mastodon

AI statement : Consent is NOT granted to use the content of this blog for the purposes of AI training or similar activity. Consent CANNOT be assumed, it has to be granted.

Donate using Liberapay

Bash scripting 21 – cron

One of the important things you need to do as a system admin is run tasks that perform specific tasks on the system. This is fine when you are sitting in front of the computer, or logged in remotely, but what happens if you need to run a task when you are not there, or you just want to automate the running of these tasks.

You can schedule tasks using the cron command. There is an easy-to-use tutorial for this at [1]. I am not going to reproduce this here, but may include some of my own specific use cases in a later post.

According to [1] the following

*/5  * * * * /home/paul/crontest.sh

runs every 5 minutes, where as

*/10  * * * * /home/paul/crontest.sh

So putting ls -l in crontest.sh will run that command every 5 or 10 minutes.

However, I am logged into my pi (where I am running this) so the script will run, but I don't see any output.

If I add in ls -l > dirlist.txt

It will produce a directory listing text file when run, by running ls manually you can see it in the listing.

I have a post on Ansiweather scheduled fora few days, in the meantime

putting this in the crontest.sh file

echo $(date), $(ansiweather -l Paignton -a false) >> weather.csv

It will run at the specified time and append the information to weather.csv which could be a good way to monitor weather over time.

This can be examined with

cat weather.csv 

if you use the watch command

watch cat weather.csv

the contents of weather.csv will be displayed and updated in real time as the file is appended with new information.

References

  1. https://stackoverflow.com/questions/12786410/run-cron-job-every-n-minutes-plus-offset

Tags

#Bash,#Bashscripting,#Task,#Schedule,#cron,#crontab,#Admin, #Automation


MastodonPeertubeJoin Mastodon

AI statement : Consent is NOT granted to use the content of this blog for the purposes of AI training or similar activity. Consent CANNOT be assumed, it has to be granted.

Donate using Liberapay

Bash scripting 20a – weather

Another useful program is ANSI weather. We can use this to get a weather forecast or current weather conditions for a specified location, for example

This can be installed with

sudo apt install ansiweather
ansiweather -l torquay
 Weather in Torquay: 11 °C - UVI: 4.19 - Wind: 5.81 

By default, the output uses ansicolour, and as per man page this can be turned off by using -l

ansiweather -a false

Which is useful., as we have been looking at loops and generating data we can do combine some of this and generate current date / time and then the output of the weather forecast

echo "date" "data" # for reference, not written to file 
for ((i = 0 ; i < 10 ; i++)); do
    echo $(date), $(ansiweather -l Paignton -a false) # echo to screen (stdout)
    echo $(date), $(ansiweather -l Paignton -a false) >> weather.csv
done

#sources of help

#https://stackoverflow.com/questions/40175868/how-to-create-csv-file-using-shell-script

#https://stackoverflow.com/questions/1194882/how-to-generate-random-number-in-bash

#https://linuxhandbook.com/bash-loops/

#https://stackoverflow.com/questions/25242626/bash-redirect-output-to-log-file-with-day-date-in-the-name

Which produces

date data
Sat 19 Apr 20:52:54 BST 2025, Weather in Paignton: 11 °C - UVI: 4.19 - Wind: 5.52 m/s NE - Humidity: 79% - Pressure: 1006 hPa
Sat 19 Apr 20:52:55 BST 2025, Weather in Paignton: 11 °C - UVI: 4.19 - Wind: 5.52 m/s NE - Humidity: 79% - Pressure: 1006 hPa
Sat 19 Apr 20:52:56 BST 2025, Weather in Paignton: 11 °C - UVI: 4.19 - Wind: 5.52 m/s NE - Humidity: 79% - Pressure: 1006 hPa
Sat 19 Apr 20:52:56 BST 2025, Weather in Paignton: 11 °C - UVI: 4.19 - Wind: 5.52 m/s NE - Humidity: 79% - Pressure: 1006 hPa
Sat 19 Apr 20:52:57 BST 2025, Weather in Paignton: 11 °C - UVI: 4.19 - Wind: 5.52 m/s NE - Humidity: 79% - Pressure: 1006 hPa
Sat 19 Apr 20:52:58 BST 2025, Weather in Paignton: 11 °C - UVI: 4.19 - Wind: 5.52 m/s NE - Humidity: 79% - Pressure: 1006 hPa
Sat 19 Apr 20:52:59 BST 2025, Weather in Paignton: 11 °C - UVI: 4.19 - Wind: 5.52 m/s NE - Humidity: 79% - Pressure: 1006 hPa
Sat 19 Apr 20:52:59 BST 2025, Weather in Paignton: 11 °C - UVI: 4.19 - Wind: 5.52 m/s NE - Humidity: 79% - Pressure: 1006 hPa
Sat 19 Apr 20:53:00 BST 2025, Weather in Paignton: 11 °C - UVI: 4.19 - Wind: 5.52 m/s NE - Humidity: 79% - Pressure: 1006 hPa
Sat 19 Apr 20:53:01 BST 2025, Weather in Paignton: 11 °C - UVI: 4.19 - Wind: 5.52 m/s NE - Humidity: 79% - Pressure: 1006 hPa

Which is probably not all that helpful. But it will produce a CSV file of that data.

However, if we put the command to produce output, in a script and then run this script as a cron job, we should be able to generate a weather report on a daily basis for a specific location.

I have made a post (scheduled for later today) on cron and used this as an example of using cron, a script to produce a CSV file of date, time, weather info over time.

This is clearly more useful than what it produces above.

Tags


MastodonPeertubeJoin Mastodon

AI statement : Consent is NOT granted to use the content of this blog for the purposes of AI training or similar activity. Consent CANNOT be assumed, it has to be granted.

Donate using Liberapay

Matrix Beginner guide

Matrix is “An open network for secure, decentralised communication” We have some rooms on Matrix which you can access via the contact page.

If you are not sure what Matrix is, please check the video below, which gives a beginner introduction.

Other links

Tags

#StemGroup,#Matrix,#Communication.#Protocol,#Element


MastodonPeertubeJoin Mastodon

AI statement : Consent is NOT granted to use the content of this blog for the purposes of AI training or similar activity. Consent CANNOT be assumed, it has to be granted.

Donate using Liberapay

Bash Scripting 20 – Write date and data a file

So following on from the previous scripts, it may be useful to record both the date and some data associated with that date to a file.

I have found out how to do this, but also tidied my script up, removed some unneeded code (quite a lot) and this should work.

echo "date" "data" # for reference, not written to file 
for ((i = 0 ; i < 10 ; i++)); do
    echo $(date), $((RANDOM % 20)) # echo to screen (stdout)
    echo $(date), $((RANDOM % 20)) > log3.csv
done

Produces

date data
Fri 18 Apr 12:48:16 BST 2025, 0
Fri 18 Apr 12:48:16 BST 2025, 15
Fri 18 Apr 12:48:16 BST 2025, 13
Fri 18 Apr 12:48:16 BST 2025, 6
Fri 18 Apr 12:48:16 BST 2025, 6
Fri 18 Apr 12:48:16 BST 2025, 13
Fri 18 Apr 12:48:16 BST 2025, 18
Fri 18 Apr 12:48:16 BST 2025, 5
Fri 18 Apr 12:48:16 BST 2025, 3
Fri 18 Apr 12:48:16 BST 2025, 14

Which is fine, but we can refine the date output so it is shorter with

date "+DATE: %D TIME: %T"
  date "+%D"   display date no label
  date "+%T"  display tine no label 

If we want this in a csv file it may help to add a comma

date "+DATE: %D, TIME: %T"

Remove the labels DATE: & TIME:

date "+ %D, %T"

Produces

date "+ %D, %T"
 04/20/25, 14:58:19

My final entry, in the script run by cron, at least as far as time and date is concerned

echo $(date "+ %D, %T"), $(ansiweather -l Paignton -a false) >> weather.csv

Produces

echo $(date "+ %D, %T"), $(ansiweather -l Paignton -a false)

I have just copied and pasted the line in to the terminal and removed the >> weather.csv as that appends the csv file with the data.

As we all have different use cases, this solution is fine for me, I can adjust to suit further. This is far more useful for a CSV file, especially if you want to load the data in to a spreadsheet.

See forth link below for full details. * Sources of help

https://stackoverflow.com/questions/40175868/how-to-create-csv-file-using-shell-script
https://stackoverflow.com/questions/1194882/how-to-generate-random-number-in-bash
https://linuxhandbook.com/bash-loops/
https://stackoverflow.com/questions/25242626/bash-redirect-output-to-log-file-with-day-date-in-the-name
https://phoenixnap.com/kb/linux-date-command

Tags

#Bash,#Bashscripting,#Files,#Write,#Data,#Time,#Data


MastodonPeertubeJoin Mastodon

AI statement : Consent is NOT granted to use the content of this blog for the purposes of AI training or similar activity. Consent CANNOT be assumed, it has to be granted.

Donate using Liberapay

Gopher 2

As I am going to look in to hosted services for gopher. I am removing gophernicus from the Raspberry Pi

sudo apt remove gophernicus
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following package was automatically installed and is no longer required:
  python3-simpletal
Use 'sudo apt autoremove' to remove it.
The following packages will be REMOVED:
  gophernicus
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 125 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 77532 files and directories currently installed.)
Removing gophernicus (3.1.1-3+b1) ...
Processing triggers for man-db (2.11.2-2) ...

I may as well run auto remove to clean up further

sudo apt autoremove
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages will be REMOVED:
  python3-simpletal
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 195 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 77518 files and directories currently installed.)
Removing python3-simpletal (5.2-3) ...

I am leaving the gopher client installed, as this may be needed later.

So I will be looking at setting up a vern.cc account as they offer gopher as one of their services.

Tags

#Gopher,#Remove,


MastodonPeertubeJoin Mastodon

AI statement : Consent is NOT granted to use the content of this blog for the purposes of AI training or similar activity. Consent CANNOT be assumed, it has to be granted.

Donate using Liberapay

ESA BioMass Mission

The mission

Carrying a novel P-band synthetic aperture radar, the Biomass mission is designed to deliver crucial information about the state of our forests and how they are changing, and to further our knowledge of the role forests play in the carbon cycle.

Launch Date : 29th April 2025

Tags

#ESA,#BioMass,#Mission,#Forest


MastodonPeertubeJoin Mastodon

AI statement : Consent is NOT granted to use the content of this blog for the purposes of AI training or similar activity. Consent CANNOT be assumed, it has to be granted.

Donate using Liberapay

London Marathon

Sunday 27th April sees the 45th London Marathon taking place. Full details of coverage are on the BBC Website.

Tags

#Sport,#LondonMarathon,#Running


MastodonPeertubeJoin Mastodon

AI statement : Consent is NOT granted to use the content of this blog for the purposes of AI training or similar activity. Consent CANNOT be assumed, it has to be granted.

Donate using Liberapay

Gopher

With lots of discussions about big tech, privacy and data protection there has been discussions on the Social Web, about using protocols such as Gopher and related software.

We are also seeing attacks on science from the USA with departments cut, and information on a range of issues; such as DEI, Climate Science, Medical Science being removed, risking this being lost forever.

The Gopher protocol (/ˈɡoʊfər/ ⓘ) is a communication protocol designed for distributing, searching, and retrieving documents in Internet Protocol networks. [1]

There are still some servers out there, some are new, and offer services such as HackerNews, Project Gutenberg and others. Thanks to Anthk @anthk@paquita.masto.host who has made a list of some of these Gopher servers

Does the web allow you to do this at 2.7 KBPS?

  • Gutenberg gopher://gopher.icu/7/gutenberg
  • Internet Archive gopher://tilde.pink/1/~bencollver/ia/
  • Huge portal gopher://magical.fish
  • News, blog and more gopher://1436.ninja
  • Reddit gopher://gopherddit.com
  • HN gopher://hngopher.com
  • Google Maps (text) gopher://tilde.pink/1/~bencollver/dir
  • Podcasts: gopher://gopher.icu/1/pod
  • Dictionary: gopher://tilde.pink/1/~bencollver/dict Blogs:
  • gopher://sdf.org
  • Weather (finger):
  • gopher://graph.no:79/0/London

There are still clients software out there, and yeah you can all this with good old plain text.

apt search gopher

Links

  1. Wikipedia – Gopher Protocol

DIY Gopher Server

Note the tutorial above on how to set up gopher on a Raspberry Pi, appears to be using system V, (init.d system I think) hence I have included the 3rd link which covers how to manage services on both. The 2nd link should help with setting up the actual gopher files.

I tried to install the software mentioned in the first link above and there seems to be a problem with this in my raspberry pi, so I removed this and have installed gophernicus instead.

22/4/2025

If all else fails then vern.cc members get gopher as one of the services. So I will look at a hosted service.

21/4/2025

Had issues with gophernicus as I am not sure where the config file is.

Tags

#Internet,#Communication.#Protocol,#Gopher,#Software,


MastodonPeertubeJoin Mastodon

AI statement : Consent is NOT granted to use the content of this blog for the purposes of AI training or similar activity. Consent CANNOT be assumed, it has to be granted.

Donate using Liberapay

Humble Bundle – DevOps 2025

Another offer from Humble Bundle

Infrastructure as Code, 3rd Edition Terraform Cookbook Continuous Deployment Policy as Code Kubernetes and Cloud Native Associate (KCNA) Study Guide Learning DevSecOps Terraform: Up and Running, 3rd Edition Ansible: Up and Running, 3rd Edition Certified Kubernetes Administrator (CKA) Study Guide Designing Machine Learning Systems DevOps Tools for Java Developers Certified Kubernetes Application Developer (CKAD) Study Guide, 2nd Edition Python for DevOps DevOps with OpenShift Effective DevOps

Tags

#Books,#DevOps,#HumbleBundle


MastodonPeertubeJoin Mastodon

AI statement : Consent is NOT granted to use the content of this blog for the purposes of AI training or similar activity. Consent CANNOT be assumed, it has to be granted.

Donate using Liberapay