Skip to content

Instantly share code, notes, and snippets.

View anxiousmodernman's full-sized avatar
🎺
ready for a ska revival

Coleman McFarland anxiousmodernman

🎺
ready for a ska revival
View GitHub Profile
@anxiousmodernman
anxiousmodernman / REQUIREMENTS.md
Last active December 2, 2016 14:49
Golang coding demonstration

Go(lang) Coding Demonstration

Supply buildable source code that runs as a simple webserver.

The webserver is for storing clients' favorite foods. It should expose two API operations:

  • GET on a route "/foods" to return a list of all your favorite foods
  • POST on the same route "/foods" to add a food to the list
@anxiousmodernman
anxiousmodernman / CONTRIBUTING.md
Last active August 15, 2021 08:28
CONTRIBUTING.md

Code Quality and Contribution Guidelines

Tests

Code should be submitted with a reasonable suite of tests, and code should be designed with testability in mind.

Commit Messages

Commit messages should explain why code is changing, configuration is added,

@anxiousmodernman
anxiousmodernman / terraform-error-1481165731.log
Created December 8, 2016 03:02
terraform-error-1481165731.log
5 error(s) occurred:
* plan operation: Real and shadow states do not match! Real state:
<no state>
module.child:
<no state>
Outputs:
received = 1GB
@anxiousmodernman
anxiousmodernman / Vagrantfile
Created February 15, 2017 16:02
Make a Centos box
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
@anxiousmodernman
anxiousmodernman / golang.md
Last active March 5, 2017 18:12
Write Golang!

Write Golang!

Go makes writing robust, powerful software easy. Write it!

Prerequesites

  • set a GOPATH and all your code lives there (echo $GOPATH)
  • make sure Go is installed with go version
  • set an alias in your shell to make it easy to hack: alias golang="cd $GOPATH/src/github.com"
@anxiousmodernman
anxiousmodernman / domainsocket.rs
Last active March 12, 2017 22:25
Reading JSON from Unix domain socket
extern crate unix_socket;
extern crate serde_json;
use serde_json::Value;
use std::thread;
use std::io::{Cursor, BufRead, BufReader};
use unix_socket::{UnixStream, UnixListener};
fn handle_client(mut stream: UnixStream) {
@anxiousmodernman
anxiousmodernman / config_mgmt.md
Created April 18, 2017 19:39
What does config management do?

Jobs for Config Management

  • determine if a service is running (ask systemd)
  • install a service (drop .service files; tell systemd)
  • identify hosts (ask consul)
  • identify hosts by attribute (ask consul... is this an ubuntu host?)
  • deliver files to hosts; config or packages or binaries
    • scp-ish way (local to remote)
  • wget-ish way (download from known place)
@anxiousmodernman
anxiousmodernman / roll_call.md
Last active July 8, 2017 02:13
DSA (Democratic Socialists of America) GitHub orgs
[Unit]
Description="My Website"
[Service]
Slice=machine.slice
Environment="CERTS=/etc/letsencrypt/live/stage.coleman.codes/"
ExecStart=/usr/bin/rkt run --net=host --debug /opt/site/caddy-local-linux-amd64.aci --insecure-options=all --volume certs,kind=host,source=${CERTS},readOnly=true
KillMode=mixed
Restart=always
@anxiousmodernman
anxiousmodernman / Dockerfile
Last active July 26, 2017 19:11
Dockerized protoc compiler example
FROM golang:1.8.3-jessie
RUN apt-get update -qq
RUN apt-get install -y zip git
RUN mkdir -p $GOPATH/src/github.com/AsynkronIT/
RUN cd $GOPATH/src/github.com/AsynkronIT/ && git clone https://github.com/AsynkronIT/protoactor-go.git
RUN curl -L 'https://github.com/google/protobuf/releases/download/v3.2.0/protoc-3.2.0-linux-x86_64.zip' > proto.zip