Start a new session
tmux
|| tmux new -s name
|| :new
Attach to last session
tmux a
|| tmux a -t name
require 'dry-validation' | |
class Schema < Dry::Validation::Schema | |
group :node do | |
key(:name) { |name| name.str? and name.filled? } | |
key(:children) do |children| | |
children.array? do | |
children.each { |child| child.group?(:node) } |
#!/usr/bin/env ruby | |
# Read stats from input and get an array of arrays (a valid csv representation) | |
stats = STDIN.read.split("\n")[1..-2].reject { |line| line.start_with? '+' }.map { |line| line.split('|')[1..-1] } | |
# Write csv to output | |
require 'csv' | |
csv_string = CSV.generate do |csv| | |
stats.each { |row| csv << row } | |
end |
{ | |
"$schema": "http://json-schema.org/draft-04/schema#", | |
"title": "Event", | |
"description": "Shared schema for domain events", | |
"properties": { | |
"data": { | |
"description": "Arbitrary data detailing the event", | |
"type": "object" | |
}, | |
"id": { |
Serialization | |
============= | |
json 10 102188152 ns/op 37040009 B/op 60000 allocs/op | |
msgpack 100 14042713 ns/op 11520000 B/op 10000 allocs/op | |
msgpack + JSONSChema 1 2751294087 ns/op 533524400 B/op 5790984 allocs/op | |
avro 10 110052083 ns/op 40160011 B/op 610000 allocs/op | |
protobufs 50 30927919 ns/op 19600000 B/op 70000 allocs/op | |
thrift 50 24031566 ns/op 10240000 B/op 10000 allocs/op | |
Deserialization |
data "template_file" "demo" { | |
template = "${file("some_template_file.txt")}" | |
vars = { | |
IMAGE_NAME = "${var.image-name}" | |
} | |
} | |
resource "opennebula_template" "demo" { | |
name = "terraform-demo" | |
description = "${data.template_file.demo.rendered}" |
This gist was created to be referenced by this article.
It creates a DataDog dashboard that provides cost insights, given:
It should be fairly easy to adapt the dashboard to any other cloud platform by replacing the aws.billing
metric by a similar one.