Skip to content

Instantly share code, notes, and snippets.

View leehambley's full-sized avatar

Lee Hambley leehambley

View GitHub Profile
#!/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 enricofoltran/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))

Contributor License Agreement

The following terms are used throughout this agreement:

  • You - the person or legal entity including its affiliates asked to accept this agreement. An affiliate is any entity that controls or is controlled by the legal entity, or is under common control with it.
  • Project - is an umbrella term that refers to any and all GitHub open source projects.
  • Contribution - any type of work that is submitted to a Project, including any modifications or additions to existing work.
  • Submitted - conveyed to a Project via a pull request, commit, issue, or any form of electronic, written, or verbal communication with GitHub, contributors or maintainers.

1. Grant of Copyright License.