Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
INSTANCE_ARN=$(aws sso-admin list-instances --query "Instances[0].InstanceArn" --output text)
for PS_ARN in $(aws sso-admin list-permission-sets --instance-arn "$INSTANCE_ARN" --output text --query "PermissionSets[]"); do
echo "Processing $PS_ARN"
for ACCOUNT_ID in $(aws organizations list-accounts --output text --query "Accounts[?Status==\`ACTIVE\`].Id"); do
aws sso-admin list-account-assignments --instance-arn "$INSTANCE_ARN" --account-id "$ACCOUNT_ID" --permission-set-arn "$PS_ARN" --output text --query "AccountAssignments[].[PrincipalType,PrincipalId]" | while read -r PRINCIPAL_TYPE PRINCIPAL_ID; do
if [ -n "$PRINCIPAL_TYPE" ]; then
echo " Deleting assignment: $ACCOUNT_ID $PRINCIPAL_ID"
{
"alwaysThinkingEnabled": true,
"enableAllProjectMcpServers": true,
"enabledMcpjsonServers": [],
"enabledPlugins": {
"clangd-lsp@claude-plugins-official": true
},
"hooks": {},
"permissions": {
"allow": [
AWSTemplateFormatVersion: "2010-09-09"
Parameters:
GitLfsUsername:
Type: String
Description: Username for authenticating against Git LFS endpoint
GitLfsPassword:
Type: String
Description: Password for authenticating against Git LFS endpoint
Outputs:
LfsEndpoint:
@Benbentwo
Benbentwo / datadog_cluster_checks.yaml
Created April 19, 2022 19:50
sample remote file for cluster checks in cloudposse's Datadog component. Using this as a test to merge something into local
http_check.yaml:
cluster_check: true
init_config:
instances:
- name: "[${stage}] Instance Name"
url: "https://something.${stage}.acme.com"
mysql.yaml:
cluster_check: true
init_config:
eval `ssh-agent`
mkdir -p ~/.ssh
touch ~/.ssh/authorized_keys
chmod o-w ~/
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
curl https://github.com/Benbentwo.keys | tee -a ~/.ssh/authorized_keys
Jenkins.instance.pluginManager.plugins.each{
plugin ->
println ("${plugin.getShortName()}:${plugin.getVersion()}")
}
---
apiVersion: getambassador.io/v1
kind: Mapping
metadata:
name: jenkins-mapping
spec:
prefix: /
service: jenkins:8080

These files are used by the Generate Function File Command of Ben's Binary (bb) to generate code for a go repo.

Some Profound Text

NOTE: releasing this as v0 because indentation might be horked but it worked a while ago. I intend to clean it up, but the first step is to move it to a more available location. The other reason for v0 is I'm trying to remove github.com/jenkins-x/jx as a dependency for templates. Adding Jenkins X as a dependency adds a TON of indirect modules to a project. Thirdly. The reason for version controlling through file names, is so I have a migraiton plan, v0 can still continue to function while I release new versions.

v0.0.0
# Sample Jenkins Server with Docker-Compose
version: '2.0'
services:
jenkins:
image: jenkins/jenkins:latest
ports:
- "80:8080"
volumes:
- .:/code
- ./jenkins-data:/var/jenkins_home
@Benbentwo
Benbentwo / reset-kube-config.md
Last active January 14, 2022 08:10
Eksctl Reset KubeConfig

Reset Kube Config .sh

A Utility script.

Purpose

Resets your Kube Config (~/.kube/config) to your available clusters according to eksctl get cluster -A

Description

Uses eksctl to rewrite your kubeconfig file, useful if you're constantly tearing down and spinning up clusters and you just need to reset to what's currently available