Radio Control Car Racing at Bransgore Since 2025, Jules and I have been racing Tamiya M-class mini touring cars at Bransgore. This is a great little club with an informal and fun attitude to racing. We race on carpet (primafelt) and usually there are 3 rounds and a final, with each heat being 5 minutes.
Posts
Python - Dataclasses
- Get link
- X
- Other Apps
Dataclass Python dataclasses are a new feature introduced in Python 3.7 that allows users to define classes that are primarily used to store data. They are similar to namedtuples, but with some additional features that make them more powerful and flexible. NamedTuple typing.NamedTuple was introduced in Python 3.6 in the typing module and supercede the collections.namedtuple. They allow users to define a class with named fields. NamedTuples are immutable.They are useful for creating simple, immutable data objects. Pydantic Pydantic is a third-party library that provides data validation and settings management using Python type annotations. It is built on top of Python's type hints, which makes it easy to define the structure of your data. Pydantic is designed to be fast and to consume minimal resources, making it suitable for use in large projects. Comparison Python dataclasses are more powerful than namedtuples because they allow for mutable objects, inheritance, and defau...
Go - Interface 101
- Get link
- X
- Other Apps
package main import ( "fmt" ) // A 'class' struct for keeping Deployment data type Deployment struct { Platform string Service string } // A method that acts on Deployment data func (d Deployment) String() string { return fmt.Sprintf("Deployment: %s - %s", d.Platform, d.Service) } // An interface for things that have a String function type StringifiableObject interface { String() string } // A function that can show StringifiableObjects func show(s StringifiableObject) { fmt.Println(s.String()) } func main() { // Create Deployment which has a String method d := Deployment{ Platform: "Eschaton", Service: "alpha", } // Show the Deployment, which is a StringifiableObject show(d) }
Go - Tests - Fizzbuzz
- Get link
- X
- Other Apps
Using FizzBuzz as an example. main_test.go package main import "testing" import "github.com/stretchr/testify/assert" func Test_run(t *testing.T) { fb := run(1,15) assert.Equal(t, "1,2,Fizz,4,Buzz,Fizz,7,8,Fizz,Buzz,11,Fizz,13,14,FizzBuzz", fb) } main.go package main import "fmt" import "strconv" import "strings" func main() { fmt.Println("FizzBuzz Test") } func run(N int, M int) string { out := []string{} for i := N; i<=M; i++ { out = append(out, fizzbuzz(i)) } return strings.Join(out, ",") } func fizzbuzz(n int) string { switch { case (n % 3 == 0) && (n % 5 ==0): return "FizzBuzz" case n % 3 == 0: return "Fizz" case n % 5 == 0: return "Buzz" default: return strconv.Itoa(n) } } go.mod module fizz go 1.18 require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect ...
Go - Project Layout
- Get link
- X
- Other Apps
Core cmd/ Main applications for this project. The directory name for each application should match the name of the executable eg. /cmd/custard internal/ Private application and library code. Enforced by the go compiler. pkg/ Library code that is ok to be used by external applications. api/ OpenAPI/Swagger specs, JSON schema files, protocol definition files. vendor/ Application dependencies managed manually or by go mod vendor. web/ Webapp specific components configs/ Config file templates or default config. Build and CI related init/ System init scripts scripts/ General build, install, analysis scripts build/ Packaging and CI scripts and configs deployments/ test/ docs/ tools/ examples/ third-party/
Docker - exporting & importing images
- Get link
- X
- Other Apps
Export all images docker save -o stack.tar $(docker images --format "{{.Repository}}:{{.Tag}}") Export images from docker compose docker save $(docker compose convert --images) | gzip > stack.tgz Load the stack docker load -i stack.tar Some extra sysadmin tasks Truncate the logs sudo sh - c "truncate - s 0 /var/lib/docker/containers/ **/*-json.log" Kill all images - use at your peril. docker images -a docker rmi $(docker images | awk "NR>0 {print$3}")
Beef Goulash with Dumplings
- Get link
- X
- Other Apps
Beef Goulash with Dumplings 10 minutes 2 hours, 15 minutes Serves 4 to 6 Goulash 2 Tbsp olive oil 2 large onions, thinly sliced (about 4 cups sliced onions) 1 Tbsp sugar 3 garlic cloves, minced (about 1 Tbsp) 1 Tbsp caraway seeds, toasted and ground 1 1/2 tablespoons sweet Hungarian paprika 1 teaspoon spicy Hungarian paprika 2 Tbsp minced fresh marjoram or oregano (or 1 Tbsp of dried) 1 teaspoon minced fresh thyme (or 1/2 teaspoon dried) 1 bay leaf 3 Tbsp tomato paste 2 Tbsp balsamic vinegar 4 cups chicken stock 2 1/2 pounds chuck roast, cut into 2-inch cubes (trimmed of excess fat) 1 teaspoon kosher salt 1/4 teaspoon freshly ground black pepper Dumplings 2 cups cake flour 2 teaspoons baking powder 1 teaspoon salt 3/4 cup milk 2 Tbsp melted butter METHOD 1 Cook the onions, add garlic and caraway: Heat olive oil in a large sauté pan on medium high heat. Add the onions, sprinkle with sugar, and cook, stirring often, until the onions are browned and caramelized, about 20 m...
Chilli Con Carnage
- Get link
- X
- Other Apps
Chilli Con Carnage Light the fire - 1 log, some kindling & some small log pieces 1tbsp Sesame oil, 1tbsp Olive oil in the pan 1/2 Kg mincemeat into the pan.. When it starts cooking, add spices.. 2 tsp Chinese 5 spice 1 tsp turmeric 2 tsp mixed herbs 1 tsp paprika 3 OXO Cubes 6 small dried chillis, crumbled in. Cook mincemeat over the high heat of the fire until nearly done. Add sauces. 2 tins chopped tomatos - mutti polpa 2 tins red kidney beans Simmer over the fire as the heat dies down.
Ansible Variable Precedence
- Get link
- X
- Other Apps
Ansible Variable precedence command line values (for example, u my_user , these are not variables) role defaults (defined in role/defaults/main.yml) inventory file or script group vars inventory group_vars/all playbook group_vars/all inventory group_vars/* playbook group_vars/* inventory file or script host vars inventory host_vars/* playbook host_vars/* host facts / cached set_facts play vars play vars_prompt play vars_files role vars (defined in role/vars/main.yml) block vars (only for tasks in block) task vars (only for the task) include_vars set_facts / registered vars role (and include_role) params include params extra vars (for example, e "user=my_user" )(always win precedence) credit: https://docs.ansible.com/ansible/latest/user_guide/playbooks_variables.html
Python Dependency Injection
- Get link
- X
- Other Apps
Python: importing settings or dependency injection Two common approaches to configuring a python application are importing settings and dependency injection. Importing settings involves creating a settings module or file that contains all the values and configurations needed for your application to run. These settings can then be imported into other modules and used directly. The advantage of this approach is that it is simple and easy to understand, and can work for small projects. The disadvantage is that it increases coupling to the settings module and to the way that those settings are collected. It also makes it harder to unit test a module or class without having to resort to mocking the settings module in some way. Dependency injection involves passing dependencies (such as settings) into a class as parameters, typically using a class method that sets some class variables. The advantage of this is that the class needs no knowledge of the settings module or ho...
Getting FlashFloppy onto the Gotek SFRC922D
- Get link
- X
- Other Apps
These flash floppy emulators from Gotek are great. But they are even better when they have the FlashFloppy firmware loaded. The SFRC922D model I have seems to have some extra holes under the serial/boot jumpers. I chose to use the USB/DFU programming method for which you will need a USB A-A cable. Here's how I put the Gotek into boot mode for DFU: Jumpers for boot/DFU mode. Wirelinks above the white connector. Once in boot mode you can program the device using the dfu-util: I'm using OSX, and used homebrew to install the dfu-util. brew install dfu-util dfu-util --list dfu-util 0.9 Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc. Copyright 2010-2016 Tormod Volden and Stefan Schmidt This program is Free Software and has ABSOLUTELY NO WARRANTY Please report bugs to http://sourceforge.net/p/dfu-util/tickets/ Deducing device DFU version from functional descriptor length Found Runtime: [05ac:8206] ver=1965, devnum=2, cfg=1, intf=2, ...
Acorn A5000
- Get link
- X
- Other Apps
Acorn A5000 Very dirty. And Rusty. After cleaning with acetic acid & IPA Disk drive flashes with a fault code: 00010059 Simulate &00010059 CMOS unreadable PC-style IO world detected ARM 3 fitted/ARM ID read and not ARM2 Long memory test performed Self-test due to power-on So some work needed around the CMOS. UPDATE: 2018-09-23 Fixed the corroded CMOS tracks It Lives! Sorted the rust & painted (Needs lettering) Almost the right grey, but shows up the disk drive :-o
RiscPC 700
- Get link
- X
- Other Apps
Poor old RiscPC suffered the common battery leak from the PCB mounted NiCd. Sadly it caused some damage to tracks around the CMOS clock and memory. The charging circuit for the NiCd was also damaged. Things I know that work now: * Charging - Replaced the failed 180R resistor with a through-hole type as I needed to also get power from the diode and the track had disintegrated. Not pretty. * CMOS I2C - I watched the waveforms on the logic analyser. * Sound & Video from VIDC Battery replacement. NiMh hidden well away from the PCB Life! for the first time since 2009! Little bit better! Some more cleaning of SIMs & VRAM Passable, but I think the VRAM needs replacing now. Well, that's the most life I've had out of this recently, so I'm a bit happier with it. Still some way to go. Next steps. Some new RAM and VRAM.
Acorn A300
- Get link
- X
- Other Apps
Acorn A300 Bit of a Frankensteins Monster. Bits from A300 / A410 and many upgrades. Unfortunately this one suffered a little from poor storage at some point. Luckily most of the damage is just the back panel. Everything else just needs a bit of a clean. There's some great bits of wire linking and factory mods on this board. And a few of my own mods for memory and ARM 3 Bit of rust.. Clean up and repaint..