Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Busy bee

Lloyd Moore iolloyd

💭
Busy bee
View GitHub Profile
@iolloyd
iolloyd / demo.tpl
Last active Jan 8, 2020
dynamic inventory from terraform
View demo.tpl
[kube-master]
${k8s_master_name}
@iolloyd
iolloyd / ec2_connect.sh
Last active Aug 1, 2019
AWS EC2 temporarily connect to an instance by id
View ec2_connect.sh
#!/bin/sh
# Allows you to temporarily connect to an ec2 instance, using
# awscli to first push your own key to the instance, then using ssh
# to log in to the instance.
# Assumes a public key called ec2.pub and a private
# key called ec2.
# Usage ec2_connect.sh i-12345679abcdef <other-user> <other-file>
@iolloyd
iolloyd / golang.secure.small.Dockerfile
Created Nov 11, 2018
a super small secure docker container for golang binaries using Alpine and multi-stage builds
View golang.secure.small.Dockerfile
# The smallest starting point is the alpine image
FROM golang:alpine as builder
RUN apk update && apk add git && add ca-certificates
RUN adduser -D -g '' appuser
COPY . $GOPATH/src/mypackage/myapp/
WORKDIR $GOPATH/src/mypackage/myapp/
RUN go get -d -v
RUN CGO_ENABLE=0 GOOS=linux GOARCH=amd64 go build -a -installsuffix cgo -ldflags="-w -s" -o /go/bin/hello
@iolloyd
iolloyd / kafka-zk.Dockerfile
Last active Oct 26, 2018
couples kafka and zookeeper together
View kafka-zk.Dockerfile
FROM java:openjdk-8-jre
ENV DEBIAN_FRONTEND noninteractive
ENV SCALA_VERSION 2.11.12
ENV KAFKA_VERSION 2.0.0
ENV KAFKA_HOME /opt/kafka_"$SCALA_VERSION"-"$KAFKA_VERSION"
RUN apt-get update && \
apt-get install -y dnsutils supervisor wget zookeeper && \
rm -rf /var/lib/apt/lists/* && \
@iolloyd
iolloyd / booking.js
Created Apr 12, 2018
booking a resource
View booking.js
const flatten = arrays => [].concat.apply([], arrays);
const bookTime = (resource, time) => {
const newResource = resource.map(t => {
return (t.start < time.start && time.end < t.end)
? [{start: t.start, end: time.start}, {start: time.end, end: t.end}]
: t;
});
return flatten(newResource);
};
View proof of account
Verifying my Blockstack ID is secured with the address 1JEbu1eU9U7EUMQ1Q8VWeziA2fMcZcUi2B https://explorer.blockstack.org/address/1JEbu1eU9U7EUMQ1Q8VWeziA2fMcZcUi2B
@iolloyd
iolloyd / create_hash_and_salt.js
Created Sep 5, 2017
method to create hash and salt
View create_hash_and_salt.js
import crypto from 'crypto'
import semver from 'semver'
const processVersion = '0.12.0';
const pbkdf2DigestSupport = semver.gte(process.version, processVersion);
const pbkdf2 = (pwd, salt, options, callback) => {
const { iterations, keylen, digestAlgorithm } = options;
if (pbkdf2DigestSupport) {
@iolloyd
iolloyd / about_working.md
Last active Jun 14, 2017
something about working for the man, for Pilar
View about_working.md

From the unnatural sound from a modern thing,

a ring of a clock, a waking bot,

The dream through toil of a better day,

paid for with time and the daily grind

As slaves to a system of a fiat master

@iolloyd
iolloyd / alter.md
Created May 9, 2017
altering permissions to createdb
View alter.md

sudo -u postgres psql -c 'alter user somename with createdb' postgres Or sudo -u postgres createdb -O somename somedb

View keybase.md

Keybase proof

I hereby claim:

  • I am iolloyd on github.
  • I am iolloyd (https://keybase.io/iolloyd) on keybase.
  • I have a public key ASAhk9_vHHaUrMBwWgJ0cCeGoAjI9rRsrxjox-DZD-wD7wo

To claim this, I am signing this object: