Skip to content

Instantly share code, notes, and snippets.

Michael A. Smith kojiromike

Block or report user

Report or block kojiromike

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
@kojiromike
kojiromike / keybase-git-gpg.sh
Last active Oct 19, 2019
Sign Git Commits with Keybase
View keybase-git-gpg.sh
#!/bin/sh
##
# This program can possibly be substituted for gpg in the git `gpg.program` configuration
# to allow a person to use Keybase.io to sign commits on behalf of gpg.
##
# Copyright 2019 Michael A. Smith
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software
View gist:baa0573c392fc5004cf89f44b3831dc0
--- nginx/configure.sls
/etc/nginx/conf.d/default.conf:
file.managed:
- source: salt://nginx/files/default.conf
- makedirs: True
- require_in:
- file: /etc/nginx/conf.d
--- blazegraph/configure.sls (what I currently have)
View fibs.py
#!/usr/bin/env python
"""A few different (but really the same) ways to create the Fibonacci sequence."""
from pprint import pprint as pp
def fibs1():
'''Generate the Fibonacci sequence.'''
x, y = 0, 1
while True:
View gist:69decc01e6372a15ef30a74de8af8755
$ docker build - <<-DOCKERFILE
> FROM alpine
> VOLUME /foo
> RUN touch /foo/bar
> RUN ls /foo/bar
> DOCKERFILE
Sending build context to Docker daemon 2.048kB
Step 1/4 : FROM alpine
---> 3fd9065eaf02
Step 2/4 : VOLUME /foo
View nix-shell-paths-hypothesis.nix
with import <nixpkgs> {};
with pkgs.python27Packages;
##
# Hypothesis: The paths from build-sandbox-paths in /etc/nix/nix.conf
# always get added to the PATH when running nix-shell.
#
# Experiment:
#
# Step 1: Produce a file containing your build-sandbox-paths:
View gist:5ef7dab570ba09df3baae4a93d891276

Quick bullets about structured logging

Details from http://structlog.rtfd.org

Additional motivation from kartar and mipsytipsy

Why structured logging?

A single log message is not as important than many in aggregate. We need machines to aggregate data from many logs/messages. Machines need structured data, or they have to do expensive string parsing. Composing structured logs isn't more difficult than flat messages for humans.

View gist:2049c5d90a7ae0c868f77b90a2c14568
for nic in /sys/class/net/e*; do
[[ -h $nic ]] || continue
/sbin/ifconfig "${nic##*/}" | awk -F: '/inet addr:/{ print $2; exit }'
break
done
@kojiromike
kojiromike / crash.log
Created Sep 26, 2016
Terraform Crash Log
View crash.log
2016/09/26 13:53:16 [INFO] Terraform version: 0.7.4
2016/09/26 13:53:16 [INFO] CLI args: []string{"/usr/local/Cellar/terraform/0.7.4/bin/terraform", "plan", "-out", "p", "."}
2016/09/26 13:53:16 [DEBUG] Detected home directory from env var: /Users/michael
2016/09/26 13:53:16 [DEBUG] Detected home directory from env var: /Users/michael
2016/09/26 13:53:16 [DEBUG] Attempting to open CLI config file: /Users/michael/.terraformrc
2016/09/26 13:53:16 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2016/09/26 13:53:16 [DEBUG] Detected home directory from env var: /Users/michael
2016/09/26 13:53:16 [TRACE] Preserving existing state lineage "b1ad47c4-bcb3-45f5-b03b-84f17585b864"
2016/09/26 13:53:16 [TRACE] Preserving existing state lineage "b1ad47c4-bcb3-45f5-b03b-84f17585b864"
2016/09/26 13:53:16 [WARN] Ignoring AWS metadata API endpoint at default location as it doesn't return any instance-id
@kojiromike
kojiromike / test.json
Created Aug 29, 2016
Packer with salt provisioner that does not validate because of missing local_state_tree
View test.json
{
"variables": {
"ami_name": "bug.test.case.ami.{{timestamp}}",
"minion_id": "anything"
},
"builders": [
{
"ami_description": "Test Case for Packer Salt Provisioner Bug",
"ami_name": "{{user `ami_name` | clean_ami_name}}",
"instance_type": "t2.micro",
View gist:25d7610c25314486da881945c57da4ab
$ docker version
Client:
Version: 1.11.1
API version: 1.23
Go version: go1.6.2
Git commit: 5604cbe
Built: Wed Apr 27 15:27:26 UTC 2016
OS/Arch: darwin/amd64
Server:
You can’t perform that action at this time.