Skip to content

Instantly share code, notes, and snippets.

View jbayer's full-sized avatar

James Bayer jbayer

View GitHub Profile
@jbayer
jbayer / one-switch-one-vm.tf
Created June 20, 2025 19:25
Example Hyper-V with Terraform
terraform {
required_providers {
hyperv = {
version = "1.0.3"
source = "registry.terraform.io/taliesins/hyperv"
}
}
}
provider "hyperv" {
@jbayer
jbayer / read-jwt.sh
Created May 19, 2025 15:20
Read Base64 encoded JWT
#!/bin/bash
# Split the JWT into parts (header.payload.signature)
# TOKEN="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvbiBEb2UiLCJpYXQiOjE1MTYyMzkwMjJ9.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
# Name of the required environment variable
REQUIRED_VAR="TOKEN"
# Check if the variable is not set or empty
if [[ -z "${!REQUIRED_VAR}" ]]; then
@jbayer
jbayer / example.txt
Last active March 9, 2025 17:25
Using yt-dlp to create a short clip
jamesbayer@mac ~ % mkdir /tmp/clip
jamesbayer@mac ~ % cd /tmp/clip
jamesbayer@mac clip % touch put-the-clip-in-this-dir
jamesbayer@mac clip % ls
put-the-clip-in-this-dir
jamesbayer@mac clip % docker run -it -v /tmp/clip:/tmp/clip --entrypoint /bin/sh jauderho/yt-dlp:latest
/downloads # cd /tmp/clip
/tmp/clip # ls
put-the-clip-in-this-dir
/tmp/clip # /usr/local/bin/yt-dlp --download-sections "*1:57-5:50" -f bestvideo+bestaudio --merge-output-format mp4 -o two-hands.mp4 https://www.youtube.com/watch?v=MR8F8GbOcwc
@jbayer
jbayer / v1.17.json
Created September 26, 2024 00:31
Activity Export API response improvements
{
"client_id": "3f210722-7210-98e8-1f0d-e6a39ffb29c6",
"namespace_id": "root",
"timestamp": 1653350457,
"mount_accessor": "auth_userpass_bb52979d"
}
@jbayer
jbayer / nslookup.txt
Created July 11, 2022 18:20
HCP Vault DNS Example
nslookup your-cluster-name-here.vault.your-project-id-here.aws.hashicorp.cloud
Server: 192.168.86.1
Address: 192.168.86.1#53
Non-authoritative answer:
Name: your-cluster-name-here.vault.your-project-id-here.aws.hashicorp.cloud
Address: 34.215.184.84
Name: your-cluster-name-here.vault.your-project-id-here.aws.hashicorp.cloud
Address: 54.185.0.185
Name: your-cluster-name-here.vault.your-project-id-here.aws.hashicorp.cloud

Keybase proof

I hereby claim:

  • I am jbayer on github.
  • I am jambay (https://keybase.io/jambay) on keybase.
  • I have a public key ASBNEqvKihkY657SPA0MAd-d9y6lUrXSkVw-i8_Zv2iAIQo

To claim this, I am signing this object:

@jbayer
jbayer / waypoint-k8s-do.yml
Created November 1, 2020 19:06
Waypoint 0.1.4 k8s yaml for Digital Ocean
---
apiVersion: v1
kind: Service
metadata:
name: waypoint
namespace: default
spec:
ports:
- port: 9701
@jbayer
jbayer / cf-cli-output.txt
Created August 10, 2016 14:51
cf push error when omitting app name
$ cf push -m 64M
FAILED
Manifest file is not found in the current directory, please provide either an app name or manifest
NAME:
push - Push a new app or sync changes to an existing app
USAGE:
Push a single app (with or without a manifest):
cf push APP_NAME [-b BUILDPACK_NAME] [-c COMMAND] [-d DOMAIN] [-f MANIFEST_PATH] [--docker-image DOCKER_IMAGE]
@jbayer
jbayer / gist:d0d54d82561edf66aa1c
Created December 14, 2015 06:19
cf docker support using docker image root user
$ cf push ubuntu -o library/ubuntu -u none -c "nc -l 8080"
Creating app ubuntu in org local.micropcf.io-org / space dev as admin...
OK
Creating route ubuntu.local.micropcf.io...
OK
Binding ubuntu.local.micropcf.io to ubuntu...
OK
@jbayer
jbayer / gist:24e68996706975757698
Created June 28, 2015 20:32
pivotal network file download example
#!/bin/bash
export PIVNET_TOKEN=PASTE_THIS_FROM_PIVNET_USER_PROFILE
export LOCAL_FILE_NAME=stack_announcement.pdf
export DOWNLOAD_URL=https://network.pivotal.io/api/v2/products/pivotal-cf/releases/267/product_files/1804/download
wget -O "$LOCAL_FILE_NAME" --post-data="" --header="Authorization: Token $PIVNET_TOKEN" $DOWNLOAD_URL