Skip to content

Instantly share code, notes, and snippets.

View jordanbtucker's full-sized avatar

Jordan Tucker jordanbtucker

View GitHub Profile
@jordanbtucker
jordanbtucker / base64.js
Last active November 8, 2023 10:06
Base64
export function bytesToBase64(bytes) {
return btoa(String.fromCharCode(...bytes));
}
export function bytesToBase64URL(bytes) {
return bytesToBase64(bytes)
.replaceAll("+", "-")
.replaceAll("/", "_")
.replaceAll("=", "");
}
{
"Animal_Insect_A": "Hot-Footed Frog",
"Animal_Insect_AA": "Energetic Rhino Beetle",
"Animal_Insect_AB": "Smotherwing Butterfly",
"Animal_Insect_AG": "Sticky Frog",
"Animal_Insect_AH": "Sticky Lizard",
"Animal_Insect_AI": "Deep Firefly",
"Animal_Insect_B": "Tireless Frog",
"Animal_Insect_C": "Cold Darner",
"Animal_Insect_E": "Sunset Firefly",
@jordanbtucker
jordanbtucker / amiibo.txt
Last active April 6, 2024 19:56
Tears of the Kingdom amiibo Drop Tables
Each amiibo has four drop tables: Normal, SmallHit, BigHit, and GreatHit. Each
drop table has a range that indicates the number of possible items that will
drop at one time. For example, x8 means that eight items will drop, while x1-2
means that there is equal probability that either one item or two items will
drop.
For each item that drops, the item probability table lists the independent
probabilities for what each item will be. For example, for each of the eight
Normal items that the TotK Link amiibo drops, each item has a 35% probability of
being a Hylian Shroom, a 5% probability of being a Stamella Shroom, etc. For
@jordanbtucker
jordanbtucker / bigint-replacer.js
Created May 27, 2022 17:14
JSON/JSON5 BigInt Replacer and Reviver
function bigIntReplacer(key, value) {
if (typeof value === 'bigint') {
return `${value}n`
}
return value
}
// See https://github.com/json5/json5/issues/91#issuecomment-197048166 for motivation and documentation.
function regExpReviver(name, value) {
const ID_Continue =
/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0
@jordanbtucker
jordanbtucker / parse.js
Created July 21, 2021 20:11
JSON5 parsing simple references as strings
// see https://github.com/json5/json5/issues/249
const util = require('./util')
let source
let parseState
let stack
let pos
let line
let column
@jordanbtucker
jordanbtucker / README.md
Created October 18, 2020 17:56
Big Endian Types for Cheat Engine

Big Endian Types for Cheat Engine

These auto assembly scripts add big endian value types for Cheat Engine, which is useful for games like Breath of the Wild.

How to add big endian types to Cheat Engine

  1. Open Cheat Engine.
  2. Attach to any process.
  3. Right-click on the Value Type drop down box.
  4. Click Define new custom type (Auto Assembler).
10.0.1.2 - - [16/Jul/2020:03:57:51 +0000] "POST /dns-query HTTP/1.1" 200 1300 "-" "Chrome"
10.0.1.2 - - [16/Jul/2020:03:57:52 +0000] "POST /dns-query HTTP/1.1" 200 722 "-" "Chrome"
10.0.1.2 - - [16/Jul/2020:03:57:54 +0000] "POST /dns-query HTTP/1.1" 200 826 "-" "Chrome"
10.0.1.2 - - [16/Jul/2020:03:57:54 +0000] "POST /dns-query HTTP/1.1" 200 1299 "-" "Chrome"
10.0.1.2 - - [16/Jul/2020:03:58:13 +0000] "POST /dns-query HTTP/1.1" 200 1299 "-" "Chrome"
10.0.1.2 - - [16/Jul/2020:03:58:14 +0000] "POST /dns-query HTTP/1.1" 200 783 "-" "Chrome"
10.0.1.2 - - [16/Jul/2020:03:58:21 +0000] "POST /dns-query HTTP/1.1" 200 1303 "-" "Chrome"
10.0.1.2 - - [16/Jul/2020:03:58:45 +0000] "POST /dns-query HTTP/1.1" 200 1300 "-" "Chrome"
10.0.1.2 - - [16/Jul/2020:03:58:53 +0000] "POST /dns-query HTTP/1.1" 200 1289 "-" "Chrome"
10.0.1.2 - - [16/Jul/2020:03:58:54 +0000] "POST /dns-query HTTP/1.1" 200 917 "-" "Chrome"
const app = require('@feathersjs/feathers')
const service = require('feathers-knex')
const knex = require('knex')
const db = knex({
client: 'mysql',
connection: 'mysql://user:pass@localhost/test',
})
app.use('todos', service({
@jordanbtucker
jordanbtucker / prompt-for-password.js
Last active November 10, 2023 20:00
Database encryption with NeDB
/**
* This is an example of app that uses an ecrypted NeDB database. It prompts the
* user for a password, decrypts the database, displays any existing records,
* promtps the user for a new record to store, encrypts that record, then exits.
* The password must be given each time the app is started.
*/
const crypto = require('crypto')
const inquirer = require('inquirer')
const scrypt = require('scryptsy')