Skip to content

Instantly share code, notes, and snippets.

View mjpitz's full-sized avatar
🏳️‍🌈
out and proud

Mya mjpitz

🏳️‍🌈
out and proud
View GitHub Profile
@mjpitz
mjpitz / appscripts.md
Last active January 13, 2022 16:38
Various Google AppScripts that I have.

Scripts for https://script.google.com/home/start

Create the project:

  1. Click new "New Project"
  2. Delete the contents of the default project
  3. Paste one of the following snippets into the editor
  4. Name and save your project
  5. In the editor bar, select the function that you want to run (for the tadpoles script, select imageDownloader)
  6. Run the function and grant it the required permissions.
@mjpitz
mjpitz / storj-upload-server.js
Last active February 15, 2022 21:29
Pseudocode for performing an upload using a chunked HTTP request
// The guide online generally works, but has values that do not correspond to the primary active satellites.
// https://github.com/storj-thirdparty/uplink-nodejs/blob/7fb4a9ab35b04c7338d503d6d3d76d9264c53867/docs/tutorial.md
const http = require('http');
// Step 2 / 3
const storj = require("uplink-nodejs");
const uplink = new storj.Uplink();
// Step 1

Keybase proof

I hereby claim:

  • I am mjpitz on github.
  • I am mjpitz (https://keybase.io/mjpitz) on keybase.
  • I have a public key ASAZhypY8jMENYr7mgIk7AijguSzbO9acsBYDamMX4cNSgo

To claim this, I am signing this object:

package main_test
func Test(t testing.T) {
testplanet.Test(
storagenodetp.Configure(...),
satellitetp.Configure(...),
)(func() {})
}
@mjpitz
mjpitz / storj_uplink_oidc.go
Created September 7, 2022 16:43
Some rough code used to obtain access to storj using OIDC
@mjpitz
mjpitz / cltv.go
Created December 18, 2024 13:48
Dataset builder example using Go, GORM, and ClickHouse.
// Copyright (C) 2024 C8 Labs
// SPDX-License-Identifier: AGPL-3.0-or-later
// This file illustrates the notion of an "index builder" or "dataset builder" using Go, GORM, and ClickHouse. While
// working at Indeed, we leveraged some fairly robust data pipelines that were built on top of our analytics engine.
// One of those parts were this idea of an index builder which allowed us to derive higher level metrics from data
// stored in our data warehouse.
//
// For most projects, I wind up using Go and GORM for quick and easy schema management. This offered a convenient
// way to define and iterate on schema over time and build migrations in as part of the index building job.
@mjpitz
mjpitz / 10-rules.md
Created February 22, 2025 15:37
Ten Rules for Safety Critical Code

Ten Rules for Safety Critical Code

  1. Rule: Restrict all code to very simple control flow constructs – do not use goto statements, setjmp or longjmp constructs, and direct or indirect recursion.

    Rationale: Simpler control flow translates into stronger capabilities for verification and often results in improved code clarity. The banishment of recursion is perhaps the biggest surprise here. Without recursion, though, we are guaranteed to have an acyclic function call graph, which can be exploited by code analyzers, and can directly help to prove that all executions that should be bounded are in fact bounded.