Skip to content

Instantly share code, notes, and snippets.

View kojiromike's full-sized avatar

Michael A. Smith kojiromike

View GitHub Profile
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 September 26, 2016 18:00
Terraform 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 August 29, 2016 02:10
Packer with salt provisioner that does not validate because of missing local_state_tree
{
"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",
$ 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:
@kojiromike
kojiromike / fix-diffcase-images.sh
Created February 18, 2016 20:12 — forked from scottsb/fix-diffcase-images.sh
Fix name of images in Magento whose names only vary by case (renaming them both in the filesystem and the database catalog). This is useful if media files need to pass through a case-insensitive filesystem, like a Mac.
#!/bin/bash
# Settings
SUFFIX=alt
MAGERUNCMD=magerun
# Sanity Checks
type $MAGERUNCMD >/dev/null 2>&1 || {
echo "ERROR: This script requires the command '$MAGERUNCMD' to be executable in the current path."
exit
@kojiromike
kojiromike / fizzbuzz.md
Last active February 18, 2016 02:02
Fizz Buzz

Fizz Buzz

The dumbest programming challenge

Please write a program that prints the numbers from 1 to 100, but for multiples of three print "Fizz" instead of the number and for the multiples of five print "Buzz". For numbers that are multiples of both three and five print "FizzBuzz".

You can do clever things with FizzBuzz. You can write it recursively, or use a stack. You can do better math, remembering that the LCM of three and five is fifteen. But here's the thing about FizzBuzz. Programmers get nervous in interviews and they forget the basics. They don't forget math, or the syntax of a for loop. I mean they forget how to deconstruct a programming problem. FizzBuzz has just enough crap in it that trying to write it in one step is foolish. Break the program down into its discrete functions.

Break the program down

Keybase proof

I hereby claim:

  • I am kojiromike on github.
  • I am kojiromike (https://keybase.io/kojiromike) on keybase.
  • I have a public key ASAW3M4x3WuCFWE2P0Vh1-6-Z-UygvZsKC2gonAinkBLZgo

To claim this, I am signing this object:

Verifying that +kojiro is my blockchain ID. https://onename.com/kojiro
@kojiromike
kojiromike / Continuous Git Flow.md
Last active January 1, 2016 20:12
Continuous Git Flow

Continuous Git Flow

I've been thinking about this for a while, so when James Cowie Tweeted the question I took the opportunity to respond.

What does your git/scm workflow look like with continues deployment? Questioning my git flow esq due to roles of the branches. #lazyweb

— jcowie (@jcowie) December 27, 2015
<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>

Outline

  1. Designate a master branch.