Skip to content

Instantly share code, notes, and snippets.

View benjaminapetersen's full-sized avatar
👾

Ben Petersen benjaminapetersen

👾
View GitHub Profile

Laptop Setup Tips

Moving from an older laptop? Bring these files over.

  • In Safari, "File -> Export -> Bookmarks"
  • Make a copy of ~/.zsh_history
  • Make a copy of github public and private keys from ~/.ssh or wherever you kept them
  • Check your Downloads folder for anything worth keeping

Helpful Brew Casks

@benjaminapetersen
benjaminapetersen / jsonpath.md
Created May 27, 2022 20:05 — forked from navicore/jsonpath.md
for getting multiple fields from kubectl via jsonpath

get name and image and startTime

kubectl get pods -ao jsonpath='{range .items[*]}{@.metadata.name}{" "}{@.spec.containers[*].image}{" "}{@.status.phase}{" "}{@.status.startTime}{"\n"}{end}'| grep track
#!/usr/bin/env bash
VERSION="$1"
VERSION="${VERSION#[vV]}"
VERSION_MAJOR="${VERSION%%\.*}"
VERSION_MINOR="${VERSION#*.}"
VERSION_MINOR="${VERSION_MINOR%.*}"
VERSION_PATCH="${VERSION##*.}"
echo "Version: ${VERSION}"
@benjaminapetersen
benjaminapetersen / trap_focus.js
Created December 17, 2020 22:26 — forked from myogeshchavan97/trap_focus.js
Code for trapping focus inside modal
// add all the elements inside modal which you want to make focusable
const focusableElements =
'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])';
const modal = document.querySelector('#exampleModal'); // select the modal by it's id
const firstFocusableElement = modal.querySelectorAll(focusableElements)[0]; // get first element to be focused inside modal
const focusableContent = modal.querySelectorAll(focusableElements);
const lastFocusableElement = focusableContent[focusableContent.length - 1]; // get last element to be focused inside modal
@benjaminapetersen
benjaminapetersen / 1-setup.md
Created July 21, 2020 20:35 — forked from troyfontaine/1-setup.md
Signing your Git Commits using GPG on MacOS Sierra/High Sierra

Methods of Signing with GPG

There are now two ways to approach this:

  1. Using gpg and generating keys
  2. Using Kryptonite by krypt.co

This Gist explains how to do this using gpg in a step-by-step fashion. Kryptonite is actually wickedly easy to use-but you will still need to follow the instructions

For using a GUI-based GIT tool such as Tower or Github Desktop, follow the steps here for signing with either GPG or Krypt.co.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Content-Security-Policy</title>
<meta name="viewport" content="width=device-width">
<meta http-equiv="Content-Security-Policy"
content="default-src 'self' data: gap: 'unsafe-eval' ws: ;
style-src 'self' 'unsafe-inline';
script-src https: *.example.com ;
@benjaminapetersen
benjaminapetersen / srd_5e_monsters.json
Created November 12, 2019 20:02 — forked from tkfu/srd_5e_monsters.json
A JSON file with all the D&D 5e SRD monster data
[
{
"name": "Aboleth",
"meta": "Large aberration, lawful evil",
"Armor Class": "17 (Natural Armor)",
"Hit Points": "135 (18d10 + 36)",
"Speed": "10 ft., swim 40 ft. ",
"STR": "21",
"STR_mod": "(+5)",
"DEX": "9",
@benjaminapetersen
benjaminapetersen / golang-tls.md
Created November 8, 2019 15:25 — forked from denji/golang-tls.md
Simple Golang HTTPS/TLS Examples

Moved to git repository: https://github.com/denji/golang-tls

Generate private key (.key)
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048

# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)
@benjaminapetersen
benjaminapetersen / generate-ssh-key.sh
Last active October 17, 2019 19:43 — forked from grenade/01-generate-ed25519-ssh-key.sh
Correct file permissions for ssh keys and config.
ssh-keygen -t rsa -b 4096 -N '' -C "<you>@<email.com>" -f ~/.ssh/id_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "<you>@<email.com>" -f ~/.ssh/github_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "<you>@<email.com>" -f ~/.ssh/mozilla_rsa
@benjaminapetersen
benjaminapetersen / local-bridge-installer.md
Created November 8, 2018 20:29 — forked from SamiSousa/local-bridge-installer.md
Launching bridge from 4.0 installer libvirt

Running console on installer via libvirt

The goal of this is to run a local version of console connected to a 4.0 OpenShift cluster created with the installer.

Once you have a running cluster running via libvirt, make sure you've set your environment variable for KUBECONFIG to point to the credentials for your cluster:

export KUBECONFIG=/path/to/installer/auth/kubeconfig