Skip to content

Instantly share code, notes, and snippets.



View GitHub Profile
i-infra /
Last active Feb 18, 2021
How to get a (GVoice) phone number that you can use, safely, to interact with strangers, online. [2021]

Appropriate Phone Infra (Operational GVoice) v0.9.0

Public Release Feb17, 2021.

Copyright 2021, AKA Infra

Released under Creative Commons by Attribution 4.0 International (CC BY 4.0)

You are free to:

  • Share — copy and redistribute the material in any medium or format
qwtel / whatwg-stream-to-async-iterable.ts
Created Oct 12, 2020
Convert WHATWG web streams to async iterables and back
View whatwg-stream-to-async-iterable.ts
export async function* streamToAsyncIterable<T>(stream: ReadableStream<T>): AsyncIterableIterator<T> {
const reader = stream.getReader();
try {
while (true) {
const { done, value } = await;
if (done) return;
yield value;
} finally { reader.releaseLock() }

Hyperswarm DHT setup

Checking your network for P2Pness

Running a node

Running a dht node is as simple as installing the DHT cli.

npm i -g @hyperswarm/cli
cjihrig / wasi.c
Last active Mar 21, 2020
WASI C Header
View wasi.c
#include "uvwasi.h"
__wasi_errno_t __wasi_args_get(char** argv, char* argv_buf) {
return __WASI_ENOTSUP;
__wasi_errno_t __wasi_args_sizes_get(size_t* argc, size_t* argv_buf_size) {
return __WASI_ENOTSUP;
pfrazee /
Last active May 4, 2018
Reference for new APIs in Beaker 0.8

New APIs in Beaker 0.8

This Gist is a quick writeup for devs using the beta or master build. We'll get a more complete writeup in the Beaker site docs on 0.8's final release. Feel free to open issues for discussion.


We've done some work on the DatArchive API to make it easier to use. Prior to 0.8, Dats had a "staging area" folder which you had to commit() to publish. In 0.8, Beaker will automatically sync that folder. As a result, the staging-area methods (diff() commit() and revert()) were deprecated. There are also some new methods, and a few changes to how events work.

Here's a full reference:


So, as I mentioned last time, I have two fundamental goals with dat that are not addressed by simply running dat share.

  • Uptime: making sure that the site is seeded even if my local laptop is closed, eaten by a bear, or disconnected from the internet
  • Resilience: ensuring that there's a way to restart my website if the original seeding computer is lost. I try to make everything on my primary work/personal computer work in such a way that I can recover it all, easily, onto a new machine if I need to

To break these down a bit more, uptime is a combination of two things:

  • Ensuring that there are seeders
  • Ensuring that those seeders are seeding, and they're up-to-date
View CustomPrettyMs.js
'use strict';
const parseMs = require('parse-ms');
const plur = require('plur');
const units = [{ s: 'y', l: 'year' },
{ s: 'd', l: 'day' },
{ s: 'h', l: 'hour' },
{ s: 'm', l: 'minute' },
{ s: 's', l: 'second' },
{ s: 'ms', l: 'millisecond' }];
cblgh /
Last active May 1, 2018
make the p2p web with dat's primitives

low level primitives (in ascending abstraction)

  • hypercore works with individual posts in an append-only feed
  • hyperdrive abstracted filestore / works with files
  • hyperdiscovery create p2p swarms for hypercores, hyperdrives, and hyperdbs
  • hyperdb key-value database

higher level abstractions

  • webdb database; basically a document(?) store
  • dat-node built ontop of hypercore & hyperdrive, abstracts a bunch of stuff; less complex but also less flexible
Adam-- / adb_screenshot.bat
Last active Oct 25, 2020
Take an Android screenshot using ADB on Windows
View adb_screenshot.bat
adb devices
adb shell screencap -p /sdcard/screen.png
adb pull -p -a /sdcard/screen.png
adb shell rm /sdcard/screen.png
For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set mydate=%%c-%%a-%%b)
For /f "tokens=1-3 delims=/:" %%a in ("%TIME%") do (set mytime=%%a-%%b-%%c)
set mytime=%mytime: =%