Skip to content

Instantly share code, notes, and snippets.

View leehambley's full-sized avatar

Lee Hambley leehambley

View GitHub Profile
@leehambley
leehambley / tikka_masala.md
Created January 23, 2020 15:27 — forked from headius/tikka_masala.md
Chicken Tikka Masala

Chicken tikka masala

Time: 50 minutes

Serves: 4-6

Ingredients

#!/usr/bin/env ruby
IAM_ARNS = {
web_app: '...',
mobile_app: '...',
admin_app: '',
backups_script: '',
}
# Connect to KMS

Restartable iterator

I needed this for a kind of index that allows me to subscribe to a tag in a git repo, but also get notified on a rebase or a head pointer move.

I was getting bogged down in the details (Git is a single-linked list starting at the head, so walking over it from the first commits to the newest commits is tricky)

This iterator seems to fulfil my needs around tracking the position within the list, and being able to reset.

The meta API (pointer, implements error interface, has other methods for checking if rewound or EOF) seems to be as neat as one could hope to expect.

require 'fiddle'
color_iter = DATA.readlines.map(&:chomp).map { |i|
i = i.to_i(16)
[(i >> 16) & 0xFF, (i >> 8) & 0xFF, i & 0xFF, 255]
}.each
SIZEOF_HEAP_PAGE_HEADER_STRUCT = Fiddle::SIZEOF_VOIDP
SIZEOF_RVALUE = 40
require 'fiddle'
color_iter = DATA.readlines.map(&:chomp).map { |i|
i = i.to_i(16)
[(i >> 16) & 0xFF, (i >> 8) & 0xFF, i & 0xFF, 255]
}.each
SIZEOF_HEAP_PAGE_HEADER_STRUCT = Fiddle::SIZEOF_VOIDP
SIZEOF_RVALUE = 40
@leehambley
leehambley / simple_partition_iterator.go
Created February 4, 2019 14:46
simple_partition_iterator.go
package depot
import (
"context"
"fmt"
"time"
"github.com/pkg/errors"
"github.com/retro-framework/go-retro/framework/object"
"github.com/retro-framework/go-retro/framework/packing"
@leehambley
leehambley / SketchSystems.spec
Last active January 29, 2019 10:43
Hierarchical Selection*
Hierarchical Selection*
Selection One*
1A -> Selection Two
1B -> Selection Two
1C -> Selection Two
Selection Two*
2A -> Selection Three
2B -> Selection Three
2C -> Selection Three
2D -> Selection Three
@leehambley
leehambley / main.go
Created January 7, 2018 17:43 — forked from 3n21c0/main.go
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"
@leehambley
leehambley / https.go
Created January 7, 2018 17:43 — forked from kennwhite/https.go
Simple https http/2 static web server with HSTS & CSP (A+ SSLLabs & securityheaders.io rating) in Go using LetsEncrypt acme autocert
package main
import (
"crypto/tls"
"golang.org/x/crypto/acme/autocert"
"log"
"net"
"net/http"
)
@leehambley
leehambley / mentionable_trix.js.coffee
Created July 13, 2017 13:51 — forked from lawso017/mentionable_trix.js.coffee
@mentions with trix-editor and selectize.js
window.addEventListener "trix-initialize", (e) =>
Utility.TrixMentions.prepare($(e.target))