RSSAmplifier

Blog

Maori Geek

Recent content on Maori Geek

maori.geek.nzRSS feed ↗112 posts

Latest posts

My New Site

Medium has been going down hill fast. I didn’t notice for a while, since I have been heads down coding, but the other day when I needed to share a post with someone, it didnt even load my blog. I have moved all my blog over to github webpages, using hugo, medium-to-hugo and PaperMod theme. Writing posts and sharing them is very motivating for me and finally medium broke that enough for me to…

I Tried to Write a HTTP Service in Zig and Failed

I really like Zig. I have never wanted to write manually memory-managed code before. I don’t like C because it seems opaque and dangerous and I don’t like Rust for purely aesthetic reasons; but Zig is shiny and new and pretty and I can understand it intuitivly. I wanted to write a small HTTP service in Zig (0.15.2) that used SQLite as a data store and could scale up. To do this I used the…

Being On Call for Type 1 Diabetes with Carer

Managing my 5yo son’s Type 1 Diabetes ( T1D ) at night is a lot like being on call as a software engineer. Both are absolute shite. Waking up to alarms at all hours, trying to fix something to only make it worse, not understanding why anything is happening, alarm fatigue, lost sleep, burnout, and the constant stress you will sleep through an emergency. It is a bit guff to compare the two. Though,…

Sqlite HTTP API: Zig vs Golang

I like shiny new things. Zig is very new, and very shiny, and very fast. I have no experience writing non-garbage collected languages, so I want to test it out and compare Zig with GoLang. Benchmark The benchmark is a HTTP API wrapper around SQLite: ` /write takes a JSON { “name” } and write is to the DB /read returns 100 items ` The SQL: ` – TABLE CREATE TABLE IF NOT

Small, Light, Robust Phones for a Type 1 Diabetic Child

Our 4yo T1D son, Sam, needs to carry a phone everywhere he goes to act as his pancreas. This phone needs to: run Android APS and a few other apps which need Android 11 or above (14 is preferred) . have good bluetooth, Wifi and cell signal. It needs to have constant communication with his Omnipod pump, Dexcom G7 and remote systems like NightScout . be sturdy, light and small. It is strapped to a…

Problems with Predicting Blood Glucose with Regression

I use an app called NightGuard to track my Type 1 Diabetic ( T1D ) son’s blood glucose levels ( BGL ) and alert me if he needs some food or insulin. I love NightGuard. It is one of the most important applications I use to manage T1D. One of NightGuard’s best features is its predictive alerts. These alerts use regression models to try predict BGL and notify of future problems. In this post I am…

Using Inkscape to make Individual Puzzle Pieces for Laser Cutting

My Laser Cutter bed is 300mm x 500mm, and I need to make a shape that is about 900m x 750mm. I could just use squares, but then the joinery gets complicated making sure everything lines up properly. Using jigsaw pieces might be a fun way to make such large shapes, so here is how to do that. Install “ Lasercut Jigsaw ” extension Create the puzzle you want with Extensions > Render > Lasercut Jigsaw

Design: Blood Glucose Levels

I am building a Blood Glucose Display and just wanted to collect a few of other apps examples together to compare and get ideas:#### Dexcom Libre NightGuard Nightscout SugarPixel I don’t 100% like any of them. There are like two ways in which I use this information: As a display to “glance” numbers and to alarm me if something is wrong. Like pull and push information. Using the information to…

Managing a Type 1 Diabetic Preschooler with AndroidAPS

Sam, our 3.5yo T1D, just started preschool. In order to keep Sam safe with his BGL in a good range, reduce our stress and to help the staff at his new preschool we devised a plan that focused on: making a custom Diabetes Action and Management Plan s (called 504 plan s in the US) Automating with AndroidAPS’s SMB (super-micro-bolus) and Remotely controlling AAPS through SMS commands . This post will…

How to implement JavaScript String.length in Golang

I needed to implement JavaScript .length in Golang, the solution was pretty fun so I will tell you how.For some strings Golang’s len function will do, e.g. ` “Hello World!” . length // JS 12 len ( “Hello World!” ) // Golang 12 ` The problems start when you include any unicode characters, e.g. ` “👍” . length // JS 2 len ( “👍” ) // Golang 4 ` This is…

Omnipod Dash + Dexcom G7 + AndroidAPS

I was asked by an Insulet (manufacturers of Omnipod) representative if I would like to share our T1D story with Pharmac (the government organisation that decided which medicines and pharmaceutical products are subsidised) via Diabetes New Zealand . Pharmac recently put out a “ Request for Proposal s” to fund CGMs and insulin pumps. I love the Omnipod and our Dexcom CGM and wish all New Zealand…

GoLang + SQLite on Fly.io with LiteFS: a Quick Benchmark

