Skip to content

Instantly share code, notes, and snippets.

View jsoref's full-sized avatar
📕
Saving the word one project at at a time...

Josh Soref jsoref

📕
Saving the word one project at at a time...
View GitHub Profile
@jsoref
jsoref / gist:d71accaed6aacdd1567eb626cbeb6a73
Last active January 12, 2024 01:52
Working with evil repositories

Premise

  • check-spelling should be able to work with anything.

  • macOS has some file system character constraints that have proven to be a bit problematic.

Use Docker (or an equivalent) to run Alpine Linux

Set up an alpine environment

docker run -it alpine

@jsoref
jsoref / gh_collect_repo_workflow_logs.sh
Created December 19, 2023 22:40
Get github repository workflow run logs
gh_collect_repo_workflow_logs() {
OWNER="$1"
REPO="$2"
for workflow_run in $(gh api "/repos/$OWNER/$REPO/actions/runs" |jq -r -M '.workflow_runs[].id'); do
for job in $(
gh api "/repos/$OWNER/$REPO/actions/runs/$workflow_run/jobs" | jq '.jobs[].id'
); do
gh run view -R "$OWNER/$REPO" --log -j $job > "$workflow_run.$job.log"
done
done
@jsoref
jsoref / wait-for-tcp-port.sh
Created September 2, 2022 22:28
A simplistic way to ensure that a certain tcp host:port is available so that a service can depend on it
#!/bin/sh
#/usr/local/bin/wait-for-tcp-port.sh
instance="$1"
host="${instance%%:*}"
port="${instance##*:}"
start=10
loop=$start
while true
do
nc -zvw3 "$host" "$port" 2>/dev/null >/dev/null
@jsoref
jsoref / zfs-sync-to-remote.sh
Created August 30, 2022 23:25
Sync a bunch of zfs volumes to a remote (designed to be called from a cron-like system)
#!/bin/bash
##
# https://gist.githubusercontent.com/ertug/1087896/raw/0ff791dce616993f8557bf74e1f47cebb4b69aae/zfs-snapshot.sh
# original code: http://andyleonard.com/2010/04/07/automatic-zfs-snapshot-rotation-on-freebsd/
# 07/17/2011 - ertug: made it compatible with zfs-fuse which doesn't have .zfs directories
##
# Path to ZFS executable:
ZFS=/sbin/zfs
#!/bin/sh
api_sources=$(mktemp)
echo localhost:8001/api/v1 >> $api_sources
extra_apis=$(mktemp)
export api_prefix=localhost:8001/apis/
curl -sq $api_prefix > $extra_apis
jq -r '.groups[].preferredVersion.groupVersion' $extra_apis | perl -pne 's{^}{$ENV{api_prefix}}' >> $api_sources
apis=$(mktemp)
(
for api in $(cat $api_sources); do
@jsoref
jsoref / neo4j.backup.log
Created December 29, 2021 21:10
neo4j backup failed FileLockException - This file is locked by another process, please ensure you don't have another Neo4j process or tool using it: '/backups/graph-db.backup/neostore'.
2021-12-25 14:22:46.911+0000 INFO [o.n.b.i.BackupOutputMonitor] Start receiving store files
2021-12-25 14:22:46.914+0000 INFO [o.n.b.i.BackupOutputMonitor] Start receiving store file /backups/graph-db.backup/neostore.nodestore.db.labels
2021-12-25 14:22:46.923+0000 INFO [o.n.b.i.BackupOutputMonitor] Finish receiving store file /backups/graph-db.backup/neostore.nodestore.db.labels
2021-12-25 14:22:46.924+0000 INFO [o.n.b.i.BackupOutputMonitor] Start receiving store file /backups/graph-db.backup/neostore.nodestore.db
2021-12-25 14:22:47.718+0000 INFO [o.n.b.i.BackupOutputMonitor] Finish receiving store file /backups/graph-db.backup/neostore.nodestore.db
2021-12-25 14:22:47.718+0000 INFO [o.n.b.i.BackupOutputMonitor] Start receiving store file /backups/graph-db.backup/neostore.propertystore.db.index.keys
2021-12-25 14:22:47.725+0000 INFO [o.n.b.i.BackupOutputMonitor] Finish receiving store file /backups/graph-db.backup/neostore.propertystore.db.index.keys
2021-12-25 14:22:47.725+0000 INFO [o.n.b.i.BackupOutputMo
@jsoref
jsoref / gist:6115a4ce35488ecc6797ec3cb79563b4
Created October 12, 2020 02:49
knative reconciler `determin`
knative/networking/vendor/knative.dev/pkg/codegen/cmd/injection-gen/generators/reconciler_reconciler.go: // string into a distinct namespace and name, determine if this instance of
knative/networking/pkg/client/injection/reconciler/networking/v1alpha1/certificate/reconciler.go: // string into a distinct namespace and name, determine if this instance of
knative/networking/pkg/client/injection/reconciler/networking/v1alpha1/ingress/reconciler.go: // string into a distinct namespace and name, determine if this instance of
knative/networking/pkg/client/injection/reconciler/networking/v1alpha1/domain/reconciler.go: // string into a distinct namespace and name, determine if this instance of
knative/networking/pkg/client/injection/reconciler/networking/v1alpha1/serverlessservice/reconciler.go: // string into a distinct namespace and name, determine if this instance of
knative/networking/pkg/client/injection/reconciler/networking/v1alpha1/realm/reconciler.go: // string into a distinct namespace
$ TF_LOG=trace ./terraform apply
2020/08/19 18:30:12 [INFO] Terraform version: 0.13.0
2020/08/19 18:30:12 [INFO] Go runtime version: go1.14.2
2020/08/19 18:30:12 [INFO] CLI args: []string{"/home/jsoref/pristine-bay-286722/terraform", "apply"}
2020/08/19 18:30:12 [DEBUG] Attempting to open CLI config file: /home/jsoref/.terraformrc
2020/08/19 18:30:12 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2020/08/19 18:30:12 [DEBUG] ignoring non-existing provider search directory terraform.d/plugins
2020/08/19 18:30:12 [DEBUG] ignoring non-existing provider search directory /home/jsoref/.terraform.d/plugins
2020/08/19 18:30:12 [DEBUG] ignoring non-existing provider search directory /home/jsoref/.local/share/terraform/plugins
2020/08/19 18:30:12 [DEBUG] ignoring non-existing provider search directory /usr/local/share/terraform/plugins
2020/08/18 18:17:16 [INFO] Terraform version: 0.13.0
2020/08/18 18:17:16 [INFO] Go runtime version: go1.14.2
2020/08/18 18:17:16 [INFO] CLI args: []string{"./terraform", "plan"}
2020/08/18 18:17:16 [DEBUG] Attempting to open CLI config file: /home/jsoref/.terraformrc
2020/08/18 18:17:16 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2020/08/18 18:17:16 [DEBUG] ignoring non-existing provider search directory terraform.d/plugins
2020/08/18 18:17:16 [DEBUG] ignoring non-existing provider search directory /home/jsoref/.terraform.d/plugins
2020/08/18 18:17:16 [DEBUG] ignoring non-existing provider search directory /home/jsoref/.local/share/terraform/plugins
2020/08/18 18:17:16 [DEBUG] ignoring non-existing provider search directory /usr/local/share/terraform/plugins
2020/08/18 18:17:16 [DEBUG] ignoring non-existing provider search directory /usr/share/terraform/plugins
$ terraform apply
2020/08/17 18:45:08 [WARN] Log levels other than TRACE are currently unreliable, and are supported only for backward compatibility.
Use TF_LOG=TRACE to see Terraform's internal logs.
----
2020/08/17 18:45:08 [INFO] Terraform version: 0.13.0
2020/08/17 18:45:08 [INFO] Go runtime version: go1.14.2
2020/08/17 18:45:08 [INFO] CLI args: []string{"/home/jsoref/pristine-bay-286722/terraform", "apply"}
2020/08/17 18:45:08 [DEBUG] Attempting to open CLI config file: /home/jsoref/.terraformrc
2020/08/17 18:45:08 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2020/08/17 18:45:08 [DEBUG] ignoring non-existing provider search directory terraform.d/plugins