Skip to content

Instantly share code, notes, and snippets.

View willthames's full-sized avatar

Will Thames willthames

View GitHub Profile
@willthames
willthames / cmd.go
Created December 27, 2023 23:22
go error handling
package main
import (
"log"
"os/exec"
)
func main() {
cmd := exec.Command("./error.sh")
log.Printf("Running command and waiting for it to finish...")
This file has been truncated, but you can view the full file.
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.
module.namespaces.data.kustomization_overlay.resources: Refreshing state... [id=04fe1fc8132cacb1fe0387a48eca3fb97fe042e513d7805f107010dab1882954de1cf09e6b8fb951b499ecb528eaf4ea00eeaac8d01e65f2882838d696586617]
module.fluent-bit.data.kustomization_overlay.resources: Refreshing state... [id=705f1670e47adc7ce91c7d5672071f012cfa50b71c43e8781f3666a45e39b877ff0b522da60a75df74b2a6e0961d45dd613bf4327f57ea44e80e17193508ee5b]
module.docker-debug.data.kustomization_overlay.resources: Refreshing state... [id=49db24f0d9fe7e6f874673f13417193e706e25e3167204dbb6e5f48b773aeb4cd102d98751f8732c1483b96a8ac5aae4241a7d693facf6581666ac84d3686a51]
module.grafana.data.kustomization_overlay.resources: Refreshing state... [id=4d279fa435fb729023300280e0ee830f8ce80bedfc1288de2f028311f287e5eaec3763fbfe56d76acc6db63f4514481e927a70226aec2524458e5fff6bd2a415]
module.extern
@willthames
willthames / consuming it
Created August 12, 2021 14:18
trying out buildah
docker create --name datactr -v /data willthames/buildah-test:v0.1 true
docker run -it --name alpine --volumes-from datactr alpine ls /data
@willthames
willthames / god.py
Created September 22, 2020 01:14
Mathematics Calendar 2020/09/20
from __future__ import print_function
import math
god_list = [1]
def odd_divisor_detector(num):
while num > 1:
if num % 2 != 0:
return num
log_by_lua_block {
local tokenize = require('tokenize')
ngx.var.tokenized_uri = tokenize.tokenize(ngx.var.uri)
}
opentracing_operation_name "$request_method $tokenized_uri";
local tokenize = {}
function tokenize.tokenize(uri)
-- URLs that end in an ID
for _, path in ipairs({“/api/jobs, “/api/resources”}) do
if string.find(uri, path .. "/[^/]*") then
return string.gsub(uri, path .. "/.*", path .. "/{id}")
end
end
return uri
local tokenize = {}
function tokenize.tokenize(uri)
-- URLs that end in an ID
for _, path in ipairs({“/api/jobs, “/api/resources”}) do
if string.find(uri, path .. "/[^/]*") then
return string.gsub(uri, path .. "/.*", path .. "/{id}")
end
end
return uri
@willthames
willthames / manifest.yml
Created September 26, 2019 05:20
typical kubernetes deployment
kind: Deployment
apiVersion: apps/v1
metadata:
labels:
{{ kube_deployment_labels | to_nice_yaml(indent=2) | indent(4) }}
name: {{ kube_resource_name }}
namespace: {{ kube_resource_namespace }}
spec:
revisionHistoryLimit: 3
replicas: {{ kube_deployment_replicas }}
apiVersion: v1
kind: ConfigMap
metadata:
name: test-rules
namespace: monitoring
data:
node.rules.yml: |-
{{ lookup('template', 'template.j2')|indent(4) }}
#!/bin/bash
set -eu
if [ $# -lt 2 ] ; then
echo "Usage: $0 [--profile profile] [--region region] [--key key] [--filter filterkey] user host [port]"
exit
fi
while true; do