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
@thingsiplay
thingsiplay / woman
Last active June 8, 2023 04:22
woman - Preview list for man documents
#!/bin/env bash
# Lookup section meaning in `man man`.
sections='1,8,6,5,7'
show_manual () {
man -- "${1%% *}" 2> /dev/null
}
export -f show_manual
@romainl
romainl / vanilla-surround.md
Last active April 28, 2024 19:59
Poor man's Surround

Poor man's Surround

The following shows how to replicate some of Surround's features if you don't happen to have it installed.

NOTE: We only dealt with the simplest cases, here, and the convoluted nature of some of these commands shows how well designed and useful that plugin is. And let's not talk about all the corner cases it handles.

Install it, it's worth it.

The list

@repi
repi / crate-health.md
Last active February 22, 2024 01:17
Guidelines on evaluating health & quality of third-party crates at Embark

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.

Legend: 🔒 Must have, ⭐️ Should have, 👍 Nice to have, ℹ️ Info

# 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
@Gadgetoid
Gadgetoid / Makefile
Last active August 25, 2023 01:50
Pi 400 KB
CFLAGS_ALL=-I../libusbgx/build/include -I../bcm2835-1.68/build/include -L../bcm2835-1.68/build/lib -I../lua-5.4.0/src -L../libusbgx/build/lib -L../libserialport/build/lib -L../lua-5.4.0/src -lpng -lz -lpthread -llua -lm -lbcm2835 -ldl
pi400: CFLAGS+=-static $(CFLAGS_ALL) -lusbgx -lconfig -DPI400_USB
pi400: pi400.c gadget-hid.c
$(CC) $^ $(CFLAGS) -o $@
pi400test: CFLAGS+=-static $(CFLAGS_ALL) -lusbgx -lconfig
pi400test: pi400.c gadget-hid.c
$(CC) $^ $(CFLAGS) -o $@
@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 / Don't use Vim.md
Last active April 15, 2024 22:07
Don't use Vim for the wrong reasons

Don't use Vim

Don't do the crime, if you can't do the time.

-- Anthony Vincenzo "Tony" Baretta

Vim is an amazing text editor. I love it. Really, I wouldn't [organize][organize] a Vim advent calendar if I didn't. But, as amazing as it is, Vim is not for everyone. It can't solve all your problems, or be a TUI version of your favorite IDE, or make you a better programmer, or land you that dream job in the Bay Area. But Vim can help you be more mindful, focused, and efficient, as long as you approach it with the right mindset.

Don't get me wrong, I certainly welcome you to try Vim, but I'm not a proselyte. I don't thrive on newbies. I just want you to use the right tool for the job and not waste your—and anyone's—time on a fruitless quest.

@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

@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' \
@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).