This file contains hidden or 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 argparse | |
import asyncio | |
import ctypes | |
import concurrent | |
from contextlib import AsyncExitStack, ExitStack, asynccontextmanager, closing, contextmanager | |
import csv | |
import functools | |
import inspect | |
import logging | |
import os |
This file contains hidden or 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
# https://github.com/hexpm/hex/pull/727#issuecomment-3165170464 | |
export HEX_UNSAFE_HTTPS=1; |
This file contains hidden or 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
defmodule Foo.SimpleRNG do | |
def new(), do: new(:crypto.strong_rand_bytes(16), 0) | |
def new(<<seed::binary-size(16)>>), do: new(:aes_128_ctr, seed, 0) | |
def new(<<seed::binary-size(32)>>), do: new(:aes_256_ctr, seed, 0) | |
def new(cipher, <<seed::binary>>) when is_atom(cipher), do: new(cipher, seed, 0) | |
def new(<<seed::binary-size(16)>>, ctr) when is_integer(ctr), do: new(:aes_128_ctr, seed, ctr) | |
def new(<<seed::binary-size(32)>>, ctr) when is_integer(ctr), do: new(:aes_256_ctr, seed, ctr) | |
@spec new(cipher :: :crypto.cipher_iv, crypto_seed :: binary, ctr_start :: non_neg_integer) :: :rand.state | |
def new(cipher, seed, ctr) |
This file contains hidden or 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 TZLETTER = new Map([ | |
[0, "Z"], | |
[60, "N"], | |
[120, "O"], | |
[180, "P"], | |
[210, "P30"], | |
[240, "Q"], | |
[300, "R"], | |
[360, "S"], | |
[420, "T"], |
This file contains hidden or 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
{ | |
// File > Preferences > Settings > User > Terminal > Integrated > Env | |
"terminal.integrated.env.windows": { | |
"GIT_EDITOR": "code -w" | |
} | |
} |
This file contains hidden or 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
p code, code[role=presentation] { | |
font-size: 1.140625em; | |
} |
This file contains hidden or 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
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/escape#return_value | |
const NEEDS_ESCAPE = new RegExp("(^[0-9A-Za-z]|[,-=<>#&!%:;@~'`\"])|([\\^\\$\\\\\\.\\*\\+\\?\\(\\)\\[\\]\\{\\}\\|\\/])|([\\t\\f\\n\\v\\r\\x20])|(\\s(?<![\\u0000-\\u007f]))|([\\ud800-\\udbff](?=$|[^\\udc00-\\udfff])|[\\udc00-\\udfff](?<=^.|[^\\ud800-\\udbff].))", "gs"); | |
const CHAR_ESCAPES = { "\u0009": '\\t', "\u000c": '\\f', "\u000a": '\\n', "\u000b": '\\v', "\u000d": '\\r', "\u0020": '\\x20' }; | |
function _escape(m, hex, backslash, ascii_whitespace, nonascii_whitespace, lone_surrogate) { | |
if (hex !== undefined) | |
return `\\x${hex.charCodeAt(0).toString(16).padStart(2, "0")}`; | |
if (backslash !== undefined) | |
return `\\${backslash}`; | |
if (ascii_whitespace !== undefined) |
This file contains hidden or 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>(async (currentScript) => { // scoped to this IIFE, does not pollute global namespace or vanish on future event loop ticks | |
// You are 100% free to do async stuff in this block | |
await new Promise(window.requestAnimationFrame); | |
window.alert(currentScript); | |
// ... // | |
})(document.currentScript).then((value) => {if (value !== undefined) console.debug(value);}, (error) => {console.error(error); debugger;});</script> |
This file contains hidden or 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
/** | |
* A nonnegative integer. | |
* @typedef {number} NaturalNumber | |
*/ | |
/** | |
* Datatype representing a polynomial as an array of coefficients. | |
* e.g. "5X^3 + X + 2" is represented by [2, 1, , 5]. | |
* e.g. "0" is represented by []. | |
* Must have no trailing zeroes. Array slots containing 0 are equivalent to empty (sparse) array slots. |
This file contains hidden or 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
/* | |
* Calculate the number of days since the start of the Gregorian calendar. | |
* @param {Date} [date] - The reference date. Defaults to the current instant. | |
* @param {boolean} [useLocalTime] - Whether to calculate in local time. WARNING: By default, UTC is used; this will, for instance, give a Tuesday result when run at 10pm on a Monday in the United States. | |
* @returns {number} | |
*/ | |
export function gregorianDateInteger(d, useLocalTime) { | |
if (d === undefined) d = new Date(); | |
if (useLocalTime === undefined) useLocalTime = false; |
NewerOlder