Skip to content

Instantly share code, notes, and snippets.

⌨️
I may be slow to respond.

Martin Atkins apparentlymart

⌨️
I may be slow to respond.
Block or report user

Report or block apparentlymart

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@apparentlymart
apparentlymart / insteon_decode.go
Created Aug 17, 2019
Insteon RF decoding in Go
View insteon_decode.go
package main
import (
"bufio"
"bytes"
"fmt"
"os"
)
var frameStartN = []byte(`0011000101010101`)
@apparentlymart
apparentlymart / generic_set.go
Created Jul 27, 2019
A prototype Set implementation using the second round of Go Generics proposal with contracts
View generic_set.go
// Package set is an adaptation of an existing Set implementation I wrote (that
// originally used interface{} as its underlying type) to the current Go 2
// Generics proposal at the time of this writing:
// https://go.googlesource.com/proposal/+/4a54a00950b56dd0096482d0edae46969d7432a6/design/go2draft-contracts.md
//
// This adaptation retains the existing feature that a set can be of any type,
// without that type needing to be extended with any additional methods, as long
// as the caller can provide a separate Rules type that provides the necessary
// additional operations. Generics allows the compiler to check the requirement
// that only sets with the same rules can be used together, which was previously
@apparentlymart
apparentlymart / terraform-pr-migrate.go
Created Jun 14, 2017
Terraform Provider PR migration helper
View terraform-pr-migrate.go
//
// This is a helper program to do some of the more tedious steps of migrating
// Terraform provider commits from an older PR in the main Terraform repo to
// a new PR in the new provider repo.
//
// Specifically it:
// - Retrieves the PR commits from the Terraform repo
// - Computes the diff for each commit that the PR introduced
// - Does basic rewriting of paths in the diff for conventions in the new repos
// - Tries to apply the rewritten diff, creating new commits in the current repo
@apparentlymart
apparentlymart / go-here.sh
Created Apr 1, 2017
Helper bash script for creating and activating GOPATHs
View go-here.sh
# Note: this is written for and tested only in bash
function _go-here {
DIR="$1"
export GOPATH="$DIR"
export PATH="$GOPATH/bin":$PATH
echo Activating GOPATH="$GOPATH"
}
function go-here {
@apparentlymart
apparentlymart / diverge.js
Last active Oct 19, 2016
Highland Diverge Stream, pull edition
View diverge.js
var _ = require('highland');
var items = [
'a',
'b',
'c',
'd',
'e',
'f',
View keybase.md

Keybase proof

I hereby claim:

  • I am apparentlymart on github.
  • I am apparentlymart (https://keybase.io/apparentlymart) on keybase.
  • I have a public key whose fingerprint is BBE3 1AF5 8D12 1501 A495 FE10 6D98 B19B CF7A CB7A

To claim this, I am signing this object:

@apparentlymart
apparentlymart / extract-certs.py
Created Sep 12, 2016
Python script to extract generated TLS certificates and keys from a Terraform state
View extract-certs.py
import errno
import json
import os
import os.path
tf_state_path = os.path.join(os.path.dirname(__file__), "..", "terraform.tfstate")
tf_state_file = open(tf_state_path, 'rb')
tf_state = json.load(tf_state_file)
tf_state_file.close()
@apparentlymart
apparentlymart / .padstone.hcl
Last active May 23, 2016
Padstone v2: Multiple targets, like a Makefile
View .padstone.hcl
# Variables are set on the command line:
# padstone build version=v0.0.1 ami
variable "version" {
default = "dev"
}
provider "aws" {
region = "us-west-2"
}
@apparentlymart
apparentlymart / NOTES.md
Last active Jul 26, 2016
AWS Describe/Get actions as Terraform Data Sources
View NOTES.md

AWS Describe and Get actions as Terraform Data Sources

Beyond the read-only resources that existed in Terraform before data resources were an official feature, I'd like to make room for a new pattern for re-usable modules where they accept only the minimum set of ids they need as variables and look up other data via data sources.

Here's a motivating example:

variable "aws_subnet_id" {
    description = "Id of the subnet where the EC2 instance will be created"
}
@apparentlymart
apparentlymart / index.html
Created May 15, 2016
Golang and Terminal.js web terminal
View index.html
<html>
<head>
<script src="/terminal.js/dist/terminal.js"></script>
<style>
#terminal {
background: #000000;
color: #ffffff;
display: inline-block;
padding: 10px;
}
You can’t perform that action at this time.