Skip to content

Instantly share code, notes, and snippets.

View lwoodson's full-sized avatar

Lance Woodson lwoodson

View GitHub Profile
set -o errexit
set -o nounset
# This is a convenience script to set up your user on a host with your public
# SSH keys obtained from github. No warranty. Use at your own risk.
GITHUB_USER=${GITHUB_USER:=$USER}
echo Setting up ${USER} with for ssh auth using keys of ${GITHUB_USER} in github...
echo
echo "Setting up ~/.ssh directory..."y
# UAT
curl -X DELETE -d "name=uat-sodexo-svc.prod.us-east-1.nexus" http://prod-nexus-dns1.prod.us-east-1.nexus:8080/cname
curl -X DELETE -d "name=uat-sodexo-svc.prod.us-east-1.nexus" http://prod-nexus-dns1.prod.us-east-1.nexus:8080/a
curl -X POST -d "name=uat-sodexo-svc&ip=10.100.58.52" http://prod-nexus-dns1.prod.us-east-1.nexus:8080/a
curl -XGET uat-sodexo-svc.prod.us-east-1.nexus/api/v1/task/
curl -X DELETE -d "name=uat-sodexo-svc.prod.eu-west-1.nexus" http://prod-nexus-dns1.prod.eu-west-1.nexus:8080/cname
curl -X DELETE -d "name=uat-sodexo-svc.prod.eu-west-1.nexus" http://prod-nexus-dns1.prod.eu-west-1.nexus:8080/a
curl -X DELETE -d "name=uat-sodexo-svc" http://prod-nexus-dns1.prod.eu-west-1.nexus:8080/cname
@lwoodson
lwoodson / cfnviz.md
Last active November 14, 2016 19:15

Working on a tool to visualize cloudformation templates. Running cfnviz against this template yields this visualization:

demo

The tool has a python 2.7 and GraphViz dependency.

Diagrams are great to help people new to a project quickly grok the structure and relationships of a system, but are hardly ever maintained. Show me a graph in a project, and I'll show you something out of sync that represents the state of that project about a year ago. The nice thing about this tool is that when you run it against a template, it renders the image and opens it very fast. I can run it whenever I need to see the current state of a cloudformation template without anyone on the team having to remember to update/maintain a diagram.

You can attach it to a build pipeline provided you can install python 2.7 and GraphViz. You could have the visualization of cloudformation templates generated ever

@lwoodson
lwoodson / install-json2yaml.bash
Last active August 10, 2022 15:57
Convert JSON to YAML via stdin (Ruby)
#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o xtrace
sudo cat > /usr/local/bin/json2yaml <<EOT
#!/usr/bin/env ruby
require 'json'
require 'yaml'
@lwoodson
lwoodson / 1_cloudformation-vim-snippets.md
Last active June 1, 2020 18:32
Supporting a new file extension in Vim based on existing file extension

I use this for identifying *.cfn.json and *.cfn.yml files as JSON and YAML format cloudformation templates. Their filetypes are set to cfn_json and cfn_yaml respectively. I can then have custom highlighting of key attributes and/or custom snippets set up that are not polluting my editor when I am working with straight javascript/yaml intended for other purposes. This in on mac os x after installing vim 7.3 along with vim-snipmate and vim-snippets plugins. Someone feel free to improve on this.

1. in ~/.vimrc:

au BufRead,BufNewFile *.cfn.json set ft=cfn_json
au BufRead,BufNewFile *.cfn.yml set ft=cfn_yaml
au BufRead,BufNewFile *.cfn.yaml set ft=cfn_yaml
raise "must set DIGITAL_OCEAN_SSH_KEY" unless ENV['DIGITAL_OCEAN_SSH_KEY']
# Floating ips cannot have tags as a limitation of DigitalOcean's resource
# model. Floating ips for environments need to be created via console and
# set here. These are the primary entry points for everything and are in
# the sfo2 datacenter. There is a request to enable labelling for floating
# ips, this should be changed whenever that is available.
FLOATING_IPS = {
"sfo2" => {
"dev" => '138.68.37.45',
@lwoodson
lwoodson / 1_individual.md
Last active October 14, 2016 13:25
Kayak Camping Gear List - 2 day trip

Camping

  • Tent | bivy sack
  • Sleeping bag | blanket
  • Toilet paper
  • Trash bag(s)
  • Bug spray
  • Lightweight air mattress
  • Camp Chair (can use yak seat, cooler)
  • First aid kit
  • hydrogen peroxide
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5555
-Dcom.sun.management.jmxremote.port=#{jmx_port} \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.ssl=false
#!/bin/bash
# would be /usr/local/install/helpers.sh or some such
# Just needs to be in predictable location with an absolute path
source "install-helpers.sh"
error
Boheme.parse do |boheme|
boheme.driver :docker_cli
boheme.named "fubar"
boheme.image "maven:3-jdk-onbuild"
boheme.service :mongo do
image "mongo:3.0.5"
depends_on :package
end