Skip to content

Instantly share code, notes, and snippets.

View samos123's full-sized avatar
🎯
Focusing

Sam Stoelinga samos123

🎯
Focusing
View GitHub Profile
#!/usr/bin/env bash
# source a SO question I forgot to capture link of
ffmpeg -y -i $1 \
-filter_complex "fps=5,scale=980:-1:flags=lanczos,split[s0][s1];[s0]palettegen=max_colors=32[p];[s1][p]paletteuse=dither=bayer" \
$2
{
"classes": [
{
"class": "Instrument",
"description": "A musical instrument.",
"vectorIndexType": "hnsw",
"vectorizer": "text2vec-transformers",
"properties": [
{
"name": "name",
@samos123
samos123 / gist:d6cfd92bd5d0db1c60cdd5b9eb7ae607
Created August 15, 2023 05:51
create-k8s-client-in-or-out-ofcluster.go
func CreateKubernetesClient() (*kubernetes.Clientset, error) {
// Try in-cluster config
config, err := rest.InClusterConfig()
if err != nil {
// If there's an error, it means we're not in-cluster, try out-of-cluster config
kubeconfig := os.Getenv("KUBECONFIG") // Path to a kubeconfig. Only required if out-of-cluster
if kubeconfig == "" {
kubeconfig = os.Getenv("HOME") + "/.kube/config"
}
#!/usr/bin/env bash
set -x
REGION=$1
ZONE=$REGION-a
gcloud compute routers create router-$REGION --network=default --region=$REGION
gcloud compute routers nats create nat-$REGION \
#!/bin/bash
set -x
export MAIN_CLUSTER_CTX=main-1
export MAIN_CLUSTER_NAME=main-1
export REMOTE_CLUSTER_CTX=remote-2
export REMOTE_CLUSTER_NAME=remote-2
export MAIN_CLUSTER_NETWORK=network1
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: customizations
labels:
app: customizations
spec:
selector:
matchLabels:
app: customizations
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: iperf3-server
spec:
replicas: 1
revisionHistoryLimit: 10
selector:
matchLabels:
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: iperf3-server
spec:
replicas: 1
revisionHistoryLimit: 10
selector:
matchLabels:
@samos123
samos123 / kubelet-stat.json
Created November 26, 2019 00:46
You can get these stats by doing curl localhost:10255/stats/summary on a gke node
{
"node": {
"nodeName": "gke-standard-cluster-1-default-pool-8fd0527d-sv9q",
"systemContainers": [
{
"name": "runtime",
"startTime": "2019-11-26T00:38:22Z",
"cpu": {
"time": "2019-11-26T00:45:50Z",
"usageNanoCores": 28894845,
function prune_old_rows() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheetByName('Form Submissions');
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
var values = rows.getValues();
// assumes that there is a column "Added" as the first column