- OpenAPI toolkit common string formats: github.com/go-openapi/strfmt
- Seamless printing to the terminal (stdout) and logging to a io.Writer (file) that’s as easy to use as fmt.Println: https://github.com/spf13/jwalterweatherman
- Go package for dealing with maps, slices, JSON and other data: https://github.com/stretchr/objx
- Efficient JSON beautifier and compactor for Go: https://github.com/tidwall/pretty
- bbolt is a fork of Ben Johnson's Bolt key/value store: https://pkg.go.dev/go.etcd.io/bbolt
- Formatters for units to human friendly sizes: github.com/dustin/go-humanize
- Package httpsnoop provides an easy way to capture http related metrics (i.e. response time, bytes written, and http status code) from your application's http.Handlers: https://github.com/felixge/httpsnoop
- Staticcheck - The advanced Go linter: https://github.com/dominikh/go-tools
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
TEMP_DIR=$(mktemp -d) | |
echo Output Directory: ${TEMP_DIR} | |
confirm() { | |
# | |
# syntax: confirm [<prompt>] | |
# | |
# Prompts the user to enter Yes or No and returns 0/1. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var observer = new IntersectionObserver(function (entries) { | |
// isIntersecting is true when element and viewport are overlapping | |
// isIntersecting is false when element and viewport don't overlap | |
if (entries[0].isIntersecting === true) | |
console.log(entries[0].target.id); | |
}, { threshold: [0] }); | |
// Observe all H2 headings and get their id printed into the console whenever they are in focus | |
document.querySelectorAll("h2").forEach(function (item) { | |
observer.observe(document.querySelector("#" + item.id)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# very basic but you can see the gist of it: | |
aws cloudformation list-types --type RESOURCE --visibility PUBLIC | \ | |
jq '.TypeSummaries[].TypeName' | \ | |
cut -d\" -f2 | \ | |
while read a | |
do | |
aws cloudcontrol list-resources --type-name $a 2>/dev/null| \ | |
jq '.ResourceDescriptions[].Identifier' | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This sample code triggers the problem if run against a large directory structure (+50K objects) | |
// I added some instrumention to check how many connections were being resued versus created new | |
// Please change the table name in line 283 and path in line 286 | |
package main | |
import ( | |
"context" | |
"crypto/md5" | |
"strings" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ldd /var/task/node_modules/puppeteer/.local-chromium/linux-869685/chrome-linux/chrome | grep not | \ | |
cut -d= -f1 | while read a | |
do | |
yum provides $a | head -2 | tail -1 | cut -d\ -f1 | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu:18.04 | |
ARG openssl_arch=linux-x86_64 | |
ENV RUSTUP_HOME=/usr/local/rustup \ | |
CARGO_HOME=/usr/local/cargo \ | |
PATH=/usr/local/cargo/bin:$PATH \ | |
DEBIAN_FRONTEND=noninteractive | |
RUN apt-get update \ | |
&& apt-get -y install curl wget lsb-release wget software-properties-common \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Config file to add a Prometheus receiver - not fully as I can't make it scrape another process yet | |
extensions: | |
health_check: | |
receivers: | |
prometheus: | |
config: | |
scrape_configs: | |
- job_name: "otel-collector" | |
scrape_interval: 5s |