Skip to content

Instantly share code, notes, and snippets.

@micahhausler
micahhausler / jq-filter.sh
Last active September 21, 2023 07:27
GitHub collaborator finder
# Go to https://developer.github.com/v4/explorer/ and enter the graphql query with the query veriable:
# {"queryString": "your-githubuser-name"}
cat results.json |
jq '.data.user.repositories.edges[] | { Count: .node.collaborators.totalCount, Repo: .node.name} | select(.Count > 2)'
@micahhausler
micahhausler / custom-duration-seconds-example.yaml
Last active August 9, 2023 21:20
Example ConfigMap, ServiceAccount, and Pod with a custom duration_seconds
apiVersion: v1
kind: ConfigMap
metadata:
name: aws-config
data:
credential-process: |
#!/usr/bin/env bash
aws sts assume-role-with-web-identity \
--duration-seconds 43200 \
--web-identity-token file:///var/run/secrets/eks.amazonaws.com/serviceaccount/token \
@micahhausler
micahhausler / config.ini
Created August 9, 2023 13:25
AWS config file
[default]
region = us-west-2
role_arn = arn:aws:iam::123456789012:role/role-name
web_identity_token_file = /var/run/secrets/eks.amazonaws.com/serviceaccount/token
duration_seconds = 43200 # 12 hours, maximum
# role_session_name = pod_name
@micahhausler
micahhausler / test_runner.go
Created February 10, 2023 16:07
Reflective Go Test Runner
package tests
import (
"reflect"
"strings"
"testing"
)
type TestRunner struct{}
@micahhausler
micahhausler / policy.json
Last active July 3, 2022 13:04
unifi dream router podman configs
{
"default": [
{
"type": "insecureAcceptAnything"
}
],
"transports":
{
"docker-daemon":
{
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "sts:AssumeRole",
"Resource": "arn:aws:iam::444455556666:role/account-n-role"
}
]
}
@micahhausler
micahhausler / Makefile.diff
Last active June 13, 2021 16:13
Tinkerbell hook config for Intel NUC
diff --git a/Makefile b/Makefile
index 253d32b..7329f04 100644
--- a/Makefile
+++ b/Makefile
@@ -22,11 +22,11 @@ export DOCKER_CLI_EXPERIMENTAL := enabled
image-amd64:
mkdir -p out
- linuxkit build -docker -disable-content-trust -pull -format kernel+initrd -name hook-x86_64 -dir out $(LINUXKIT_CONFIG)
+ linuxkit build -docker -format kernel+initrd -name hook-x86_64 -dir out $(LINUXKIT_CONFIG)
syntax = "proto3";
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
import "google/protobuf/any.proto";
package v1alpha1;
service TokenGeneratorService {
// Generate a token with the provided claims
rpc GenerateToken(GenerateTokenRequest) returns (GenerateTokenResponse) {}
@micahhausler
micahhausler / service.proto
Created February 5, 2021 18:11
k8s external token generator
syntax = "proto3";
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
package v1alpha1;
service TokenGeneratorService {
// Generate a token with the provided claims
rpc GenerateToken(GenerateTokenRequest) returns (GenerateTokenResponse) {}
// List all active public keys
@micahhausler
micahhausler / bashrc
Created October 10, 2016 13:25
Kubernetes PS1
NORMAL="\[\033[00m\]"
BLUE="\[\033[01;34m\]"
RED="\[\e[1;31m\]"
YELLOW="\[\e[1;33m\]"
GREEN="\[\e[1;32m\]"
PS1_WORKDIR="\w"
PS1_HOSTNAME="\h"
PS1_USER="\u"
__kube_ps1()