Skip to content

Instantly share code, notes, and snippets.

View pfrazee's full-sized avatar

Paul Frazee pfrazee

View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pfrazee
pfrazee / schemas-design-doc-draft.md
Created June 8, 2022 20:22
An initial draft proposal of record schemas for Bluesky's ADX project.

Schemas Design Doc (draft)

Please note: The following document is an initial draft proposal. All decisions are subject to change. Our present goal is to collect feedback and iterate upon this document. Please feel free to share your suggestions and concerns.

Overview

ADX is a federated network for distributing data. It leverages cryptographic signatures and hashes to distribute authenticity proofs along with the data, enabling each node to transact upon the data independently of the data's origin. ADX might therefore be described as an Internet-native database in which records are replicated across nodes.

As a consequence of relying on authenticity proofs, ADX must exchange "canonical" records. That is, ADX records must be transmitted in their original encoding and structure in order to validate the signatures and hashes which comprise the proofs. This stands in contrast to the RESTful model of the Web in which "representations" of records are exchanged and therefore may be constructed at the ti

/**
* Counter
*
* This contract maintains a single numeric value which can only be incremented.
*/
import { index } from 'contract'
// database api
// =
@pfrazee
pfrazee / austin-architecture.md
Created August 9, 2021 17:54
A draft architecture document for a Home Cloud project that's currently in development.

The Austin Architecture

PREFACE: This is an early draft of the still-untitled Home Cloud project's architecture. I'm sharing this as a kind of progress-report since I'm not ready to share code yet. Feedback is welcome but keep in mind that my head's still "in the details" so it may be hard to take too many suggestions at this stage. I'm sure lots of things will change as the rubber hits the road.

Since I don't have a name for the project yet, I'm using the temporary codename "Austin."

Austin uses a microservice cloud architecture with the following attributes:

  • Peer-to-peer networking
  • Strictly-defined protocols
import bson from 'bson'
import bsonExt from 'bson-ext'
import cbor from 'cbor'
import { gzipSync, gunzipSync } from 'zlib'
const VALUES = [
{value: true},
{value: 1234},
{value: 'string'},
{foo: 'bar', thisIs: 1234, another: true},
@pfrazee
pfrazee / videos.js
Created May 27, 2021 01:28
Script for encoding & compressing MP4s in the browser
import bytes from '../../vendor/bytes/index.js'
const MAX_WIDTH = 600
const MAX_HEIGHT = 600
const { createFFmpeg, fetchFile } = FFmpeg
let ffmpeg
export async function compressAndGetThumb (file, maxVideoSize, progressCb) {
const objectUrl = URL.createObjectURL(file)
const videoEl = document.createElement('video')
videoEl.addEventListener('error', console.log)
@pfrazee
pfrazee / index.html
Created October 5, 2020 20:37
HPM app source (MVP of the app)
<!doctype html>
<html>
<head>
<title>HPM</title>
<style>
body {
max-width: 800px;
margin: 0 auto;
padding: 0 10px;
}
@pfrazee
pfrazee / index.js
Last active August 18, 2023 20:20
Using SharedArrayBuffer and Atomics to do synchronous messaging from a Web Worker to the main thread
const RES_SIZE = 256
const encoder = new TextEncoder('utf8')
var myWorker = new Worker('/worker.js')
console.log(myWorker)
const exportedMethods = {
hello (str) {
return `hello ${str}`
}
// Webterm Input Grammar (PEG.js)
// ==============================
Expression
= Term+
Term
= term:Switch _? { return {type: 'param', key: term.key, value: term.value} }
/ term:String _? { return {type: 'token', value: term} }
@pfrazee
pfrazee / theme.css
Created January 31, 2020 14:16
Simple Wiki Theme
body {
--light-gray: #f7f7fc;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
margin: 0;
display: grid;
grid-gap: 10px;
grid-template-columns: 300px 1fr;
grid-template-rows: 100px 1fr;
min-height: 100vh;