Skip to content

Instantly share code, notes, and snippets.

View jpbochi's full-sized avatar
🦔

JP Bochi jpbochi

🦔
View GitHub Profile
@reduardo7
reduardo7 / output_prefix.sh
Last active August 19, 2024 12:12
Output prefix with timestamp
#!/usr/bin/env bash
{
echo foo 1
sleep 1
echo bar 1 >&2
echo foo 2
sleep 1
echo bar 2 >&2
} \
import chalk from 'chalk';
import isUnicodeSupported from 'is-unicode-supported';
const main = {
info: chalk.blue('ℹ'),
success: chalk.green('✔'),
warning: chalk.yellow('⚠'),
error: chalk.red('✖'),
};
@jpbochi
jpbochi / simple-git-branching-model.md
Created February 10, 2021 09:59 — forked from jbenet/simple-git-branching-model.md
a simple git branching model

a simple git branching model (written in 2013)

This is a very simple git workflow. It (and variants) is in use by many people. I settled on it after using it very effectively at Athena. GitHub does something similar; Zach Holman mentioned it in this talk.

Update: Woah, thanks for all the attention. Didn't expect this simple rant to get popular.

plausible general principles governing valid agreements:

  1. Valid consent requires a reasonable way of opting out.
  2. Explicit dissent has precedence over alleged implicit consent.
  3. An action can be taken as indicating agreement to some scheme only if one can be assumed to believe that if one did not take that action the scheme would not be imposed on the person.
  4. Contractual obligation is mutual and conditional.

How does the relation between individuals and the state holds up against those principles?

  1. No state has provided meaningful ways of opting out, means that do not require dissenters to assume large costs that the state has no independent right to impose.
  2. All modern states in refusing to recognize explicit dissent render their relationships with the citizens non-voluntary.
@jpbochi
jpbochi / .bash_ps1
Created August 6, 2019 10:33
bash PROMPT_COMMAND + PS1 for git status
#!/usr/bin/env bash
# copied from http://mediadoneright.com/content/ultimate-git-ps1-bash-prompt
# Customize BASH PS1 prompt to show current GIT repository and branch.
# by Mike Stewart - http://MediaDoneRight.com
# TODO: scope the following env vars to this file only. They can be seen with `declare -p`
# Reset
Color_Off="\[\033[0m\]" # Text Reset
@akorn
akorn / runcached
Last active September 3, 2024 22:15
Run specified (presumably expensive) command with specified arguments and cache result. If cache is fresh enough, don't run command again but return cached output.
#!/bin/zsh
#
# Purpose: run specified command with specified arguments and cache result. If cache is fresh enough, don't run command again but return cached output.
# Also cache exit status and stderr.
# Copyright (c) 2019-2023 András Korn; License: GPLv3
# Use silly long variable names to avoid clashing with whatever the invoked program might use
RUNCACHED_MAX_AGE=${RUNCACHED_MAX_AGE:-300}
RUNCACHED_IGNORE_ENV=${RUNCACHED_IGNORE_ENV:-0}
RUNCACHED_IGNORE_PWD=${RUNCACHED_IGNORE_PWD:-0}
@fnky
fnky / ANSI.md
Last active June 1, 2025 14:22
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@jpbochi
jpbochi / pull-aws-creds.sh
Last active May 17, 2023 12:44
pull-aws-creds.sh
#!/usr/bin/env sh
set -eu
API_BASE="${API_BASE:-https://github.api.manage.rackspace.com}"
KEY_FILE=${KEY_FILE:-"$HOME/.ssh/id_rsa"}
fail() {
echo >&2 "This tool needs an SSH key to sign a request to $API_BASE."
echo >&2 "The key must be configured as a deploy key in your GitHub repository linked to an AWS account."
@F21
F21 / signing-gpg-keys.md
Last active May 18, 2025 16:53
Signing someone's GPG key

This is a quick guide of the commands we use to sign someone's GPG key in a virtual key signing party.

Note: The steps cover only the technical aspects of signing someone's key. Before signing someone's key, you must verify their identity. This is usually done by showing government-issued ID and confirming the key's fingerprint

The commands will work for both GPG and GPG2.

I use Julian's key for the examples. His key id is 2AD3FAE3. You should substitute with the appropriate key id when running the commands.

Signing the key

  1. List the keys currently in your keyring: gpg --list-keys.