Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View apparentlymart's full-sized avatar
⌨️
I may be slow to respond.

Martin Atkins apparentlymart

⌨️
I may be slow to respond.
View GitHub Profile
@apparentlymart
apparentlymart / NOTES.md
Last active July 26, 2016 16:57
AWS Describe/Get actions as Terraform Data Sources

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 19:48
Golang and Terminal.js web terminal
<html>
<head>
<script src="/terminal.js/dist/terminal.js"></script>
<style>
#terminal {
background: #000000;
color: #ffffff;
display: inline-block;
padding: 10px;
}
@apparentlymart
apparentlymart / Terraform-State-Ideas.md
Last active December 24, 2022 17:10
Terraform State Integrity Issues

Issues with Terraform State Management

The idea of "state" is the lynchpin of Terraform, and yet Terraform's workflow is fraught with gotchas that can lead to the loss or destruction of state. This doc is a set of notes about issues I've encountered, what caused them, and in many cases ideas about how to improve Terraform to avoid or reduce the chances of them.

Each of these scenarios has occured at least within my team. Each time one of these occurs it erodes people's confidence in Terraform, giving it a reputation for being fragile and unforgiving of errors. This this document is not written just to criticize but rather to identify ways in which the situation could be improved.

@apparentlymart
apparentlymart / write_vfat.go
Created December 20, 2015 06:24
Make VFAT filesystem from Go
package main
import (
"encoding/binary"
"fmt"
"io"
"os"
)
const bytesPerSector = 512
@apparentlymart
apparentlymart / Proposal.md
Created December 5, 2015 20:17
HTML Social Network

HTML Social Network

Back in July of 2008 I started thinking about HTML microformats for linking together and discovering social objects on the web.

I later discussed this with folks at the Internet Identity Workshop and after a few rounds of discussion we ended up working on Activity Streams instead, which shifted the focus to machine-readable descriptions of actions on social objects. However, the social object research here was the initial basis of what went on to become the "Object Types" in Activity Base Schema, after many iterations.

@apparentlymart
apparentlymart / README.md
Last active August 29, 2015 14:26
AngularJS-Server with Browserify example

angularjs-server with browserify example

This is a basic example of using AngularJS-server with browserify. Since browserify requires bundling, unlike the plain example in the AngularJS-Server readme we need to provide a bundle to both the server-side Angular context and to the browser.

The two bundles can be created using browserify:

@apparentlymart
apparentlymart / iptables-round-robin.sh
Last active August 30, 2023 21:45
round robin to three ports on the same host with iptables
# The following example shows a way to use iptables for basic round-robin load balancing, by redirecting
# packets two one of three ports based on a statistic counter.
#
# TCP packets for new sessions arriving on port 9000 will rotate between ports 9001, 9002 and 9003, where
# three identical copies of some application are expected to be listening.
#
# Packets that aren't TCP or that related to an already-established connection are left untouched, letting
# the standard iptables connection tracking machinery send it to the appropriate port.
#
# For this to work well, connections need to be relatively short. Ideally there would be an extra layer
@apparentlymart
apparentlymart / ec2-example.pad
Last active August 29, 2015 14:23
Example configs for Terraform-based build tool (codename Padstone)
provider "aws" {
region = "us-west-2"
}
provider "aws" {
region = "us-west-1"
alias = "us-west-1"
}
temporary_resource "aws_instance" "source" {
// ..
@apparentlymart
apparentlymart / graph.gif
Last active August 29, 2015 14:23
Terraform providers instantiated too early
graph.gif
@apparentlymart
apparentlymart / README.rst
Last active August 29, 2015 14:21
ncsvc on 64-bit Ubuntu

Turn libncui.so into a standalone executable:

sudo apt-get install gcc-multilib lib32z1
cd ~/.juniper_networks/network_connect
gcc -m32 -Wl,-rpath,`pwd` -o ncui libncui.so

Log in to the VPN UI and get the DSID cookie value.

Run ncui to connect: