Skip to content

Instantly share code, notes, and snippets.

Avatar

Jordan Tucker jordanbtucker

View GitHub Profile
@jordanbtucker
jordanbtucker / bigint-replacer.js
Created May 27, 2022 17:14
JSON/JSON5 BigInt Replacer and Reviver
View bigint-replacer.js
function bigIntReplacer(key, value) {
if (typeof value === 'bigint') {
return `${value}n`
}
return value
}
View regexp-reviver.js
// 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
View parse.js
// 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
View README.md

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).
View apache-access.log
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"
View feathers-knex-distinct.js
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 2, 2021 03:42
Database encryption with NeDB
View prompt-for-password.js
/**
* 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')
View date.peg.js
Date
= FourDigits '-' TwoDigits '-' TwoDigits 'T' TwoDigits ':' TwoDigits ':' TwoDigits { return new Date(text()) }
FourDigits
= Digit Digit Digit Digit
TwoDigits
= Digit Digit
Digit
View WiiPair.cpp
#include "pch.h"
#include <windows.h>
#include <bthsdpdef.h>
#include <bthdef.h>
#include <BluetoothAPIs.h>
#include <strsafe.h>
#include <tchar.h>
#pragma comment(lib, "Bthprops.lib")
@jordanbtucker
jordanbtucker / index.d.ts
Created April 5, 2019 05:09
@types/feathersjs__feathers using `export =` instead of `export default`
View index.d.ts
// Type definitions for @feathersjs/feathers 3.1
// Project: http://feathersjs.com/
// Definitions by: Jan Lohage <https://github.com/j2L4e>
// Abraao Alves <https://github.com/AbraaoAlves>
// Tim Mensch <https://github.com/TimMensch>
// Definitions: https://github.com/feathersjs-ecosystem/feathers-typescript
// TypeScript Version: 2.3
/// <reference types="node" />