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 / cloudSettings
Last active October 19, 2020 19:24
VSCode Settings Sync
{"lastUpload":"2020-10-19T19:24:30.935Z","extensionVersion":"v3.4.3"}
/* 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 / log
Created May 3, 2020 04:01
sonic-pi: Critical error! Could not boot server
Sonic Pi Boot Error Report
==================
System Information
----------------
* Sonic Pi version: 2.10.0
* OS: Pop!_OS 20.04 LTS
@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 / octant.log
Created August 16, 2019 06:12
octant logs
octant master ↓·4 ✚1 …5 $ OCTANT_LISTENER_ADDR=0.0.0.0:8900 octant -vvv
2019-08-16T06:05:57.259Z DEBUG dash/dash.go:68 Loading configuration: /home/ubuntu/.kube/kind-config-kind
2019-08-16T06:05:57.262Z DEBUG cluster/cluster.go:269 initializing REST client configuration {"client-qps": 200, "client-burst": 400}
2019-08-16T06:05:57.263Z DEBUG cluster/cluster.go:104 created temp directory {"component": "cluster client", "dir": "/tmp/octant626661369"}
2019-08-16T06:05:57.263Z DEBUG dash/dash.go:95 initial namespace for dashboard is default
2019-08-16T06:05:57.267Z DEBUG describer/path_matcher.go:44 register path {"name": "overview", "path": "/"}
2019-08-16T06:05:57.267Z DEBUG describer/path_matcher.go:44 register path {"name": "overview", "path": "/workloads"}
2019-08-16T06:05:57.267Z DEBUG describer/path_matcher.go:44 register path {"name": "overview", "path": "/workloads/cron-jobs"}
2019-08-16T06:05:57.267Z DEBUG describe
@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%;
}
@pbnj
pbnj / README-setup-tunnel-as-systemd-service.md
Created May 11, 2019 19:14 — forked from drmalex07/README-setup-tunnel-as-systemd-service.md
Setup a secure (SSH) tunnel as a systemd service. #systemd #ssh #ssh-tunnel #ssh-forward

README

Create a template service file at /etc/systemd/system/secure-tunnel@.service. The template parameter will correspond to the name of target host:

[Unit]
Description=Setup a secure tunnel to %I
After=network.target
@pbnj
pbnj / Dockerfile
Created November 28, 2017 00:26
Building Go binaries for bare OSes (e.g. alpine)
FROM golang:1.9 AS build
LABEL maintainer "Peter Benjamin"
WORKDIR /go/src/github.com/petermbenjamin/go-hello-world
COPY . .
RUN go get -u -v github.com/golang/dep/cmd/dep \
&& dep init \
&& CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o hello-world .
FROM alpine
COPY --from=build /go/src/github.com/petermbenjamin/go-hello-world/hello-world /usr/bin/hello-world
@pbnj
pbnj / gist:caa97e211513f7f3ed36d87727db6ada
Created November 22, 2017 23:29 — forked from oleksii-zavrazhnyi/gist:968e5ea87e99d9c41782
BASH Absolute path of current script
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )

Is a useful one-liner which will give you the full directory name of the script no matter where it is being called from

These will work as long as the last component of the path used to find the script is not a symlink (directory links are OK). If you want to also resolve any links to the script itself, you need a multi-line solution:

SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink