Skip to content

Instantly share code, notes, and snippets.

View daxmc99's full-sized avatar

Dax McDonald daxmc99

View GitHub Profile
@daxmc99
daxmc99 / get-secret-access-roles.sh
Created November 8, 2024 03:55
one liner to list all roles & clusterroles that have secret access
kubectl get roles,clusterroles -o json | jq -c '
.items[]
| select(.rules != null) # Exclude entries with null rules
| select(.rules[].resources[] == "secrets") # Only resources with "secrets" access
| {name: .metadata.name, kind: .kind, namespace: .metadata.namespace, verbs: (.rules[].verbs | unique)}' \
| jq -s 'unique_by(.name, .kind, .namespace)' # Deduplicate based on name, kind, and namespace
@daxmc99
daxmc99 / setReviewers.sh
Created November 5, 2024 20:10
Add all eligible reviewers to Gitlab MR
#!/usr/bin/env bash
set -e
# Ensure required tools are installed
if ! command -v glab &> /dev/null; then
echo "Error: glab CLI is not installed. Please install it before running this script."
exit 1
fi
if ! command -v jq &> /dev/null; then
@daxmc99
daxmc99 / normcore-llm.md
Created January 11, 2024 22:29 — forked from veekaybee/normcore-llm.md
Normcore LLM Reads

Anti-hype LLM reading list

Goals: Add links that are reasonable and good explanations of how stuff works. No hype and no vendor content if possible. Practical first-hand accounts of models in prod eagerly sought.

Foundational Concepts

Screenshot 2023-12-18 at 10 40 27 PM

Pre-Transformer Models

@daxmc99
daxmc99 / cpu-hungry.yaml
Created December 6, 2022 00:07
Kubernetes test pods for restarting and cpu use
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
labels:
run: cpu-hungry
name: cpu-hungry
spec:
containers:
- image: ubuntu
@daxmc99
daxmc99 / create-revision.sh
Last active August 26, 2021 21:57
Create a number of perforce text files and add them each as a changelist
#!/usr/bin/env bash
set -Eeu
set -x
# You need to use a session ticket (https://about.sourcegraph.com/handbook/support/p4-enablement#generate-a-session-ticket)
# in order to avoid password prompts
# TO edit this file, you must run `p4 edit create-revision.sh` first
@daxmc99
daxmc99 / shellscript.jsonc
Last active August 6, 2021 22:49
VSCode Snippet
{
// Place your snippets for shellscript here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
// "Print to console": {
// "prefix": "log",
// "body": [
// "console.log('$1');",
@daxmc99
daxmc99 / cloud_sql_read_only.sql
Last active October 16, 2024 18:52
Make a user read-only after its created via the Google api (ie via Terraform)
-- CREATE read-only user when the user was created via the Google Cloud API (ie terraform)
-- GOOGLE CLOUD by default give fairly broad permissions
-- Prior reading https://stackoverflow.com/questions/13497352/error-permission-denied-for-relation-tablename-on-postgres-while-trying-a-selec
-- https://www.digitalocean.com/docs/databases/postgresql/how-to/modify-user-privileges/
REVOKE ALL ON DATABASE db FROM "dev-readonly";
-- This next line is important
REVOKE cloudsqlsuperuser FROM "dev-readonly";
GRANT USAGE ON SCHEMA public TO "dev-readonly";
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO "dev-readonly";
@daxmc99
daxmc99 / .gitconfig
Created May 6, 2020 16:05 — forked from johnpolacek/.gitconfig
My current .gitconfig aliases
[alias]
co = checkout
cob = checkout -b
coo = !git fetch && git checkout
br = branch
brd = branch -d
brD = branch -D
merged = branch --merged
st = status
aa = add -A .
@daxmc99
daxmc99 / wsl.md
Last active May 29, 2020 22:05
Setting up WSL2 for dev

Due to some issues with shipping at the moment my Macbook is delayed in getting to me and I will using Windows as my dev machine. These are the steps I took to set it up

Enable WSL 2 (basically required for good performance in most dev work)

Decide between Scoop & Chocolately

Install Ubuntu 20.04

Enable VS Code remote work

@daxmc99
daxmc99 / tmux-cheatsheet.markdown
Created March 26, 2020 17:42 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname