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
use std::fmt; | |
use std::error::Error; | |
type Buffer = Vec<u8>; | |
pub trait ReadU24BE { | |
fn read_u24_be(&self, pos: usize) -> Result<u32, OutOfRangeError>; | |
} | |
impl ReadU24BE for Buffer { |
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 letters = 'abcdefghijklmnopqrstuvwxyz' | |
function randomString(max, min = 1) { | |
let length = Math.floor(Math.random()*(max+2-min)+min); | |
let word = ''; | |
while (word.length < length) { | |
word += letters[Math.floor(Math.random()*letters.length)]; | |
} | |
return word; | |
} |
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
export default function randomBigInt(max) { | |
const segment = Number.MAX_SAFE_INTEGER; | |
const bigSegment = BigInt(segment); | |
const maxArray = []; | |
for (let bigMax = BigInt(max), zero = 0n; bigMax > zero; bigMax /= bigSegment) { | |
maxArray.unshift(Number(bigMax % bigSegment)); | |
} | |
const superSum = (a, b) => a * bigSegment + b; | |
return function() { | |
let unlimited = false; |
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 { getOptions } from 'loader-utils'; | |
import CSS from 'css'; | |
import XRegExp from 'xregexp'; | |
export default function cssPrefixLoader(content) { | |
const { prefix, ...options } = getOptions(this); | |
let ast = CSS.parse(content); |
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 { getOptions } from 'loader-utils'; | |
import XRegExp from 'xregexp'; | |
import toSource from 'tosource'; | |
export default function ejsLoader(content) { | |
let options = getOptions(this); | |
let [source, ...imports] = compileEjs(content, options); | |
return ( |
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 script reads the nearby global.d.ts file and exports a list of imports as | |
an object. Imports need to follow the same structure as the example below. This | |
script only works with default exports but could be modified to use named | |
exports instead. | |
Example: | |
`global.d.ts` |
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 zipMin(...iterators) { | |
let done = iterators.length === 0; | |
iterators = iterators.map(iterator => iterator[Symbol.iterator]()); | |
return { | |
[Symbol.iterator]() { | |
return this; | |
}, | |
next(...args) { | |
let value = []; | |
for (let i = 0, length = iterators.length; i < length; i++) { |
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
// ==UserScript== | |
// @name Auto TTS | |
// @namespace larryc5 | |
// @version 0.1 | |
// @description Automatically reads messages in a chatroom page. (i.e. Picarto, Twitch, Youtube, etc.) | |
// @author Larry Costigan <[email protected]> | |
// @match https://picarto.tv/chatpopout/*/public | |
// @require https://code.jquery.com/jquery-latest.min.js | |
// @grant GM_setValue | |
// @grant GM_getValue |
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
export default function floorMod(a, b) { | |
return a - Math.floor(a / b) * b; | |
} |
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 path = require('path'); | |
const fs = require('fs').promises; | |
const md5 = require('md5'); | |
const uuid = require('uuid/v5'); | |
const argv = require('yargs') | |
.strict() | |
.usage('$0 <files...>', 'Rename files to their md5 value.', (yargs) => { | |
yargs.positional('files', { | |
describe: 'The files that will be renamed.', | |
type: 'array' |
NewerOlder