Skip to content

Instantly share code, notes, and snippets.

View owenkellogg's full-sized avatar
🛩️
Deep house disco, hyper-efficient money.

Owen Kellogg owenkellogg

🛩️
Deep house disco, hyper-efficient money.
  • Andorra
View GitHub Profile
@owenkellogg
owenkellogg / generate_standard_distribution.ts
Created October 14, 2023 02:58
Generates N values in a standard distribution summing to X
/**
* Generates a normally distributed random number with an absolute value.
* @returns A positive random number following a standard normal distribution.
*/
function boxMullerRandomPositive(): number {
let u = 0, v = 0;
while (u === 0) u = Math.random();
while (v === 0) v = Math.random();
return Math.abs(Math.sqrt(-2.0 * Math.log(u)) * Math.cos(2.0 * Math.PI * v));
}
@owenkellogg
owenkellogg / parse_ordinals.ts
Created June 20, 2023 15:42
parse_ordinals.ts
import * as fs from 'fs';
import * as https from 'https';
import * as base64 from 'base64-js';
import { ArgumentParser } from 'argparse';
interface CLIArgs {
dataUri: boolean;
output?: string;
txId: string;
}
class PersonalInterest extends SmartContract {
@prop
owner: PubKey;
@prop
name: ByteString:
@prop(true)
@owenkellogg
owenkellogg / additional_data.ts
Created March 22, 2023 19:11
additional data
import { BoostPowJob } from 'boostpow'
export async function main() {
const job = BoostPowJob.fromObject({
content: '7c6ea266f959b03e779114ac0cc05c13f4a7d44745920a765192d82ecb6d31ee',
diff: 0.0001,
additionalData: Buffer.from(JSON.stringify({ paymail: '1sebastian@pow.co' }), 'utf8').toString('hex')
})
@owenkellogg
owenkellogg / powco_stream_bmap_messages.ts
Created December 29, 2022 09:30
Spec for powco stream SDK for streaming new b:// protocol messages using BMAP
import { stream } from 'onchain.sv'
const bStream = stream({
app: 'pow.co',
type: 'message',
attributes: {
channel: 'powco-development'
}
})
.on('B', ({txid, txhex, txo}) => {
@owenkellogg
owenkellogg / github_issue_nft.ts
Created December 28, 2022 14:33
This file defines the IssueNFT class, which is a RUN Jig that represents a Github issue.
/*
* This file defines the IssueNFT class, which is a Jig that represents a github issue.
* Each issue should be able to have awards associated with it, either satoshis or RUN tokens or both.
*
* When an issue is generated a new HD wallet is generated and assigned to that issue in the database
* The wallet will be derived from a global HD wallet hierarchy. Each issue then may control an instance
* of stag wallet, which gives it the ability to receive and send tokens, and to execute actions on chain.
*
@owenkellogg
owenkellogg / stag_issue_token.ts
Created December 17, 2022 09:55
Stag Wallet Relayx Issue Run Token Fungible Coin
import { wrapRelayx } from 'stag-relayx'
async function issueTokens() {
const stag = wrapRelayx(window.relayx)
const { txid, txhex } = await stag.run.ft.issue({
symbol: 'DEV',
name: 'My Personal Developer Token',
@owenkellogg
owenkellogg / paypow_marketplace.md
Created November 22, 2020 18:46
How To Turn PayPow From A Tool Into A Marketplace

Currently Anypay is the only real seller of goods on the platform in the form of gift cards. If we wanted other people to be able to sell goods on the platform we could all them to publish product listings from their paymail account. That way they would be able to sell anything they wanted and anyone could list anything on the site. Because the listing is on-chain it incentivizes truthfullness and reputation because postings can never be removed. Therefore it is likely only legal goods and services will ever be sold. From a user standpoint it because super easy to shop and buy because all they have to do is swipe their bitcoin wallet to pay. Merchants get instant certainty, instant payouts, a clear record of purchases that can never be corrupted. Merchants own their data therefore can never be de-platformed from their own data. In this way Anypay can remove itself as the provider of services and become the provider of a platform which grows in value as more and more people make purchases. No one can be banned

@owenkellogg
owenkellogg / whiteboardCleaner.md
Created August 16, 2019 10:58 — forked from lelandbatey/whiteboardCleaner.md
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

@owenkellogg
owenkellogg / claim_output.ts
Created July 24, 2019 14:35
baseball_bet_padres_marlins_bch
import * as jeton from 'jeton-lib';
const PrivateKey = jeton.PrivateKey
const PublicKey = jeton.PublicKey
const Signature = jeton.Signature
const OutputScript = jeton.escrow.OutputScript
const Transaction = jeton.Transaction
var utxo1 = new Transaction.UnspentOutput({
txid:
'ab9596efa523e50f2bee749f6ae4cc40cf5bfe6fbf1556e75a4cb994e5700ebd',