I am thinking about using GoLang and SQLite for a project. Looking around I found a presentation by Ben Johnson from Fly.io about LiteFS which is working towards a more scalable and reliable SQLite. This post is just about me getting something working with these technologies and stressing them a little. Benchmark I have a simple GoLang app with one route to inserts a row into a SQLite database. I…

Moving to Android APS

In this post I am going to discuss moving our Type 1 Diabetic ( T1D ) 3yo son Sam from CamAPS to AndroidAPS ; Why we moved, the logistics of the the change, our current setup, and the results we are seeing. Sam’s Bedroom door with phone mount Note: This is not medical advice or a recommendation, it is just our experience. #### Leaving CamAPS To manage my sons Type 1 Diabetes ( T1D ) I need data.…

Layered Laser Cut Cardboard Art with Inkscape

I really love art by Martin Tomsky that is created with layers. I wanted to try something similar. The source image: Tui by Matt Binns [ source ] The goal: These are examples from previous attempts Step 1: Preprocess First we take the source image and use cut out the subject and adjust the colour to be very vibrant. Note: Copy Subject in the photos app and New From Clipboard in macOS preview are…

Automating my Son’s Pancreas with CamAPS and Dana-i Insulin Pump

This is the third post about my 2yo son’s Type 1 Diabetes ( T1D ). Previously, I wrote about his initial management coming out of the hospital, then his management with a Continuous Glucose Monitor ( CGM) . This post is about the last three months we have been using the Dana-i insulin pump with the CamAPS Hybrid-Closed-Loop ( HCL ) algorithm. Obligatory: nothing here is medical advice. ### Insulin…

6 Months as a Full Time Pancreas

Managing our Son’s Type 1 Diabetes with Multiple Daily Injections and Dexcom G6 Continuous Glucose Monitor In a previous post , I wrote about my 18 month old son’s (Sam) Type 1 Diabetes (T1D) diagnosis and the first month when we were learning as much as possible and struggling. That post was received with so much love and positivity, I have decided to follow up with a 6 month recap. Sam has now…

What is HbA1c?

And what is NGSP, IFCC, GMI and eAG? What is HbA1c? Glucose in the bloodstream will sometimes randomly link ( glycate ) with a red blood cell’s haemoglobin ( Hb ) creating “ Glycated haemoglobin” or HbA1c . The more glucose there is in the bloodstream the more likely this linking will happen. A red blood cell is in circulation for about 120 days, so the amount of HbA1c in the bloodstream can be…

My Awesome Year (+) At Clubhouse

While catching up with some friends in 2021, they nerd snipe d me by talking about all the interesting scaling problems they were having at Clubhouse. I quickly found myself in a meeting with the Rohan, Clubhouse’s cofounder, discussing all the other novel challenges that such an ambitious product has. Before I knew it, I was on the infra team at Clubhouse. I joined Clubhouse in June 2021 and have…

Add a Dexcom Share Follower with curl

This is just a short set of commands that I used to add a dexcom share follower with curl. I am writing this mostly so I remember if I have to do it again, but also if someone else needs it. This is based off the commands that listed here . Note: use _https://share1.dexcom.com_ if you have a US account and _https://shareous1.dexcom.com_ for non-US account. Authenticate SESSION_ID=$(curl -v -H…

Which Insulin Pump to Choose?

A quick guide to pumps available in New Zealand We are tired. Managing our 2 year old son’s (Sam) type 1 diabetes ( T1D ) with Multiple Daily Injections ( MDI ) is a lot of work. It’s normal to get up and give food or insulin multiple times a night, and it is necessary to give multiple injections at precise times during meals. We need a better tool! The best tool available is an insulin pump . MDI…

The Unreasonable Math of Type 1 Diabetes

This is not medical advice, don’t base any treatments on this. In January 2022, our 18 month old son, Sam, was diagnosed with Type 1 Diabetes (T1D). This was stressful, sad, and scary as we spent 5 days in hospital with him while he recovered from Diabetic Keto Acidosis (DKA). Within an hour of him being diagnosed a wonderful diabetes nurse gave us a literal backpack filled with books and…

My Troubles with Lua

I use Redis and Redis uses Lua as a scripting language. Today was my first day using Lua in anger, and I am still angry.My problem is that in Redis I have many sets of keys, e.g. s1 = {1,2,3} s2 = {3,4} and keys 1=a, 2=b, 3=c, 4=d . I want to return all values of all keys in the union of given sets, e.g. f(s1 s2) = a b c d

Game Of Life: CUDA vs Golang

I got a new graphics card because I want to play around with some machine learning using tensorflow and pytorch. Before I jump into all those high level concepts, with layers and layers of abstractions, I want to understand a little bit more about CUDA and how it works. I usually learn by doing, so I decided to do something pretty easy, implement Game Of Life (GOL) using CUDA. GOL is good use case…

