Skip to content

Instantly share code, notes, and snippets.

🤜

Benjamin Kane bbkane

🤜
View GitHub Profile
@bbkane
bbkane / names.csv
Created Mar 20, 2020
Change AD Users from Powershell
View names.csv
userid first_name
bkane Benjamin
cmferg Christian
@bbkane
bbkane / rest_test.sh
Created Jan 29, 2020
Reproduce Azure DNS REST API long TXT record creation error
View rest_test.sh
#!/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 Jan 29, 2020
azurerm_dns_txt_record truncates long TXT records on import
View tmp_import-long-values-portal-plan.log
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"
@bbkane
bbkane / crash.log
Created Jan 7, 2020
terraform crash on non-completely specified type
View crash.log
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 Jan 6, 2020
12_azure_aaaa_mismatch_repro logs
View 12_azure_aaaa_mismatch_repro_log.log
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"
View explore_ff_bookmarks_file
#!/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 Jan 30, 2018
Slow, fat, and convenient way to print from C++
View pythonic_print.h
#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
View sort_benchmarks.cpp
#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
@bbkane
bbkane / MarkovChain.py
Last active Jun 22, 2017
MarkovChain in SQL + Python
View MarkovChain.py
import contextlib
import sqlite3
CREATE_TABLES_SQL = """
CREATE TABLE IF NOT EXISTS word
(
id INTEGER NOT NULL,
word TEXT UNIQUE NOT NULL,
number INTEGER DEFAULT 1,
PRIMARY KEY (id)
View spyder.desktop
[Desktop Entry]
Name=Spyder Python IDE
Comment=Edit text files
Exec=/home/ben/anaconda3/bin/spyder
Terminal=false
Type=Application
StartupNotify=true
MimeType=text/plain;
Icon=/home/ben/.local/share/applications/spyder.png
Categories=GNOME;GTK;Utility;TextEditor;
You can’t perform that action at this time.