Skip to content

Instantly share code, notes, and snippets.

View jaames's full-sized avatar
🐳
~

James Daniel jaames

🐳
~
View GitHub Profile

version: 0.10.2 md5: 2e80ff35027fc4a72e9dcd9e8b15a27b

version: 1.7.0 md5: 4156d02939ebfd3929b53dcc61d69cd1

version: 1.9.1-beta.1 md5: 2dbef3db9a98239079c47dd1a4dc8867

@jaames
jaames / client_ca.pem
Created August 26, 2021 19:59
Playdate's client_ca.pem from the ESP flash. Dumped by doing `esp AT+SYSFLASH=2,"client_ca",0,0x2000` over USB.
-----BEGIN CERTIFICATE-----
MIIGEzCCA/ugAwIBAgIQfVtRJrR2uhHbdBYLvFMNpzANBgkqhkiG9w0BAQwFADCB
iDELMAkGA1UEBhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0pl
cnNleSBDaXR5MR4wHAYDVQQKExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNV
BAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMTgx
MTAyMDAwMDAwWhcNMzAxMjMxMjM1OTU5WjCBjzELMAkGA1UEBhMCR0IxGzAZBgNV
BAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEYMBYGA1UE
ChMPU2VjdGlnbyBMaW1pdGVkMTcwNQYDVQQDEy5TZWN0aWdvIFJTQSBEb21haW4g
VmFsaWRhdGlvbiBTZWN1cmUgU2VydmVyIENBMIIBIjANBgkqhkiG9w0BAQEFAAOC
AQ8AMIIBCgKCAQEA1nMz1tc8INAA0hdFuNY+B6I/x0HuMjDJsGz99J/LEpgPLT+N

PathKit's docs are out of date, and changes in Webpack 5 mean that their installation instructions don't work

Install the following from NPM:

  • pathkit-wasm
  • webpack 5
  • copy-webpack-plugin
  • node-polyfill-webpack-plugin

Make sure your Webpack config has the following:

@jaames
jaames / gbg_palette.txt
Created June 28, 2021 17:56
Game Builder Garage texture palette as hex rgba
Game Builder Garage texture palette as hex rgba
// transparent
#00000000
// grays
#ffffffff
#edededff
#d9d9d9ff
#b5b5b5ff
@jaames
jaames / compileTemplate.ts
Created June 7, 2021 23:05
Tiny Typescript string template compiler
// makes use of tagged template literals
const compileTemplate = (strings: TemplateStringsArray, ...expr: string[]) => {
return (replacements: Record<string, any>) => {
// convert ${'whatever'} instances to array of values
const values = expr.map(key => replacements[key] ?? key);
// rebuild string with replaced values
return strings.reduce((result, part, i) => result + part + (values[i] ?? ''), '');
}
}
@jaames
jaames / Sha256.ts
Created May 11, 2021 10:03
Tiny Typescript implementation of Sha256
/**
* // hash content
* // content must be an uint8 typed array
* const hash = new Sha256();
* hash.update(content)
* // get digest as uint8 typed array
* const digest = hash.digest();
* // or get digest as hex string
* const hex = hash.hexDigest();
*/
@jaames
jaames / Crc32.ts
Last active June 14, 2021 20:01
Tiny Typescript implementation of CRC32
const POLYNOMIAL = -306674912;
let crc32_table: Int32Array = undefined;
export function Crc32(bytes: Uint8Array, crc=0xFFFFFFFF) {
if (crc32_table === undefined)
calcTable();
for (let i = 0; i < bytes.length; ++i)
crc = crc32_table[(crc ^ bytes[i]) & 0xff] ^ (crc >>> 8);
return (crc ^ -1) >>> 0;
@jaames
jaames / Sha1.ts
Last active May 11, 2021 10:02
Tiny Typescript implementation of Sha1
/**
* // hash content
* // content must be an uint8 typed array
* const hash = new Sha1();
* hash.update(content)
* // get digest as uint8 typed array
* const digest = hash.digest();
* // or get digest as hex string
* const hex = hash.hexDigest();
*/
@jaames
jaames / decode_kwz_filename.php
Last active February 1, 2021 11:28
Example PHP script to decode a KWZ filename
<?php
function decode_filename(string $filename)
{
$bytes = base32_decode($filename);
// Convert to byte string
$bin = join('', array_map('chr', $bytes));
// Unpack data
// Hex FSID (9 bytes, 18 chars) | Creation timestamp (uint32) | Modified timestamp (uint32)
return unpack('H18fsid/Vcreated/Vmodified', $bin);
@jaames
jaames / fonts.md
Last active November 4, 2025 09:57
Cool free/cheap font foundries