Skip to content

Instantly share code, notes, and snippets.

View mcncl's full-sized avatar
🐊

mcncl mcncl

🐊
View GitHub Profile

Keybase proof

I hereby claim:

  • I am mcncl on github.
  • I am benmc (https://keybase.io/benmc) on keybase.
  • I have a public key ASAwxyU19je8fBDtN2dEjVjUc5CPdzr0YPENXFp9nPujLAo

To claim this, I am signing this object:

@mcncl
mcncl / main.go
Created October 11, 2019 23:29
Golang Pointer Example
package main
import "fmt"
type house struct {
occupant string
}
func (houseLocation *house) changeTenant(newTenant string) {
(*houseLocation).occupant = newTenant
@mcncl
mcncl / pipe
Created October 4, 2022 04:44
Hooks
#!/bin/bash
set -euo pipefile
echo Hello
@mcncl
mcncl / cancel_all_running_builds.sh
Created March 27, 2024 00:13
Cancel all running Buildkite builds
#!/bin/bash
# Make API call to retrieve initial objects and extract URLs
urls=($(http -I -A bearer --auth "$TOKEN" GET "https://api.buildkite.com/v2/organizations/ORG/builds?state=running" | jq -r '.[] | .url'))
# Loop through URLs, append /cancel, and make API calls
for url in "${urls[@]}"; do
cancel_url="${url}/cancel"
echo "Making API call to cancel: $cancel_url"
@mcncl
mcncl / get_latest.sh
Last active May 28, 2024 00:34
Get download URLs of artifacts from a pipeline's latest Buildkite build
#!/bin/sh
ORG="test"
PIPELINE="testing"
URL="https://api.buildkite.com/v2/organizations/$ORG/pipelines/$PIPELINE/builds/"
# Parse the response using jq to extract the "number" field from the first element
LATEST_BUILD_NUMBER=$(http -A bearer --auth "$TOKEN" GET "$URL" | jq -r '.[0] | .number')