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
@jimangel
jimangel / readme.md
Last active April 17, 2021 14:47
Examples of how to test the impact of the v1.16 API deprecations

Kubernetes v1.16 API deprecation testing

Examples of how to test the impact of the v1.16 API deprecations and ways to debug early!

If this is the first time you're hearing of these deprecations STOP and read this blog post (thanks @vllry!).

Common misunderstandings

  1. The exact apiVersion: value that I use in my manifest is stored on disk (etcd).
#!/usr/bin/env node
// run with: node sequencehunt_server.js
// info page: http://localhost:8080/info
// correct values: http://localhost:8080/check?val0=4&val1=12&val2=77&val3=98&val4=35
var http = require('http');
var url = require('url');
var TimingAttackProtectionSeconds = 3;
@oleksii-zavrazhnyi
oleksii-zavrazhnyi / gist:968e5ea87e99d9c41782
Created November 28, 2014 17:32
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
@BoltsJ
BoltsJ / qfsign.vim
Last active December 5, 2022 06:30
Automatically place signs based on the quickfix list.
if exists('g:loaded_qfsign')
finish
endif
let g:loaded_qfsign=1
sign define QFErr texthl=QFErrMarker text=E
sign define QFWarn texthl=QFWarnMarker text=W
sign define QFInfo texthl=QFInfoMarker text=I
augroup qfsign
@SteveByerly
SteveByerly / Makefile
Created October 3, 2019 18:22
Makefile for managing a Terraform project
MAKEFLAGS += --warn-undefined-variables
SHELL := bash
.SHELLFLAGS := -eu -o pipefail -c
.DEFAULT_GOAL := help
.SUFFIXES:
# ---------------------------------------------------------
# Local Variables
# ---------------------------------------------------------
@bgeesaman
bgeesaman / CVE-2019-11253-poc.sh
Last active December 29, 2022 14:25
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
@cocopon
cocopon / dark.Xresources
Last active February 15, 2023 02:22
.Xresources for Iceberg
! special
*.foreground: #c6c8d1
*.background: #161821
*.cursorColor: #c6c8d1
! black
*.color0: #1e2132
*.color8: #6b7089
! red
@whiteinge
whiteinge / login-csrf.sh
Created January 30, 2020 03:04
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' \
@romainl
romainl / jest-and-vim.md
Created August 20, 2020 13:13
Jest and built-in Vim features

Jest and built-in Vim features

Set up a sandbox

$ cd /tmp
$ mkdir jest-and-vim
$ cd $_
$ npm init -y
$ npm install --save-dev jest
@romainl
romainl / eslint-standard.md
Last active June 5, 2023 00:46
Painless ESLint/Standard integration

Painless ESLint/Standard integration

Our goal, here, is threefold:

  • use Vim's built-in features to their fullest,
  • be a good project citizen even if we don't use $EDITOR_DU_JOUR,
  • have a minimal but beneficial impact on the infrastructure of the project we work on.

Expose a simple interface for linting at the project level