Skip to content

Instantly share code, notes, and snippets.

View todd-dsm's full-sized avatar
🏗️
Just trying stuff...

Todd Thomas todd-dsm

🏗️
Just trying stuff...
  • smpl-cloud
  • SoCal
View GitHub Profile
@todd-dsm
todd-dsm / Vagrantfile
Created September 14, 2016 15:46
packer-ansible-vagrant-issue
It SEEMS that the issue lies with Vagrant not using the latest packer build. The Vagrantfile is simple:
$ vagrant init builds/safworx.virtualbox.box
$ egrep -v '^($|#|\ \ #)' Vagrantfile
Vagrant.configure("2") do |config|
config.vm.box = "builds/safworx.virtualbox.box"
end
---
#!/usr/bin/env bash
set -uex
dirIndex=()
while read -r -d ''; do
dirIndex+=("$REPLY")
done < <(find ~/.gem/jruby/ -print0)
#printf '%s\n' "${dirIndex[@]}"
printf '%s\n\n' "${dirIndex[@]:(-2):1}"
@todd-dsm
todd-dsm / packer "Segmentation fault" CentOS 7.2
Created October 27, 2016 15:04
packer gets a "Segmentation fault" CentOS 7.2 when headless
Here are some details up front:
$ file /usr/local/bin/packer
/usr/local/bin/packer: ELF 64-bit LSB executable, x86-64, version 1 (FreeBSD), statically linked, not stripped
$ uname -a
Linux system.domain.tld 3.10.0-327.36.2.el7.x86_64 #1 SMP Mon Oct 10 23:08:37 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
----CORE DUMP-----------------------------------------------------------------------
$ gdb /usr/local/bin/packer -c core.10590
==> default: Prepping ssh stuff...
==> default: + ssh-keyscan github.com
==> default: # github.com SSH-2.0-libssh-0.7.0
==> default: # github.com SSH-2.0-libssh-0.7.0
==> default: no hostkey alg
==> default: # github.com SSH-2.0-libssh-0.7.0
==> default: no hostkey alg
==> default: + chown vagrant:vagrant /home/vagrant/.ssh/known_hosts
==> default: + cp -fv /vagrant/sources/id_rsa /vagrant/sources/id_rsa.pub /home/vagrant/.ssh
==> default: ‘/vagrant/sources/id_rsa’ -> ‘/home/vagrant/.ssh/id_rsa’
bootstrap.sh pulls in the build keys and calls the 'git-code' script:
...
###---
### bootstrap.sh: Copy keys for github
###---
printf '\n\n%s\n' "Prepping ssh stuff..."
# FIX this later
#sed -i 's/.*StrictHostKeyChecking.*/StrictHostKeyChecking no/g' /etc/ssh/ssh_config
ssh-keyscan github.com >> "$vagrantHome/.ssh/known_hosts"
@todd-dsm
todd-dsm / debian-jessie-bin-sh
Created November 10, 2016 16:27
Why do scripts execute against dash when $SHELL=/bin/bash ?
#!/usr/bin/env bash
sleep 2
set -eux
###----------------------------------------------------------------------------
### VARIABLES
###----------------------------------------------------------------------------
export DEBIAN_FRONTEND=noninteractive
vagrantHome='/home/vagrant'
backupDir="$vagrantHome/backup"
@todd-dsm
todd-dsm / main.tf
Last active January 16, 2017 19:49
# ------------------------------------------------------------------------------
# This file defines an EC2 instance with:
# * Origins in the GOLDEN_IMAGE AMI.
# * Its own security groups.
# ** That leverages our ssh key(s).
# * Deploys a simple script.
# * And fires-up the app with Docker
# vim: et:ts=2:sw=2
# ------------------------------------------------------------------------------
@todd-dsm
todd-dsm / vim-html.log
Created January 19, 2017 22:47
There's an error when writing an HTML file.
chdir(/tmp)
fchdir() to previous dir
chdir(/usr/local/share/vim)
fchdir() to previous dir
could not source "$VIM/vimrc"
chdir(/usr/local/share/vim/vim80)
fchdir() to previous dir
could not source "$VIMRUNTIME/macmap.vim"
chdir(/Users/vagrant)
@todd-dsm
todd-dsm / gist:0f90b4dbd1c3e8a2ab64ddc90dae55b2
Created January 30, 2017 19:53
python2 and python3 install
brew install python python3
==> Downloading https://homebrew.bintray.com/bottles/python-2.7.13.sierra.bottle.tar.gz
Already downloaded: /Users/vagrant/Library/Caches/Homebrew/python-2.7.13.sierra.bottle.tar.gz
==> Pouring python-2.7.13.sierra.bottle.tar.gz
==> Using the sandbox
==> /usr/local/Cellar/python/2.7.13/bin/python -s setup.py --no-user-cfg install --force --verbose --single-version-externally-managed --record=installed.txt --install-scripts=/u
==> /usr/local/Cellar/python/2.7.13/bin/python -s setup.py --no-user-cfg install --force --verbose --single-version-externally-managed --record=installed.txt --install-scripts=/u
==> /usr/local/Cellar/python/2.7.13/bin/python -s setup.py --no-user-cfg install --force --verbose --single-version-externally-managed --record=installed.txt --install-scripts=/u
==> Caveats
Pip and setuptools have been installed. To update them
@todd-dsm
todd-dsm / app.py
Created March 20, 2017 21:36 — forked from nZac/app.py
import flask
import socket
import fcntl
import struct
app = flask.Flask(__name__)
# http://stackoverflow.com/questions/24196932/how-can-i-get-the-ip-address-of-eth0-in-python
def get_ip_address(ifname):