Get an Email if Someone SSHs into Your Box

There are a couple different types of security; preventative will stop something bad from happening and detective will alert you when something bad does happen. I have box that is SSH accessible on the internet that I want secure. There are lots of good sources for preventative SSH security (e.g. no passwords, tight config…) but not many for detective security. To be more secure (and decrease my…

Make Python’s DynamoDB client faster with this one simple trick

AWS DynamoDB is popular because it is super fast & scalable. However, when using the Python client boto3 to fetch a large number of documents we started to noticed some unexplained slowness. This was super annoying as some of our queries were taking 20s to process BUT the actual dynamo query returned in only 6s. So we wanted to find out where that 14s was going.Using dynamodb-local I put 250,000…

Python Decorator to Memoize Instance Methods

For the life of me I could not find a python decorator that memoizes methods on an instance. Something that replaces the pattern: class A: def x(self): if self._x is not None: return self._x self._x = something_difficult() return self._x Sure there is [functools](https://docs.python.org/3.9/library/functools.html) [] (…

Calling Golang functions from Python with Bazel

So I have been doing a lot of Python and Django lately, but I miss Go. As an experiment I wanted to see how difficult it would be to directly call Golang functions from Python using my favourite build tool Bazel. I found this post, which explains how to build and connect the two manually: Python and Go : Part II - Extending Python With Go Great now I am like 90% there!

5 Awesome Years at Coinbase

I joined Coinbase March 28th 2016; my last day is April 2nd 2021. This is a quick write up about my experience on joining and working in the infrastructure team for 5 years at Coinbase, growing from 100 to over 1000 employees, from 3.5 million users to more than 40 million, and from trading $3 billion total to now often trading that in a single day. Coinbase in March 2016

Every Job I Have Had

Everyone has a different path to where they are today. At inflection points in my career I often think back to the jobs that have got me here. I just wanted to list all my paid jobs to reflect on that journey. Candy Mixer at Four Square (1995–96): A family friend owned a dairy (corner store for non-kiwis) and they needed someone to make the pre-packed $1–2 mixed candy bags. Paid $5 an hour and…

How “go build” Works

How does go build compile the simplest Golang program? This post is here to answer that question. The simplest go program (I can think of) is main.go : package main``func main() {} If we run go build main.go it outputs an executable main that is 1.1Mb and does nothing . What did go build do to do create such a useful binary? go build has some args that are useful for seeing how it builds:

Learning to play Asteroids in Golang with NEAT

I am a huge fan of CodeBullet , an educational YouTuber that makes game playing AI bots. That is because computer science education more than just conveying complex ideas, it is also getting people excited using those ideas to solve interesting problems, something CodeBullet does very well. Two years ago CodeBullet showed a bot learning to play Asteroids . I though I wonder if I can do that… in…

Making Asteroids Game with Golang, Lorca/Webview and WASM

In my past few posts [1] [2] I have written about building a desktop application using Golang with Lorca / Webview to run a WebAssembly (WASM) binary. Now, I want to actually try use these technologies in anger and produce a distributable desktop application. I have chosen to make the game Asteroids ( code here ). It is reasonably complicated, fun and lets me play and learn more about Golangs…

GoLang Desktop App with webview/Lorca, WASM and Bazel

On my quest towards building a GoLang Desktop application I found some useful frameworks, Lorca and Webview (which I wrote about in my previous post ). These frameworks create a window which GoLang can inject HTML, CSS, and JavaScript to build the UI. But I don’t want to write JavaScript(!) and deal with all the complexities that comes with it like npm, webpack, typescript… Fortunately, I can just…

Golang Desktop App: Webview vs. Lorca vs. Electron

I want to build a local desktop Golang app, there are a few ways to do this: Electron : bundled Node.js and the Chromium browser to create a packaged local web-app. Usable with Golang frameworks like go-app or go-astilectron . Lorca : using the locally installed Chrome driving it using its d ev-tools communication protocol . Webview : create a native window with webview and render the app inside…

Building an Electron App with Bazel

I want to build a desktop app with: Electron.js : A framework to build a desktop application using a Node.js and the Chromium browser Bazel : a build system to quickly build, test and run applications They seem like they might go well together, so let’s see. Note: we will be focusing on macOS only for simplicity. All code is located at https://github.com/grahamjenson/bazel-electron The Electron…

Longest Single Letter .com Domain Name

I was looking for a domain name, got bored at not finding any I liked, so started looking for other, more specific domain names. I tried aaaaaa.com but this was taken, then aaaaaaa.com , then aaaaaaaa.com and so on. I was surprised by how many of these were registered. So I began to wonder how may a ’s it would take before there was a domain name that I could register. Then I expanded that to…

A Web App Using Bazel Golang WASM and Proto

Gary Bernhardt at PyCon 2014 talked about “The Birth and Death of Javascript” . He predicted, among other things, a giant exclusion zone around San Francisco, a world altering event in 2020, and that WASM would eventually take over the web. Let’s ignore the prior two prescient predictions and focus on the third, WASM taking over . So, I want to build a simple web app by joining a bunch of new and…

Bazel: Why people love/hate it

In Bazel you put files into Rules and get files out, e.g: pkg_tar( name = "package", extension = "tar.gz", srcs = [:file1, :file2] ) The pkg_tar rule takes :file1 and :file2 and spits out the tarball :package.tar.gz, which you can pass to another rule as input. So you input files into rules that output files into other rules, that output files into other rules… until eventually you get the…

Git Log as JSON in Go

For reasons I wanted git log to be parsed in Go and it looks like the easiest way to do that is to output it as JSON and parse into Go structs. First we need to define the format for the JSON (borrowed from here ): var GITFORMAT string = –pretty=format:{ “commit”: “%H”, “parent”: “%P”, “refs”: “%D”,…

How to Digest a Docker Image

How to calculate and manipulate Docker SHA Digests

CloudFormation S3File and S3Zip Custom Resources

LearnLog 8:00am — CleanUp Last time I was able to get the basics of custom resources in Fenrir working. Today I want to finish: Uploading a S3File with custom resource. Create Custom Resource S3ZipFile which will extract the ZIP file. Also clean up some of the code. Test out multi-account deploys with custom resources. Using the Bifrost standard to build deployers provides a framework for building…

CloudFormation Custom Resources in Fenrir

Learnlog 9:50am — Fenrir CloudFormation I am taking today off from learning Bazel and instead I am looking at how to build a CloudFormation static site deployer for Fenrir. Fenrir is a AWS SAM deployer that is basically sam deploy but in a Step Function. I want Fenrir to be able to deploy “full-stack” applications, including front end resources which can sit in S3 as a static assets. This would…

Bazel Docker Tests

Learnlog 7:30am — What to do today In my previous learnlog I built a tree of docker images able to be changed and rebuilt. What I want to try do today is write a tests on the built containers so that if they don’t meet some constraints the build will fail and their dependents won’t be built. Let’s boot up the previous days project and start reading. 8:30am — Yak Shaving Yak shaved by cleaning up…

Bazel Docker Dependency Tree: LearnLog

Learnlog 9:45 am — What I want What I want to do is use Google’s build tool Bazel to build a tree of Dockerfiles that are FROM each other and use Bazels dependency engine to automatically rebuild docker containers if a container they depend on changes. This is currently a manual job at many companies, and as they grow this becomes more tedious and in need of automating. I already have Bazel…

Introducing Fenrir: How Coinbase is Scaling Serverless Applications

Today we’re open sourcing Fenrir, an open source AWS SAM deployer. Learn how we’re using it to scale serverless applications at Coinbase.

YAML Custom Tags in Ruby

I wanted to parse an AWS SAM template file using Ruby. This format uses [intrinsic](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference.html) functions which can be YAML custom tags , e.g. [!Ref](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-ref.html) to reference a parameter or resource. How do I parse a YAML…

Hello SAM: AWS Golang Quickstart

Pre-Req: Must have Docker for Mac installed I wanted to play with AWS SAM to understand how it works and compare to other tech like serverless . Install and Test SAM Use brew to install the aws-sam-cli : ``brew upgrade brew update brew tap aws/tap brew install aws-sam-cli sam –version SAM CLI, version 0.10.0`` Now init a go SAM project: cd $GOPATH/src/github.com/grahamjenson/ sam init…

AWS Step Functions, State Machines, Bifrost, and Building Deployers

AWS Step Functions are hosted state-machines defined according to the Amazon States Language . To execute a Step function you send it JSON data which is given to an initial state to process then pass the output to another state. States are processed until a success or failure state is reached. How a state processes its input and selects the next state depends on its Type . For example, a Task…

AWS API to get EC2 Instance Prices

AWS provides an API for everything! This includes the Pricing API to find out how much you can spend via their other APIs. This API can be difficult to use to answer questions like: How much does an EC2 instance cost? The difficulty comes because the API has a single endpoint [GetProducts](https://docs.aws.amazon.com/aws-cost-management/latest/APIReference/API_pricing_GetProducts.html) that…

Assuming Roles in AWS with Go

So your organization has many AWS accounts , but you have services (like monitoring, deploying, security) that require access to resources across many/all of those accounts. There are a few options for these services: Deploy the service in each account : to add an account you need to recreate the entire service with all its resources, and then maintain all of that infrastructure in perpetuity.…