Skip to content

Instantly share code, notes, and snippets.

View BondAnthony's full-sized avatar
👋
Hi!

AJ BondAnthony

👋
Hi!
View GitHub Profile
@BondAnthony
BondAnthony / AWS-CLI.md
Last active January 29, 2024 19:12
Those useful AWS cli commands
for i in $(aws ec2 describe-regions | jq -r '.Regions[].RegionName'); do
echo "Region ${i} --------"
aws ec2 describe-vpcs --region ${i} | jq '.Vpcs[].CidrBlock'
aws ec2 describe-subnets --region ${i} | jq '.Subnets[].CidrBlock'
done

Fetch Volumes

@BondAnthony
BondAnthony / git.md
Last active October 7, 2023 07:48
Git!

Helpful Git Commands

Git log in a pretty format

git log --graph --decorate --pretty=oneline --abbrev-commit

Clean up merged branches from local

git fetch -p && for branch in `git branch -vv | grep ': gone]' | awk '{print $1}'`; do echo "Delete: ${branch}"; git branch -D ${branch}; done
@BondAnthony
BondAnthony / openssl.md
Created June 9, 2020 00:56
The fun of openssl

All those OpenSSL commands

Pull certificates for a domain

openssl s_client -showcerts -connect abond.dev:443

Add the following flag to run SNI negotiation.

 -servername abond.dev
@BondAnthony
BondAnthony / unifi.md
Created August 16, 2020 19:17
Unifi Controller

Unifi Controller

Load your own certificate into Unifi

java -jar /usr/lib/unifi/lib/ace.jar import_key_cert tls.key tls.pem
@BondAnthony
BondAnthony / wall-connector-influxdb.yaml
Last active October 7, 2023 07:45
Tesla Wall Connector
apiVersion: influxdata.com/v2alpha1
kind: Variable
metadata:
name: wizardly-northcutt-83c00b
spec:
associations:
- kind: Label
name: frosty-hamilton-83c001
name: kwh_price
description: Price per kilowatt-hour
@BondAnthony
BondAnthony / main.go
Last active November 27, 2021 01:36
Exponential backoff sample code written in Go.
package main
import (
"fmt"
"math/rand"
"time"
"github.com/cenkalti/backoff/v4"
)

Flux

Here are some examples of Flux queries

Process Uptime

import "system"
from(bucket: "apps")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)

Jaeger all in one

This will create a jaeger all in one deployment enabling zipkin and setting a sampling rules.

#
# Copyright 2017-2019 The Jaeger Authors
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
@BondAnthony
BondAnthony / tcpdump.md
Last active March 22, 2021 16:15
All those handy tcpdump rules

tcpdump

Capture all upd traffic being sent to destination port range 1-1023. Helps when your debugging dns traffic

sudo tcpdump -n udp dst portrange 1-1023

Capture packets being sent to a specific destination host ip.

@BondAnthony
BondAnthony / terraform-actions.md
Last active November 12, 2020 15:56
Terraform monorepo actions

Terraform + Github Actions

I struggled to get the right mix of github actions to lint my terraform modules within a monorepo. Here is the configuration I settled on which dynamically creates new jobs based on the data within the project.

I use a module naming pattern of provider-module_name, which becomes aws-kubernetes or gcp-gke. This information is important because the action executes the following command to create a list of modules.

$(printf '\"%s\"', gcp-* aws-* azure-* | sed 's/,$//')