Generative AI code assist

I considered use “Vibe Coding” as the title, but it’s just such a buzz word that I decided to go with a more factual title. I’m old school enough to want to distinguish between generative AI and the more broad AGI (Artificial General Intelligence). I’ll also state that I consider myself a bit of an AI coding skeptic, but hopefully in a healthy way.

Just like any computer program, garbage-in, garbage-out. The modern buzz word for this is AI-slop. I’ll avoid bashing the technology and focus on how you can use it constructively today, even with some of it’s limitations. I will also confess that at work I’ve got access to AI for code generation and it’s been interesting learning a new set of skills, this post will focus on what you can do for free on the web.

Perchance has a no login required, free code generator. I was in the process of setting up karakeep to replace wallabag. Both of these tools perform a similar function, effectively a web based bookmark manager and offline capture of a web resource. A simple list of links + archive.org would solve the same problem, but this is a self-hosted solution and is pretty neat.

The task at hand is to figure out how to export all of my links from wallabag and the import them into karakeep, the more context I can preserve the better. Since there isn’t a common import/export format between the two tools, we’ll use the aforementioned code generator to create something to convert the file.

Luckily both support a JSON based format. I can export from wallabag into JSON. It looks something like this

And karakeep has both an import/export supported into JSON format

First we will create a few sample entries in karakeep and do an export to figure out what it’s format is. It turns out to look something like this:

If you look at the two formats, you can see some obvious mappings. This is good. I started with the perchance code generator and a very simple prompt:

This let me get my feet wet, and make sure I had my environment setup to run code etc. I do have reasonable javascript experience, and that will help me use the code generator as a tool to move quickly. I tend to think of most of these AI solutions as doing pattern matching, they pick the ‘shape’ of your solution and fill in the blanks – this is also where they will make stuff up if there is a blank and you haven’t given it enough context, it’ll just guess at a likely answer.

Once I had the code generator creating code, and I was able to test it, things moved along fairly quickly. I iterated forwards specifying the output format JSON etc.. and I was both a bit amazed, but pleased to see that it had decided to use the map capability in nodejs. This made the generated code quite simple.

My final prompt ended up being:

And this is the code it generated

Notice anything curious here? It has, without me saying anything, decide to map title and tags into the output object. Very nice – I’m impressed.

Was there any really smartness here? Well, I would not have arrived at the idea of using map in the javascript code – it’s the right and elegant solution. A stronger javascript developer would have likely landed here since it is a concise solution to the problem. Maybe I would have found a similar answer on stackoverflow, but the code generator made it easy for me.

The date manipulation is also very slick.

I would have eventually got there, but it just did it for me. A very nice time saver.

This generated javascript let me export / import 376 entries from my wallabag — preserving the original dates, tags and titles.

Sometimes working with AI for code is like having a book smart, and very fast, new hire. No experience, lots of enthusiasm, and cranks out code quickly. Does the code work? Not always, maybe not even often. I’ve also had to ‘reset’ the approach being used, when multiple iterations uncovered that it was basically impossible to solve the problem using the approach that I started with. Using test driven development can help provide guide rails for ‘working / not working’, the more context you can provide the better. Learning how to guide the AI, and evaluate if you’re getting what you intended to ask for are the new skills I’ve been growing.

I feel I do need to throw down some caution flags around AI use. If you’re using something that is ‘free’, think again why are they making it free to use? Open source projects, don’t mean that it’s safe. Under the covers, this is all still built out of the same parts – so if you use it to open your network and data to the internet, you’ve got the same security problems.

Interesting times.

2011 Macbook Pro – A1278 keyboard replacement

Around 2015 we bought a used Macbook Pro for home use. It was replacing an iMac all in one that had a bad power supply. I didn’t realize it at the time, but it was a real powerhouse of a machine if you look at the specs.

Over time it was clear that older mac wasn’t keeping up. I had done a few upgrades that helped extend it’s life. I’d put in 16GB of RAM – very worth the money. I also later swapped in an inexpensive 480GB SSD. The USB ports got wiggly over time and the keyboard slowly started to fail.

By 2020 it was well past time to replace it, which I did with a Macbook Air M1 (base). Of course I still hung onto the old machine which still worked, but was paired with a bluetooth keyboard. I finally got around to ordering a replacement keyboard from Amazon – a Padarsey.

Of course one of the first places I go for help is iFixit. Unfortunately the repair section for this laptop doesn’t seem to include a keyboard replacment. I used the upper case disassembly instructions and they were close enough and helpful. The keyboard is hidden underneath everything, so you have to take almost everything apart to replace it.

Annoyingly there are three different types of screwdrivers you’ll need: phillips, torx, and tri-wing. I’m really happy with the Kingsdun 60-in-1 set I got recently. It’s got lots of sizes and it’s bailed me out a few times. The bits are not the highest quality, but having the right shape and size makes things possible.

I ended up re-using the existing keyboard screws (there were so many of them!) instead of the ones that came with the new keyboard. I was also grateful for my magnetic mat which helped keep all of the screws organized. Re-using the back-light wasn’t difficult at all.

It was with relief that I saw the system boot up right way after I’d re-assembled it. There are a lot of little bits to get right. It was an epic repair and I’m not sure I’d rush to do it again. Now with a fully working keyboard it’ll continue to get some light use as a secondary machine.

Moving things along

I’m a terrible digital hoarder. I have email archives that reach back years. I have multiple copies of my digital photos. I even have at least partial copies of old machine installs going back years. Heck, it’s just bits and storage is cheap.

This translates a little bit into the physical world, but at least for this post I’ll focus on cool technology that I’ve bought and just can’t let go.

First up is the SLIM Devices Squeezebox. At the time this was a ~$400 device, and while I’d already digitized a lot of our music from CD to MP3 this opened up a novel way to explore our music collection.

The remote was useful, but where things really got neat was the web browser interface to the music server where you could queue up songs as you ‘discovered’ them. This was a neat audiophile device supporting digital out so you could connect this into your HiFi gear. There was even FLAC support if you wanted to go that path.

Sadly, two things made this device fail.

  1. The company was acquired by Logitech and there were multiple reshuffles of the software / ecosystem. Newer devices came out, and the legacy stuff was left in the dust.
  2. Streaming services became the new way to listen to music. The apps got really good and the friction between you and the music you wanted to hear was removed. Owning your music became less important to consuming music.

I can imagine a few futures where a device like this would survive if it had something like Plex supporting it. Today I still have my digital music collection, but it’s served up by Plex and we use the various Plex apps and supported devices to listen to it – including an Ikea Sonos speaker.

The second device is the Acer AspireOne. This was also around ~$400 when it came out, which was a ground breaking price point for a laptop. Sure this was a tiny 8.9″ screen, but it had everything we’ve come to assume a Chromebook can do. It was branded a Netbook, a category that died when Chromebooks came out.

For a while, this was used as Jenn’s primary device. It had access to email, could surf the web and even had a webcam and mic for recording video. (this was before we had ubiquitous video meeting software). It even supported local document editing via early versions of what we know as LibreOffice now.

It was replaced with a mac mini ages ago, which in turn was replaced.. I kept this little laptop around. The original software was a special Linux build that was really pretty horrible, but as this was just a standard intel based machine it would accept a lot of the usual Linux distros.

At one point I even managed to squeeze neverware onto this to make it into a very low end Chromebook. It worked, but was barely capable of doing some of the heavier web workloads that are pervasive on the modern web.

My primary use for this was a hackable Linux laptop that would let me do stuff like reconfigure routers. It’s built in ethernet jack was great for this and meant that I didn’t have to crawl behind my desktop machine to mess with the network.  Sadly the battery on this gave up and it needs to be wall powered, limiting it’s usefulness in terms of portability.

I’ll miss having it, but I’ve since gotten my hands on a 14″ HP Chromebook that I unlocked and installed Linux on, specifically GalluimOS. This has become my go-to portable Linux hack machine. The battery on this isn’t great, but it’ll still run an hour or so. Plenty of time for my needs.

Well, farewell to these devices. I’m glad that they didn’t hit the landfill as I was able to sell them on Kijiji for a couple of bucks. The squeezebox went for $20, very quickly I’ll add. The netbook for $10, which for a working laptop is some unbelievable price apparently. While that is horrible depreciation, at least someone is going to use them for something which has value to me.