Skip to content

Instantly share code, notes, and snippets.

View georgettica's full-sized avatar

Ron Green georgettica

View GitHub Profile
@georgettica
georgettica / parse-html-table.mjs
Last active December 5, 2021 15:37
read data from an html webpage that displays a directory index without using grep/sed/awk to parse the data
// Run this by copying to your machine, changing the URL variable and running using `node parse-html-table.mjs`
import fetch from 'node-fetch';
import parse from 'parse-apache-directory-index';
const URL = ''
fetch(URL)
.then(response => response.text())
.then(text => console.log(parse(text)))
@georgettica
georgettica / get-pods-from-deployment.sh
Last active November 17, 2021 16:11
recieve the pods from a deployment (useful for commands that need the pod names)
#!/bin/bash
set -eEuo pipefail
ns= # deployment namespace
name= # deployment name
# shellcheck disable=SC2016
deploy_pod_labels_raw=$(kubectl get --namespace "${ns}" deployments.apps/"${name}" --output go-template='{{ range $k, $v :=.spec.selector.matchLabels }}{{$k}}={{$v}},{{ end }}')