Skip to content

Instantly share code, notes, and snippets.

View eculver's full-sized avatar
🧠
Braining

Evan Culver eculver

🧠
Braining
View GitHub Profile
@eculver
eculver / error.txt
Created April 18, 2024 16:22
mac + pyspark fail
----> 1 spark = pyspark.sql.SparkSession.builder.getOrCreate()
File /private/var/tmp/_bazel_evanculver/07c3e2715b8fccafd72cb9d10f0c890e/execroot/__main__/bazel-out/darwin_arm64-fastbuild/bin/optout/src/main/python/optout_service_repl.runfiles/3rdparty_deps_pyspark/site-packages/pyspark/sql/session.py:477, in SparkSession.Builder.getOrCreate(self)
475 sparkConf.set(key, value)
476 # This SparkContext may be an existing one.
--> 477 sc = SparkContext.getOrCreate(sparkConf)
478 # Do not update `SparkConf` for existing `SparkContext`, as it's shared
479 # by all sessions.
480 session = SparkSession(sc, options=self._options)
@eculver
eculver / TestAgentService_Register_MeshGateway.patch
Created May 16, 2023 17:10
Example of updating to api test case with closure/func annotation for post-upgrade assertion
diff --git a/api/agent_test.go b/api/agent_test.go
index ebf7381547..bfe27325c1 100644
--- a/api/agent_test.go
+++ b/api/agent_test.go
@@ -1927,28 +1927,33 @@ func TestAgentService_Register_MeshGateway(t *testing.T) {
agent := c.Agent()
- reg := AgentServiceRegistration{
- Kind: ServiceKindMeshGateway,
// package bunny provides the public API for the eBunny tool.
package bunny
import (
"errors"
"fmt"
"strconv"
"strings"
"github.com/eculver/go-play/pkg/bunny/github"
@eculver
eculver / changelog_checker.sh
Created October 3, 2022 17:35
Consul changelog_checker v0.2
#!/bin/bash
# changelog_checker.sh
#
# example:
# ./changelog_checker.sh release/1.11.x main 14828
set -euo pipefail
@eculver
eculver / oss-ent-merge-helpers.sh
Last active November 1, 2022 19:37
Consul OSS→Enterprise Merge Shell Helpers
function ci-for-oss-ent-merge-branch {
local branch
local base
branch="${1:-}"
if [ -z "${branch}" ]; then
echo "branch name required"
echo "usage: ci-for-oss-ent-merge-branch <branch-name>"
return 1
fi
@eculver
eculver / CHANGELOG.md
Created August 9, 2022 01:45
Consul 1.13.0 Changelog

BREAKING CHANGES:

  • config-entry: Exporting a specific service name across all namespace is invalid.
  • connect: Removes support for Envoy 1.19 [GH-13807]
  • telemetry: config flag telemetry { disable_compat_1.9 = (true|false) } has been removed. Before upgrading you should remove this flag from your config if the flag is being used. [GH-13532]

FEATURES:

  • acl: It is now possible to login and logout using the gRPC API [GH-12935]
  • agent: Added information about build date alongside other version information for Consul. Extended /agent/self endpoint and consul version commands
@eculver
eculver / owning-account-assume-role.tf
Last active February 4, 2021 21:32
Chamber IAM Example
# this defines a role "role-name" in the account where this TF will be applied
resource "aws_iam_role" "role_name" {
name = "role-name"
description = "Allows role-name to do things in account"
assume_role_policy = "${data.aws_iam_policy_document.my_role.json}"
}
# this says that any one in a separate account with ID 123456789012 can assume the "role-name" role
data "aws_iam_policy_document" "role_name" {
statement {
@eculver
eculver / batch.go
Created May 31, 2019 22:43
Divide slice into batches
// run at: https://play.golang.org/p/bhgYlgGbdHz
package main
import (
"fmt"
)
func main() {
total := 22
batch := 3
@eculver
eculver / Makefile
Created November 21, 2018 02:02
Makefile capture
foo := a.o b.o c.o
bar := $(foo:%.o=%)
.PHONY: test
test:
echo $(bar)
@eculver
eculver / regex-utils.go
Last active April 3, 2024 14:47
Find all named match groups and return as a map keyed by the group name
// FindAllGroups returns a map with each match group. The map key corresponds to the match group name.
// A nil return value indicates no matches.
func FindAllGroups(re *regexp.Regexp, s string) map[string]string {
matches := re.FindStringSubmatch(s)
subnames := re.SubexpNames()
if matches == nil || len(matches) != len(subnames) {
return nil
}
matchMap := map[string]string{}