Skip to content

Instantly share code, notes, and snippets.

# michael.godfrey@digitalasset.com
# Apache 2.0 License
import time, math, random
from json import encoder
chars,x,y,_x,_y,idx,_i,theta,W,H = 'ABCDEF', 0,0,0,0,0,0,0,63,63
loop, LINE_UP, LINE_CLEAR = range(1, len(chars) + 1), '\033[1A', '\x1b[2K'
grid = [[(0,-1) for y in range(H)] for x in range(W)]
def rotate(x,y,theta):
_cos, _sin, rx, ry = math.cos(math.radians(theta)), math.sin(math.radians(theta)), 0.5*W - x - 0.5, 0.5*W - y - 0.5
@mgodf89
mgodf89 / Dockerfile.ssmtp
Created October 27, 2023 17:17
A Dockerfile for sending gmail messages from the command line!
FROM ubuntu:latest
# NOTE: Don't use your real password. Get an App Password from here:
# https://myaccount.google.com/apppasswords
# To Build:
# `docker build --build-arg email=<GMAIL_ADDRESS> --build-arg password=<GMAIL_PASSWORD> -t ssmtp .`
# To Run:
# `docker run -e MSG="Some Message" -e TO_EMAIL="recipient@example.com" ssmtp:latest`
# Command to start HAProxy:
# haproxy -f /usr/local/etc/haproxy/participant_haproxy.cfg >> log/haproxy.log 2>&1
# Note: Ensure monitoring.health.server is defined in either participant config!
global
log stdout format raw local0
defaults
log global

jq Cheatsheet

This is as much as I needed to know for the Certified Kubernetes Administrator (CKA) exam, no more, no less.

Sections

  • A. Skill List
  • B. Example Query
  • C. Output/Result
  • D. Appendix: data.json

A. Skill List

@mgodf89
mgodf89 / TypeExample.daml
Last active April 10, 2024 20:47
Contract Developer Course 1: Advanced Fundamentals | Functional Programming - 2
-- Contract Developer Course 1: Advanced Fundamentals | Functional Programming - 2
-- https://www.youtube.com/watch?v=WkIiH3IBo8U
module TypeExample where
import Daml.Script
data PersonnelType = Active | Inactive
deriving (Eq, Show)
FLAGFILE="/provisioning"
if [ -e "$FLAGFILE" ]; then
echo "The script has already run once. Exiting."
exit 0
else
useradd -s /bin/bash -d /home/kubeadmin/ -m -G sudo kubeadmin
apiVersion: v1
kind: PersistentVolume
metadata:
name: cometbft-init-pv
namespace: sv
spec:
capacity:
storage: 5Gi
accessModes:
- ReadWriteMany
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: sc-pg-participant-rwo
namespace: sv
provisioner: kubernetes.io/no-provisioner
reclaimPolicy: Delete
volumeBindingMode: Immediate
---
#! /bin/bash
cat << EOF >> local_values/postgres-values-participant.yaml
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/hostname
operator: In