Skip to content

Instantly share code, notes, and snippets.

View heph's full-sized avatar
:shipit:

Heph Adams heph

:shipit:
View GitHub Profile
@heph
heph / boilerplate.sh
Created September 29, 2018 00:17
How I start all my shell scripts
#!/usr/bin/env bash
#
# Short header explaining what the script does
#
# exit on error, error on unbound variables, disable glob expansion, fail within pipes
set -eufo pipefail
[[ -n "${DEBUG:-}" ]] && set -x
: "${VAR_A=default_value_a}"
@heph
heph / yml2json.rb
Created December 18, 2019 19:30
Converts a yaml file to json with ruby. I'm pretty sure I stole this from the travis-ci project.
#!/usr/bin/env ruby
# frozen_string_literal: true
require 'erb'
require 'json'
require 'yaml'
$stdout.puts JSON.pretty_generate(YAML.safe_load(ERB.new($stdin.read).result))
@heph
heph / json2yml.rb
Created December 18, 2019 19:32
Converts a json file to yaml. Pretty sure I stole this from the travis-ci project.
#!/usr/bin/env ruby
# frozen_string_literal: true
require 'json'
require 'yaml'
$stdout.puts YAML.dump(JSON.parse($stdin.read))