Skip to content

Instantly share code, notes, and snippets.

( ͡ᵔ ͜ʖ ͡ᵔ )

Max maxogden

( ͡ᵔ ͜ʖ ͡ᵔ )
View GitHub Profile
maxogden /
Last active May 17, 2023 06:07
birdnet laptop mode
TIMEFORMAT='Elapsed Time: %0R seconds.'
time {
export YEAR=`date '+%Y'`
export MONTH=`date '+%m'`
export DAY=`date '+%d'`
export WEEK=`date '+%U'`
# kill `cat /home/max/tweet/`
for f in `ls /home/max/tweet/samples/${YEAR}/${MONTH}/${DAY}/*.wav`
maxogden / index.html
Last active September 30, 2022 22:05
la county impervious surface assessor parcel map
View index.html
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui"
maxogden /
Created September 1, 2021 00:07
Metro Micro API (RideCo API)

i downloaded the metro micro APK, extracted it, and then unminified the ionic JS source code, then reverse engineered these calls using my own username/password

# get a token
curl -H "Accept: application/json; version=rccmtp-2.18.0" -X POST -F "username=youremail" -F "password=yourpass"

# get geocode results
curl -H "Accept: application/json; version=rccmtp-2.18.0" -X GET "$MICRO" -H "Authorization: Token $MICRO"

# get a trip/ride id
maxogden /
Created February 19, 2021 17:17
Bitcoin Regtest Local Server Instructions
  1. Grab the latest bitcoin-core .tar.gz release and unpack it
  2. Add the bin folder to your path
  3. Start the regtest server bitcoind -regtest
  4. Create a test wallet bitcoin-cli -regtest createwallet test
  5. Get a bcrt address for your wallet bitcoin-cli -regtest getnewaddress
  6. 'Mine' some regtest btc bitcoin-cli generatetoaddress 10 <address-from-previous-command>
  7. Make sure it worked `bitcoin-cli getblockcount
maxogden / index.js
Last active May 17, 2023 06:09
JavaScript Base-40 Class
View index.js
// based on
class B40 {
constructor() {
this.B16_CHARS = '0123456789abcdef'
this.B40_CHARS = '0123456789abcdefghijklmnopqrstuvwxyz-_.+'
divmod(x, y) {
const div = x / y
const rem = x % y
maxogden / index.js
Created July 11, 2019 20:01
jtalk cli
View index.js
var fs = require('fs');
var Speaker = require('speaker'); // version 0.3.0
var OpenJTalk = require('node-openjtalk').OpenJTalk;
// pre-included HTS voice file
var fn_voice = OpenJTalk.voices.mei_normal;
// instantiate OpenJTalk with an HTS voice
var open_jtalk = new OpenJTalk({voice: fn_voice});
// synthesize a voice synchronously
maxogden / difflint
Last active May 30, 2021 03:26
Run eslint + prettier on only files that you've staged/commited on the current branch
View difflint
#!/usr/bin/env bash
# chmod +x this and save in your PATH. Assumes `eslint` + `prettier` are in your `devDependencies`
BRANCH=$(git branch | grep \* | cut -d ' ' -f2)
BASE=$(git merge-base master $BRANCH) # change master to whatever your trunk branch is
COMMITED=$(git diff --name-only $BASE $BRANCH)
STAGED=$(git diff --staged --name-only)
FILES=$(printf "$COMMITED\n$STAGED" | sort | uniq)
LINT="npx eslint --ignore-path=.prettierignore $FILES"
PRETTIER="npx prettier --list-different $FILES"
maxogden / index.js
Created June 3, 2019 21:15
bip39 guesser
View index.js
const bip39 = require('bip39')
function twelveWords (missing) {
return `fold supreme boat absurd mango menu number brick ${missing} sun gold stone`
function loadWords () {
return `abandon
maxogden / index.js
Created May 24, 2019 20:51
ed25519 private and public keys to pem
View index.js
import { composePrivateKey, composePublicKey } from 'crypto-key-composer'
function privateToPem(privateKey) {
var decomposed = {
format: 'pkcs8-pem',
keyAlgorithm: { id: 'ed25519' },
keyData: {
seed: privateKey,
maxogden / index.js
Created May 24, 2019 01:36
slip-0010 hdkey ed25519 derivation from seed in javascript
View index.js
var ehdKey = require("@hawkingnetwork/ed25519-hd-key-rn")
var EdDSA = require('elliptic').eddsa
// test vector from
var seed = new Buffer('fffcf9f6f3f0edeae7e4e1dedbd8d5d2cfccc9c6c3c0bdbab7b4b1aeaba8a5a29f9c999693908d8a8784817e7b7875726f6c696663605d5a5754514e4b484542', 'hex')
var ed25519 = new EdDSA('ed25519')
var derived = ehdKey.derivePath("m/0'/2147483647'", seed.toString('hex'))
var keys = ed25519.keyFromSecret(derived.key)
// expected test vector outputs