Skip to content

Instantly share code, notes, and snippets.

@bendrucker
bendrucker / README.md
Created February 24, 2023 03:26
Benchmarking string concatenation written to a buffer in Go

This module benchmarks joining 5 strings with colons and writing the resulting string to a buffer. The result shows that concatenating with + is ~3-4x faster and performs fewer allocations. Fprintf and friends require 1 allocation per formatting operator.

golang/go#8618

go test -bench=.
goos: darwin
@bendrucker
bendrucker / engineering-growth-oss.md
Last active March 12, 2022 01:16
Thoughts on engineering career development and OSS, shared to @TakeScoop

As a first principle, you have to acknowledge that your time and energy are limited resources. Active collaboration (e.g. architecture reviews, code reviews, pairing) is strictly dependent on your time and energy. At a certain team size and development velocity, your capacity for active collaboration will be exhausted by total development output. The exact numbers will vary by organization, but I’d expect this effect to become visible at 5 engineers and well-established at 10. At this point, your value to the company reaches an inevitable threshold, bounded by an input constraint (your labor).

As they approach this threshold, talented engineers will often optimize their active collaboration. They'll move around the company and serve as core contributors on high-priority feature projects. This can be a viable approach to engineering career growth when a company's user and revenue growth is extremely rapid but at best can only establish a somewhat higher threshold. The labor constraint remains.

To break throu

@bendrucker
bendrucker / vault-postgresql-redshift.diff
Created July 10, 2020 19:53
Diff between Vault PostgreSQL and Redshift plugins
--- plugins/database/postgresql/postgresql.go 2020-07-08 15:54:28.000000000 -0700
+++ plugins/database/redshift/redshift.go 2020-07-08 15:54:28.000000000 -0700
@@ -1,15 +1,15 @@
-package postgresql
+package redshift
import (
"context"
"database/sql"
"errors"
@bendrucker
bendrucker / tf-acc-test-postgresql-redshift.log
Last active July 10, 2020 01:03
Results of running PostgreSQL provider acceptance tests against AWS Redshift
$ TF_ACC=1 go test ./postgresql -v -timeout 120m
=== RUN TestProvider
--- PASS: TestProvider (0.00s)
=== RUN TestProvider_impl
--- PASS: TestProvider_impl (0.00s)
=== RUN TestAccPostgresqlDatabase_Basic
TestAccPostgresqlDatabase_Basic: testing.go:569: Step 0 error: errors during apply:
Error: Error creating database "mydb_default_owner": pq: TEMPLATE is not supported
@bendrucker
bendrucker / test.log
Last active August 18, 2020 01:10
Acceptance test run for kubernetes_(default_)?service_account
$ KUBE_CTX_CLUSTER=minikube KUBE_CTX_AUTH_INFO=minikube TESTARGS="-run 'TestAccKubernetes(Default)?ServiceAccount'" make testacc
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test "./kubernetes" -v -run 'TestAccKubernetes(Default)?ServiceAccount' -timeout 120m
=== RUN TestAccKubernetesDefaultServiceAccount_basic
--- PASS: TestAccKubernetesDefaultServiceAccount_basic (7.19s)
=== RUN TestAccKubernetesDefaultServiceAccount_secrets
--- PASS: TestAccKubernetesDefaultServiceAccount_secrets (6.81s)
=== RUN TestAccKubernetesDefaultServiceAccount_importBasic
--- PASS: TestAccKubernetesDefaultServiceAccount_importBasic (7.33s)
=== RUN TestAccKubernetesServiceAccount_basic

Keybase proof

I hereby claim:

  • I am bendrucker on github.
  • I am bendrucker (https://keybase.io/bendrucker) on keybase.
  • I have a public key whose fingerprint is AFBE 8430 360A 2872 97E0 01E3 AF4E 218E EC5B 93E7

To claim this, I am signing this object:

@bendrucker
bendrucker / hello.yml
Created September 19, 2018 20:24
Hello World deployment + service for Kubernetes
---
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: hello-world
labels:
app: hello-world
spec:
replicas: 4
template:
@bendrucker
bendrucker / recommendations.md
Created March 13, 2017 20:22
Amsterdam recommendations

Restaurants

  • Dignita: brunch
  • Greenwoods (locations on Kaizersgracht and Singel, brunch)
  • Seafood Bar
  • Cannibale Royale (BBQ)

Bars

  • Gollem
@bendrucker
bendrucker / cloudfront-batch-certificates.sh
Last active August 12, 2022 00:08
Batch update all CloudFront distributions using a specified certificate ID to a new one
old_certificate="A..."
new_certificate="A..."
distributions=($(aws cloudfront list-distributions | jq --arg certificate $old_certificate -r '.DistributionList.Items[] | select(.ViewerCertificate.IAMCertificateId == $certificate) | .Id'))
echo "Distributions"
echo "============="
printf "%s\n" "${distributions[@]}"
echo "\n"