Skip to content

Instantly share code, notes, and snippets.

import zlib from "node:zlib";
import http from "node:http";
import { inspect } from "node:util";
import { PassThrough } from "node:stream";
// crc32
const GF2_DIM = 32;
function gf2MatrixTimes(mat, vec) {
from typing import TypeVar, Generic, Literal, Final, TypedDict, Protocol, Any
T = TypeVar("T")
U = TypeVar("U")
T_contra = TypeVar("T_contra", contravariant=True)
U_co = TypeVar("U_co", covariant=True)
class Metric(Protocol[T_contra, U_co]):
def add(self, value: T_contra) -> None:
@twooster
twooster / download-inventory.sh
Last active May 18, 2020 10:07
Download the S3 inventory for a bucket into a gigantic CSV
#!/bin/bash
set -eo pipefail
test -z $AWS_PROFILE && echo "No AWS profile found in \$AWS_PROFILE" && exit 1
BUCKET="$1"
if [[ -z "$BUCKET" ]] ; then
echo "You must specify the S3 bucket to download the inventory of as the first parameter"
exit 1
fi
@twooster
twooster / README.md
Last active April 2, 2020 10:06 — forked from jmhobbs/README.md
Create scrolling text gifs for Slack

(Forked from yolo.sh that works on mac)

Makes little scrolly text jiffs in Flywheel colors.

Prerequisites

  • imagemagick sudo apt install imagemagick
  • gifsicle sudo apt install gifsicle
  • u linux
@twooster
twooster / README.md
Created April 2, 2020 08:25 — forked from jmhobbs/README.md
Create scrolling text gifs for Slack

Makes little scrolly text jiffs in Flywheel colors.

Prerequisites

  • imagemagick brew install imagemagick
  • gifsicle brew install gifsicle
  • Heartwell 1.2.otf font installed
  • u r on a mac

Usage

Keybase proof

I hereby claim:

  • I am twooster on github.
  • I am twooster (https://keybase.io/twooster) on keybase.
  • I have a public key whose fingerprint is 7E1D 2679 FEB7 49F8 8354 D106 F81D DD7A 970A D8CD

To claim this, I am signing this object:

javascript:(function()%7Bvar%20d%3Ddocument,f%3Dfunction(c)%7Bvar%20i,a,s,h%3Ba%3Dc.getElementsByTagName(%27link%27)%3Bfor(i%3D0%3Bs%3Da%5Bi%5D%3B%2B%2Bi)%7Bif(s.rel.toLowerCase().indexOf(%27stylesheet%27)%3E%3D0%26%26s.href)%7Bh%3Ds.href.replace(/(%26%7C%5C%3F)forceReload%3D%5Cd%2B/,%27%27)%3Bs.href%3Dh%2B(h.indexOf(%27%3F%27)%3E%3D0%3F%27%26%27:%27%3F%27)%2B%27forceReload%3D%27%2B(new%20Date().valueOf())%7D%7D%7D%3Bf(d)%3Bvar%20i,a,s%3Ba%3Dd.getElementsByTagName(%27iframe%27)%3Bfor(i%3D0%3Bs%3Da%5Bi%5D%3B%2B%2Bi)%7Bf(s.contentDocument)%3B%7D%7D)()%3B
@twooster
twooster / gist:2365697
Created April 12, 2012 08:54
EoS Scraper
var Dict = function(obj) {
this.items = {};
if (typeof obj != 'undefined')
this.setFromObj(obj);
};
Dict.prototype.setFromObj = function(obj) {
for (var key in obj)
if (Object.prototype.hasOwnProperty.call(obj, key))
this.set(key, obj[key]);
};