Skip to content

Instantly share code, notes, and snippets.

View joshbeard's full-sized avatar
👽
stranger in a strange land

Josh Beard joshbeard

👽
stranger in a strange land
View GitHub Profile
@joshbeard
joshbeard / eks-k8s-renovate.md
Created January 23, 2024 16:11
EKS Kubernetes version with Renovate

eks-k8s-version-scraper.js

// Script to scrape the EKS Kubernetes versions from the AWS documentation
// and produce a JSON file that Renovate can parse.
// Usage: node eks-k8s-version-scraper.js > eks-k8s-versions.json
const axios = require('axios');
const cheerio = require('cheerio');
const fs = require('fs');
@joshbeard
joshbeard / terminal-record.md
Created December 22, 2022 02:48
Terminal screen recording

Terminal Screen Recording

  1. Install asciinema.

    Homebrew:

    brew install asciinema
@joshbeard
joshbeard / jsonMatch.go
Last active December 6, 2022 03:25
Go: JSON match
// Demonstrate checking if two JSON strings match.
// Formatted JSON can be compared with minified JSON and will match as long as
// the keys and values are the same.
package main
import (
"encoding/json"
"fmt"
"log"
"reflect"
@joshbeard
joshbeard / sha512sum.go
Created December 6, 2022 03:14
Go: sha512 checksum
package main
import (
"crypto/sha512"
"fmt"
)
// shaSum returns a SHA512 checksum of a string.
func shaSum(s string) string {
sha_512 := sha512.New()
@joshbeard
joshbeard / .gitlab-ci-cloudfront.yml
Created April 27, 2022 15:22
GitLab CloudFront Cache Invalidation example
# ------------------------------------------------------------------------------
# == CloudFront Cache Invalidation
# ------------------------------------------------------------------------------
.cf_invalidate:
image:
name: amazon/aws-cli:latest
entrypoint: [""]
stage: CloudFront
when: manual
tags:
@joshbeard
joshbeard / cf-invalidate.sh
Created April 27, 2022 15:19
CloudFront cache invalidate that looks up the distribution ID based on the alias
CLOUDFRONT_HOST=foo.gov
# Get the CloudFront distribution ID based on the host name (CLOUDFRONT_HOST)
cfid=$(aws cloudfront list-distributions --query "DistributionList.Items[].{id: Id,cf_domain: DomainName, aliases: Aliases.Items[0]}[?contains(aliases, '${CLOUDFRONT_HOST}')] | [0].id" --output text)
# Invalidate the cache
aws cloudfront create-invalidation --distribution-id "$cfid" --paths "/one/* /two/*"
@joshbeard
joshbeard / joshbeard-public.asc
Created March 16, 2022 23:31
My GPG Public Key
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQINBGIuF3wBEAC4AHffV5BtU7eSXJU2EJHuOcPrk1S80lsr4iM4OXZN2PEBbilP
ArBU7HsC8VVk6bIvhFyY/FsRPTGQglwJZGquCh5k+ReGhzY9q81gQL2F9b2hO0hO
A8M7eKKu5QuUdIKZeXZ01Pgxj6H3hc1jKOqmCGveoadrXMgp66HiGc6QqPlgjI8P
/E6l/prxgRz2/Io7kntnoECIyw3hdOB51bk7JXLL5mrUZyPgOqBTVqhw6X3rh8MG
bYa5vhrzbGWsTSOiBIiRclJwD40udQw0HSM6IeDMGBgPmI0bzTP1ee/eDNcMT7v1
esHGGci+RQKBSMiRy8aREhsLNe6WRaw9ubWQJSzL6HkEpCLPWZBfvFHuAnlFPZ43
4wZEvyltbHjkZ2MGTo+4Gz06PQotj552sGB5a5SwKBd97wgA7lV/9yO7VoTsAPUx
KOKNIjox2KZ218ogtXKpLr3riALEAVmnlw4PbajTe6dR7fqL1TGWAjB3ZgHMCLUG
@joshbeard
joshbeard / graylog-pipeline-cloudfront-logs
Created May 16, 2021 07:26
Graylog Pipeline: Parse AWS CloudFront Raw Logs
rule "Parse AWS CloudFront Raw Logs"
when
regex("^(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)", to_string($message.message)).matches == true
then
let m = regex("^(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)", to_string($message.message));
let t = parse_unix_milliseconds(to_long(replace(to_string(m["0"]), "."
@joshbeard
joshbeard / keybase.md
Created August 25, 2016 19:53
Keybase Proof

Keybase proof

I hereby claim:

  • I am joshbeard on github.
  • I am joshbeard (https://keybase.io/joshbeard) on keybase.
  • I have a public key whose fingerprint is 19CB 9097 DF60 B2E5 DCB8 2475 E0E2 33C7 D4A3 A42D

To claim this, I am signing this object:

@joshbeard
joshbeard / mac_iso_usb.md
Last active August 29, 2015 14:15
Make bootable USB from ISO on Mac

1. Convert the ISO:

hdiutil convert -format UDRW -o target.img source.iso

Note: It will add a dmg file extension to it, but it's alright.

2. Get a list of mounted devices. Specifically, the USB media: