Skip to content

Instantly share code, notes, and snippets.

View bbkane's full-sized avatar
🤜

Benjamin Kane bbkane

🤜
View GitHub Profile
@bbkane
bbkane / tmp_mermaid.md
Last active April 21, 2023 13:47
tmp_octodns_dynamic_records_mermaid
---
title: Visual Representation of the Rules and Pools
---
flowchart LR
	query((Query)) --goelocate--> rule_0[Rule 0<br>AF-ZA<br>AS<br>OC]
	query --geolocate--> rule_1[Rule 1<br>AF<br>EU]
	query --geolocate--> rule_2["Rule 2<br>(catch all)"]
	rule_0 --to pool--> pool_apac[Pool apac<br>1.1.1.1<br>2.2.2.2]
	pool_apac --fallback--&gt; pool_na
@bbkane
bbkane / insert_view.sql
Created June 29, 2022 00:35
Demo using a View Trigger to insert data into multiple tables
-- https://news.ycombinator.com/item?id=31913062
-- https://sqlite.org/forum/forumpost/cd05f203c94e6458
-- tables
CREATE TABLE user (
id INTEGER PRIMARY KEY NOT NULL,
name TEXT UNIQUE NOT NULL
) STRICT;
@bbkane
bbkane / names.csv
Created March 20, 2020 20:35
Change AD Users from Powershell
userid first_name
bkane Benjamin
cmferg Christian
@bbkane
bbkane / rest_test.sh
Created January 29, 2020 03:03
Reproduce Azure DNS REST API long TXT record creation error
#!/bin/bash
# exit the script on command errors or unset variables
# http://redsymbol.net/articles/unofficial-bash-strict-mode/
set -euo pipefail
IFS=$'\n\t'
# https://stackoverflow.com/a/246128/295807
readonly script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "${script_dir}"
@bbkane
bbkane / tmp_import-long-values-portal-plan.log
Created January 29, 2020 02:35
azurerm_dns_txt_record truncates long TXT records on import
This file has been truncated, but you can view the full file.
2020/01/28 18:29:06 [INFO] Terraform version: 0.12.20
2020/01/28 18:29:06 [INFO] Go runtime version: go1.12.13
2020/01/28 18:29:06 [INFO] CLI args: []string{"/usr/local/bin/terraform", "plan"}
2020/01/28 18:29:06 [DEBUG] Attempting to open CLI config file: /Users/bkane/.terraformrc
2020/01/28 18:29:06 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2020/01/28 18:29:06 [INFO] CLI command args: []string{"plan"}
2020/01/28 18:29:06 [TRACE] Meta.Backend: built configuration for "local" backend with hash value 73024536
2020/01/28 18:29:06 [TRACE] Preserving existing state lineage "23291bcc-217c-c348-724c-73c281fbb0c0"
2020/01/28 18:29:06 [TRACE] Preserving existing state lineage "23291bcc-217c-c348-724c-73c281fbb0c0"
2020/01/28 18:29:06 [TRACE] Meta.Backend: working directory was previously initialized for "local" backend
@bbkane
bbkane / crash.log
Created January 7, 2020 17:15
terraform crash on non-completely specified type
2020/01/07 09:12:50 [INFO] Terraform version: 0.12.18
2020/01/07 09:12:50 [INFO] Go runtime version: go1.12.13
2020/01/07 09:12:50 [INFO] CLI args: []string{"/usr/local/bin/terraform", "console"}
2020/01/07 09:12:50 [DEBUG] Attempting to open CLI config file: /Users/bkane/.terraformrc
2020/01/07 09:12:50 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2020/01/07 09:12:50 [INFO] CLI command args: []string{"console"}
panic: inconsistent map element types (cty.Map(cty.Object(map[string]cty.Type{"ttl":cty.Number, "values":cty.List(cty.String)})) then cty.Map(cty.Object(map[string]cty.Type{"ttl":cty.Number, "values":cty.Tuple([]cty.Type{cty.String, cty.String})})))
goroutine 1 [running]:
github.com/zclconf/go-cty/cty.MapVal(0xc000536bf8, 0xc000536b00, 0xc00003ea40, 0x8, 0xc000536cd0)
@bbkane
bbkane / 12_azure_aaaa_mismatch_repro_log.log
Created January 6, 2020 19:49
12_azure_aaaa_mismatch_repro logs
This file has been truncated, but you can view the full file.
2020/01/06 11:46:07 [INFO] Terraform version: 0.12.18
2020/01/06 11:46:07 [INFO] Go runtime version: go1.12.13
2020/01/06 11:46:07 [INFO] CLI args: []string{"/usr/local/bin/terraform", "plan"}
2020/01/06 11:46:07 [DEBUG] Attempting to open CLI config file: /Users/bkane/.terraformrc
2020/01/06 11:46:07 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2020/01/06 11:46:07 [INFO] CLI command args: []string{"plan"}
2020/01/06 11:46:07 [TRACE] Meta.Backend: built configuration for "local" backend with hash value 73024536
2020/01/06 11:46:07 [TRACE] Preserving existing state lineage "f68ce643-ae51-dd97-2921-b4d60b6fc613"
2020/01/06 11:46:07 [TRACE] Preserving existing state lineage "f68ce643-ae51-dd97-2921-b4d60b6fc613"
2020/01/06 11:46:07 [TRACE] Meta.Backend: working directory was previously initialized for "local" backend
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This is just to find out how firefox bookmarks.json files are structured
__author__ = "Benjamin Kane"
__version__ = "0.1.0"
from collections import Counter, defaultdict
from functools import reduce
@bbkane
bbkane / pythonic_print.h
Last active January 30, 2018 04:43
Slow, fat, and convenient way to print from C++
#include <iostream>
#include <iterator>
#include <array>
#include <string>
// I think this will bloat binary size and be slower,
// but it's for convenient printing, which is worth it :)
// TODO: don't always call by value...
// Of course, I'm mostly passing ints and strings, so it's probably not too
#include <algorithm>
#include <cassert>
#include <chrono>
#include <iostream>
#include <vector>
#include <random>
// NOTE: All iterator concepts are experimental. I'm not going
// to concentrate on them