- Make sure you have a modern-ish version of Node.js installed.
- Type
npx https://gist.github.com/kfox/1280c2f0ee8324067dba15300e0f2fd3
- Connect to it from a client, e.g.
netcat
or similar:nc localhost 9000
eval $(xargs -0 -L1 -a /proc/1/environ | grep -E '^[A-Z].*' | sed -e 's/=/="/' -e 's/$/"/') |
These instructions will enable you to use different SSH keys for different accounts across different Source Code Management (SCM) providers like GitHub, Gitlab, and others, including internal on-prem versions of those providers. You can also use this approach to switch between multiple accounts for a single SCM provider, e.g. a personal Github account and a work Github account.
-
Install
asdf
by following the Getting Started instructions.asdf
is the tool used to manage any number of versions of various programming language runtimes or environments. You can use asdf and the appropriate asdf plugins to replace separate tools likenvm
,pyenv
,rvm
, etc. -
Install the
direnv
plugin forasdf
per these instructions. Direnv is the bit that "automagially"
#!/usr/bin/env bash | |
affirmative_response_to() { | |
PROMPT=$* | |
IFS= read -n 1 -s -p "${PROMPT}? [Y/n]: " answer | |
if [ "${answer:-Y}" = "${answer#[Yy]}" ]; then | |
# anything other than enter, Y, or y was pressed | |
echo "NO" |
#!/usr/local/bin/node | |
const { spawnSync } = require('child_process') | |
const { createWriteStream, existsSync, mkdirSync } = require('fs') | |
const { get } = require('https') | |
const { join } = require('path') | |
const { parse: queryParser } = require('querystring') | |
const { parse: urlParser } = require('url') | |
const { HOME } = process.env |
// startDate and endDate are moment() dates | |
// returns an array of dates in the given format | |
const getDateRange = (startDate, endDate, { format = 'YYYY-MM-DD' } = {}) => { | |
const date = startDate.clone() | |
const dates = [] | |
while (date.isSameOrBefore(endDate)) { | |
dates.push(date.format(format)) | |
date.add(1, 'days') |
#!/usr/bin/env bash | |
: "${SLACK_API_TOKEN:?Need to set SLACK_API_TOKEN environment variable}" | |
STATUS=$(/usr/bin/osascript <<"EOF" | |
if application "Spotify" is running and application "Slack" is running then | |
tell application "Spotify" | |
set currentArtist to artist of current track as string | |
set currentSong to name of current track as string | |
return currentArtist & " - " & currentSong |
const convertRGBArrayToHexString = rgb => | |
`#${rgb.map(color => ('0' + color.toString(16)).slice(-2)).join('')}`; | |
const convertHexStringToRGBArray = hex => | |
hex.match(/[^#]{2}/g).map(color => parseInt(color, 16)); |
# in a git repo, compare your branch to another branch on github.com | |
# and optionally create a pull request | |
function gpr { | |
local repo | |
local branch | |
local title | |
repo=$(git ls-remote --get-url 2>/dev/null) | |
branch=$(git branch --no-color --contains HEAD 2>/dev/null | awk '{ print $2 }') |