Skip to content

Instantly share code, notes, and snippets.

@mankins
mankins / dibs.sh
Created February 20, 2024 12:17
dibs for bash
#!/bin/bash
# debug mode
DEBUG_MODE=0
# read file from command line
if [ -z "$@" ]; then
echo "Usage: $0 <file>"
exit 1
fi
#!/bin/bash
# get repo from command line
repo=$1
# parentWeight, default to 1
parentWeighting=${2:-1}
# if no repo, exit
if [ -z "$repo" ]; then
#!/bin/bash
# parentWeighting factor will multiple weights, we will get this from the first argument, defaulting to 1
parentWeighting=${1:-1}
# Get the list of authors and commit counts
authors=$(git log --format='%ae' | sort | uniq -c | sort -nr)
# Get the total weight
total=$(echo "$authors" | awk '{ sum += $1 } END { print sum }')
@mankins
mankins / empty-promise.md
Last active December 7, 2020 18:24
Today's Proposal: Empty Promises

What's the current best practice for executing a function included by adding a (potentially async, deferred) script tag on the page?

We used to have scripts load synchronously, so we could immediately start using the library the next line:

<head>
<script src="/my-library-2001.js"/>
<script>
 myLib.hello(); // works!
</script>
@mankins
mankins / aws-mfa.sh
Created November 2, 2017 18:56
aws mfa cli tool
#!/bin/bash
# From a user's MFA code, generate accesskey, secret, session token
#
# ENV inputs:
# AWS_CLI_INPUT = /path/to/token/config.json
# AWS_PROFILE = The Aws profile to use for aws commands
MFA_CODE=$1
if [ -z $MFA_CODE ]; then
@mankins
mankins / keybase.md
Created November 29, 2016 20:35
keybase.md

Keybase proof

I hereby claim:

  • I am mankins on github.
  • I am mankins (https://keybase.io/mankins) on keybase.
  • I have a public key ASAyJ-lSDbetag3VSMavEStIidiCXzNizg5_WGbbPJwURgo

To claim this, I am signing this object:

@mankins
mankins / brainfuck for jim
Created November 10, 2012 00:12
jim youll has a birthday
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.>[-]>[-]<<[->+>+<<]>>[-<<+>>]<+++++++++++++++++++++++++.>[-]>[-]<<[->+>+<<]>>[-<<+>>]<+++++++++++++++.>[-]>[-]<<[->+>+<<]>>[-<<+>>]<.>[-]>[-]<<[->+>+<<]>>[-<<+>>]<+++++++++.>[-]>[-]<<[->+>+<<]>>[-<<+>>]<-----------------------------------------------------------------------------------------.>[-]>[-]<<[->+>+<<]>>[-<<+>>]<++++++++++++++++++++++++++++++++++.>[-]>[-]<<[->+>+<<]>>[-<<+>>]<+++++++++++++++++++++++++++++++++++++++.>[-]>[-]<<[->+>+<<]>>[-<<+>>]<+++++++++.>[-]>[-]<<[->+>+<<]>>[-<<+>>]<++.>[-]>[-]<<[->+>+<<]>>[-<<+>>]<------------.>[-]>[-]<<[->+>+<<]>>[-<<+>>]<----.>[-]>[-]<<[->+>+<<]>>[-<<+>>]<---.>[-]>[-]<<[->+>+<<]>>[-<<+>>]<++++++++++++++++++++++++.>