Skip to content

Instantly share code, notes, and snippets.

@jazzdan
jazzdan / install-extension.sh
Created June 3, 2024 18:38
Installing a Chrome extension in the Replay Browser
#!/bin/bash
url="https://chromewebstore.google.com/detail/magical-ai-writer-autofil/iibninhmiggehlcdolcilmhacighjamp"
id=$(echo "$url" | sed -n 's/.*\/\([a-z]\{32\}\)$/\1/p')
if [ -z "$id" ]; then
echo "Invalid Chrome Web Store URL."
exit 1
fi
@jazzdan
jazzdan / BUCK
Created May 27, 2024 18:51
buck2 tar rules
# prelude-replay/tar/BUCK
export_file(
name="tar_file.py",
visibility=["PUBLIC"],
)
@jazzdan
jazzdan / BUCK
Last active February 13, 2024 03:56
Buck2 OCI rules sketch
# Root BUCK file
http_archive(
name="dive",
urls=["https://github.com/wagoodman/dive/releases/download/v0.12.0/dive_0.12.0_linux_arm64.tar.gz"],
sha256="a2a1470302cdfa367a48f80b67bbf11c0cd8039af9211e39515bd2bbbda58fea",
strip_prefix='dive',
sub_targets=["dive"],
)
@jazzdan
jazzdan / custom_checkvalue.py
Last active April 28, 2022 17:59
Datadog custom agent check to get the number of processes on a linux machine
from checks import AgentCheck
from datadog_checks.base.utils.subprocess_output import get_subprocess_output
# Get number of processes from `vmstat`
class NumProcessesCheck(AgentCheck):
def check(self, instance):
out, err, retcode = get_subprocess_output(['vmstat', '1', '2'], self.log, raise_on_empty_output=True)
lines = out.strip().split("\n")
last_line = lines[-1]
words = list(filter(None, last_line.split(" ")))
@jazzdan
jazzdan / Tiltfile
Created July 30, 2020 19:53
Tiltfile for kubebuilder
load('ext://restart_process', 'docker_build_with_restart')
IMG = 'controller:latest'
### FILL OUT THESE FIELDS
NAME = '' # name of Go module
DOMAIN = '' # domain for CRD
GROUP = '' # group for CRD
VERSION = '' # version for CRD
KIND = '' # kind for CRD
@jazzdan
jazzdan / Tiltfile
Created July 26, 2019 16:22 — forked from chuckha/Tiltfile
tilt file for github.com/kubernetes-sigs/cluster-api-provider-docker
project = str(local('gcloud config get-value project')).strip()
read_file(str(local('which capdctl')).rstrip('\n'))
k8s_yaml(local('capdctl platform -capi-image gcr.io/kubernetes1-226021/cluster-api-controller-amd64:dev -bp-image gcr.io/kubernetes1-226021/cluster-api-bootstrap-provider-kubeadm:dev -bp-ref master'))
custom_build(
'gcr.io/' + project +'/manager',
'GOOS=linux go build ./cmd/manager && docker build -t $EXPECTED_REF .',
['.'],
ignore='manager',
@jazzdan
jazzdan / .tilt.json
Created March 15, 2019 23:40
Tiltfile that checks kube context against safe list
{
"allowed_context": "minikube"
}
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
annotations:
kompose.cmd: kompose convert
kompose.version: 1.17.0 (HEAD)
creationTimestamp: null
labels:
io.kompose.service: clair
name: clair
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
annotations:
kompose.cmd: kompose convert
kompose.version: 1.17.0 (HEAD)
creationTimestamp: null
labels:
io.kompose.service: clair
name: clair