This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Script runs on the browser console of the webpage: http://unicode.org/Public/UNIDATA/UnicodeData.txt | |
const entries = document.querySelector("body > pre").innerText.split('\n'); | |
entries.pop(); | |
let decompTags = ['<font>','<noBreak>','<initial>','<medial>','<final>','<isolated>','<circle>','<super>','<sub>','<vertical>','<wide>','<narrow>','<small>','<square>','<fraction>','<compat>'] | |
function parseDecompMapping(mapping) { | |
if (!mapping) return null; | |
mapping = mapping.split(' '); |
This file has been truncated, but you can view the full file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"code": 0, | |
"name": "<control>", | |
"category": "Cc", | |
"canonicalCombiningClass": 0, | |
"bidirectionalCategory": "BN", | |
"decompositionMapping": null, | |
"decimalDigitValue": null, | |
"digitValue": null, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const input = Number(process.argv[2]) || undefined; | |
function formatTZOffset(offset: number): string { | |
offset = Math.abs(offset); | |
let hours = Math.trunc(offset); | |
let mins = Math.round((offset - hours) * 60); | |
if (mins === 60) { | |
hours++; | |
mins = 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import fs from 'fs'; | |
import got from 'got'; // npm install got | |
got.get('https://data.iana.org/TLD/tlds-alpha-by-domain.txt').then(response => { | |
const listData = response.body.split('\n'); | |
const listVersion = listData.shift()!.slice(2); | |
listData.pop(); | |
fs.writeFileSync('./tlds.json', JSON.stringify({ version: listVersion, tlds: listData })); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Usage: | |
// node --no-warnings --loader ts-node/esm gitcex.ts <REPOSITORY_GIT_URL> | |
// pass 'local' on <REPOSITORY_GIT_URL> to use an already fetched repository on ./repository folder. | |
// | |
//! WARNING: Very disk-intensive and disk space consuming for large repositories. | |
import fs from 'fs'; | |
import { execSync as exec } from 'child_process'; | |
const argv = process.argv.slice(2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
typedef unsigned char u8; | |
typedef unsigned short u16; | |
typedef unsigned int u32; | |
typedef unsigned long long u64; | |
typedef signed char s8; | |
typedef signed short s16; | |
typedef signed int s32; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import path from 'path'; | |
/** | |
* Converts Windows paths to WSL Windows paths if on a WSL environment. | |
* | |
* - Paths that are already valid Linux paths or WSL Windows paths will not be modified. | |
* - If on Windows and outside of WSL, paths with backslashes will be converted to forward slashes. | |
* - Windows paths with mixed slashes are supported. Linux paths with mixed slashes are not. | |
* @example `C:\\root\\pop\\bob\\foobar.jpeg` -> `/mnt/c/root/pop/bob/foobar.jpeg` | |
* @param absolutePath The given path must be absolute, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// what-am-i-running-on (wairo) microlibrary v1.0.0 | |
// Simple utility to check which runtime your code is running on. | |
export default function wairo() { | |
if (typeof Deno === "object") return "deno"; | |
if (typeof process === "object") { | |
if (process.isBun === 1) return "bun"; | |
if (process.versions.v8) return "node"; | |
} | |
if (typeof std === "object" && globalThis.scriptArgs instanceof Array) return "quickjs"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This Source Code Form is subject to the terms of the Mozilla Public | |
License, v. 2.0. If a copy of the MPL was not distributed with this | |
file, You can obtain one at https://mozilla.org/MPL/2.0/. | |
|=======================================================| | |
| Chainable console.log proof of concept implementation | | |
|=======================================================| | |
Conceptually, this would allow for libraries to plug into console.log like plugins, | |
rather than overriding each other without rules and breaking end programs using them. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function entropy(strOrBuf = '') { | |
const buf = typeof strOrBuf === 'string' ? Buffer.from(strOrBuf, 'utf8') : strOrBuf; | |
const counts = {}; | |
for (const byte of buf) { | |
counts[byte] ??= 0; | |
counts[byte] += 1; | |
} | |
let totalEntropy = 0; | |
for (const byte in counts) if (counts[byte]) { | |
const prevalence = counts[byte] / buf.byteLength; |
OlderNewer