Posts

Updating the Tapeless Camera

Image
  Found a nice little JVC GY HD100 at a Radio Rally which will become the base of the next Tapeless Hack. This cam at least is HD (only 720p) But has Firewire, So I need to get the nNovia working with that first. Then if that works, will look to upgrade the nNovia to SSD.

Python - Dataclasses

Image
  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

Image
  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

Image
  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 - Hello World!

Image
  mkdir hello cd hello go mod init hello hello.go package main import "fmt" func main() { fmt.Println("Hello, world") } go run hello.go.

Go - Project Layout

Image
  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

Image
  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

  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

Image
  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

Image
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

Image
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 how th...

Anytone AT-5555N Programming port

Image
Fitting a female to female 3.5mm panel mount coupler to the AT-5555N so that I can expose the programming interface using the stock programming cable.    The 3.5mm socket compatible with FTDI serial cables.  

Getting FlashFloppy onto the Gotek SFRC922D

Image
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

Image
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

Image
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.

Hacking the Sureflap Dual Scan Cat Flap

Image
Hacking the Sureflap Dual Scan Cat Flap To get the RFID codes for the 134.2 KHz Cat chip ID's  Aha! A PIC. And an ICD port next to it. PICKit3 at the ready. I'd quite like to get the firmware off this if possible.

Atari ST

Image
Atari ST A good friend found these in the loft and thought I might find some use for them.  There was some interesting software came with them. Transputers! Occam!  And levels of brownness not seen since the 1970's.  This one cleaned up ok though.

Acorn A300

Image
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..

Tatung Einstein

Image
Had a great time at the Newbury Radio Rally and an amazing bit of luck finding this Tatung Einstein from 1984 in pretty good condition.  In another bit of amazing luck one of my friends had a bundle of Manuals, magazines and some disks.

Rebuilding the quad. 4 in 1 esc tryout

Image
Trying out a 4 in 1 ESC. FETs look a bit weedy but we'll see how it goes. Also added the camera and vtx.

Right angle SMA VTX mod for mini quad

Image

Project Transputer

Image
Project Transputer is coming along nicely. I repurposed the board from another project. It's got Bluetooth and Wifi modules already mounted and 5V and 3V regulators.

Amazon AWS basics in Rails

Listing Amazon EC2 instances # Class for VM's class Vm include ActiveModel::Validations validates_presence_of :name, :status attr_accessor :id, :name, :dns, :status @@ec2 = AWS::EC2.new() def self.all return @@ec2.instances.inject([]) { |m, i| tags = i.tags.to_h name = tags['Name'] m.push Vm.new( i.id, name, i.dns_name, i.status ) } end def initialize( id, name, dns, status ) @id = id @name = name @dns = dns @status = status end end Listing Amazon S3 buckets # Class for S3 Storage class Storage include ActiveModel::Validations validates_presence_of :name attr_accessor :name @@ec2 = AWS::S3.new() def self.all return @@ec2.buckets.inject([]) { |m, i| m.push Storage.new( i.name ) } end def initialize( name ) @name = name end end https://gist.github.com/CustardCat/7175295 AWS Config config/initializers/aws-sdk.rb AWS.config({  :secret_ac...

Handling and Tyre wear patterns

Image
Racing last night at Bashley the car was still quite unstable. For the last few races I have been changing one setting at a time to pin down which are making improvements. So far I've stiffened the front springs, moved the shock positions on the rear and toed out the steering a little. The car was better but still quite hard to tame the back end.. If you look closely at the tyres you can just about make out that the insides of the tyres are a little duller meaning that the majority of the cars weight has been on the insides even during dynamic handling. This is a big clue to start looking at the camber adjustments. Camber is the angle of the wheel relative to the track looking from the front of the car. 0 degrees means the wheel is dead vertical. -5 degrees means the top of the wheel is angled toward the centreline of the car. A little negative camber can be useful, but evidently I had too much. I rather unscientifically reduced the amount and in the next heat the car was ...