Skip to content

Instantly share code, notes, and snippets.

View pbnj's full-sized avatar
🖖
"May the Force ever be in your favor, Harry" -Gandalf

Peter Benjamin pbnj

🖖
"May the Force ever be in your favor, Harry" -Gandalf
View GitHub Profile
@pbnj
pbnj / crate-health.md
Created December 19, 2022 21:13 — forked from repi/crate-health.md
Guidelines on evaluating health & quality of third-party crates at Embark

note: I wrote this for our internal documentation & guidelines at Embark so not all of it is likely relevant for other companies, but sharing here as others expressed interest in seeing it


What to evaluate and consider before adding usage of new third-party crates.

These are not exact requirements but questions to investigate and discuss to help reason around the health, safety, maintainability, and more around crates.

This can also be read as an opinionated guide for crate authors of what our (Embark's) guidelines and recommendations are, though should not be taken too literally.

@pbnj
pbnj / Makefile
Created December 6, 2022 20:36 — forked from SteveByerly/Makefile
Makefile for managing a Terraform project
MAKEFLAGS += --warn-undefined-variables
SHELL := bash
.SHELLFLAGS := -eu -o pipefail -c
.DEFAULT_GOAL := help
.SUFFIXES:
# ---------------------------------------------------------
# Local Variables
# ---------------------------------------------------------
@pbnj
pbnj / qfsign.vim
Last active December 5, 2022 21:52 — forked from BoltsJ/qfsign.vim
Automatically place signs based on the quickfix/location list.
if exists('g:loaded_qfsigns')
finish
endif
let g:loaded_qfsigns=1
sign define QFErr texthl=QFErrMarker text=E
sign define QFWarn texthl=QFWarnMarker text=W
sign define QFInfo texthl=QFInfoMarker text=I
augroup qfsigns
@pbnj
pbnj / login-csrf.sh
Created July 29, 2021 16:42 — forked from whiteinge/login-csrf.sh
Wrapper to fetch CSRF token and authenticate via the login page
#!/usr/bin/env sh
# Wrapper to fetch CSRF token and authenticate via the login page
url='http://localhost:3002'
login="${url}/sign_in"
curl -sS -c cookies.txt "$login" |
htmlstar sel -t -v "//_:input[@name='csrf_token']/@value" -o '
' | xargs -I{} curl -sS -c cookies.txt -b cookies.txt "$login" \
--data-urlencode 'user[email]=me@example.com' \
# Source: https://gist.github.com/6fb3e7da327df9203d9d4c184fcb5831
##############################################################################
# Combining Argo CD (GitOps), Crossplane (Control Plane), And Kubevela (OAM) #
# https://youtu.be/eEcgn_gU3SM #
##############################################################################
# Referenced videos:
# - Argo CD - Applying GitOps Principles To Manage Production Environment In Kubernetes: https://youtu.be/vpWQeoaiRM4
# - Cloud-Native Apps With Open Application Model (OAM) And KubeVela: https://youtu.be/2CBu6sOTtwk
@pbnj
pbnj / macos-tmux-256color.md
Created March 25, 2021 07:13 — forked from bbqtd/macos-tmux-256color.md
Installing tmux-256color for macOS

Installing tmux-256color for macOS

  • macOS 10.15.5
  • tmux 3.1b

macOS has ncurses version 5.7 which does not ship the terminfo description for tmux. There're two ways that can help you to solve this problem.

The Fast Blazing Solution

Instead of tmux-256color, use screen-256color which comes with system. Place this command into ~/.tmux.conf or ~/.config/tmux/tmux.conf(for version 3.1 and later):

/* https://github.com/ryanoasis/nerd-fonts/blob/master/patched-fonts/JetBrainsMono/Regular/complete/JetBrains%20Mono%20Regular%20Nerd%20Font%20Complete.ttf */
@font-face {
font-family: 'JetBrainsMono Patched';
src: local('JetBrainsMono Patched'), url('https://rawgit.com/ryanoasis/nerd-fonts/master/patched-fonts/JetBrainsMono/Regular/complete/JetBrains%20Mono%20Regular%20Nerd%20Font%20Complete.ttf') format('truetype');
}
@pbnj
pbnj / CVE-2019-11253-poc.sh
Created June 19, 2020 17:27 — forked from bgeesaman/CVE-2019-11253-poc.sh
CVE-2019-11253 Kubernetes API Server YAML Parsing Remote Denial of Service PoC aka "Billion Laughs"
#!/usr/bin/env bash
# CVE-2019-11253
# https://github.com/kubernetes/kubernetes/issues/83253
# Shout out: @raesene for poc collab, @iancoldwater + @mauilion for
# HONKing inspiration and other guidance.
# Description: In Kubernetes 1.13 and below, the default configuration
# is that system:anonymous can request a selfsubjectaccessreview
# via mechanisms such as "kubectl auth can-i". This request can
# include POSTed YAML, and just the act of trying to parse it causes
@pbnj
pbnj / Makefile
Created December 23, 2019 20:06 — forked from prwhite/Makefile
Add a help target to a Makefile that will allow all targets to be self documenting
# Add the following 'help' target to your Makefile
# And add help text after each target name starting with '\#\#'
help: ## Show this help.
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//'
# Everything below is an example
target00: ## This message will show up when typing 'make help'
@echo does nothing
@pbnj
pbnj / pandoc.css
Created May 18, 2019 03:49 — forked from killercup/pandoc.css
Add this to your Pandoc HTML documents using `--css pandoc.css` to make them look more awesome. (Tested with Markdown and LaTeX.)
/*
* I add this to html files generated with pandoc.
*/
html {
font-size: 100%;
overflow-y: scroll;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
}