Skip to content

Instantly share code, notes, and snippets.

@metanomial
metanomial / prompt.txt
Created February 22, 2023 18:35
Joey GPT Prompt
Imagine there is an "#introductions" channel in a Discord server for music lovers. A user with the name "Joey" and a crop of an acoustic guitar for a profile picture joins the server and posts a paragraph long introduction in that channel. They use a bit of internet slang, start sentences with lower case, and do not capitalize the word "I". Write an example introduction that Joey might write. Write seven followup comments Joey might write in response to posted music they like, and one response to a posted song they especially didn't like from an artist they love.
@metanomial
metanomial / nimi-ken-ale.ts
Last active January 16, 2022 10:48
Toki Pona word generator
// Caution: combinatorial explosion will eat your harddrive
const MAX_SYLLABLE_COUNT = 4;
const OUTPUT_FILE = `${MAX_SYLLABLE_COUNT}-syllables.txt`;
// deno-fmt-ignore
const syllables = [
"a", "e", "i", "o", "u",
"ja", "je", "jo", "ju", "ka",
"ke", "ki", "ko", "ku", "la",
"le", "li", "lo", "lu", "ma",
@metanomial
metanomial / validate.js
Last active January 16, 2022 11:35
Toki Pona Phonotactic Validation Regular Expression
/^(?:(?:[k-nps]?[aeiou]|[jt][aeou]|w[aei])(?:(?:n?[klps]|[mn])[aeiou]|n?[jt][aeou]|n?w[aei])*n?)|n$/
@metanomial
metanomial / SketchSystems.spec
Last active February 16, 2021 20:24
TweetNFT Bot
TweetNFT Bot
Idle*
mention invokation -> Investigate Reply Status
scheduled minting -- 72 hours -> Fetch OEmbed
Investigate Reply Status
invoking tweet is not a reply -> Must Be Reply Error
invoking tweet is a reply -> Investigate Context
Must Be Reply Error
error message sent -> Store Message ID
error message failed -> Log Critical Failure
@metanomial
metanomial / simple.svg
Created September 5, 2020 07:25
Squared Circles
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
const Ω = new Proxy(new WeakMap, {
set (weakmap, reference, input) {
const invocable = eval(reference);
if (typeof invocable != 'function') return;
weakmap.set(invocable,
Array.isArray(input)
? invocable(...input)
: invocable(input)
);
},
/**
* Integer n-th root
* @param value Radicand value
* @param degree Root degree
*/
function nroot (value: bigint, degree: bigint) {
if (value < 1n) throw new RangeError('🗞️');
let [ u, s ] = [ value, value + 1n ];
while (u < s) [ u, s ] = [ ((degree - 1n) * u + value / (u ** (degree - 1n))) / degree, u ];
return s;
const fibonacci = lucas(0, 1);
const dataset = Array(79)
.fill()
.map(_ => fibonacci.next().value);
let generation = 0;
let population = Array(10000)
.fill()
.map(_ => Array(4).fill().map(_ => Math.random() * 10 - 5))
.map(evalFitness);
@metanomial
metanomial / Code.gs
Last active February 7, 2020 01:53
Google Sheets as JSON Log
function doPost(e) {
if(e.postData == null) return output({ error: 'no_data' });
try {
const entries = JSON.parse(e.postData.contents);
if(!Array.isArray(entries)) return output({ error: 'not_array' });
if(!entries.length) return output({ error: 'empty_array' });
entries.forEach(append);
return output({ success: entries.length });
} catch(exception) {
return output({
@metanomial
metanomial / Code.gs
Last active February 5, 2020 07:16
Google-Sheets-as-Database Search Interface
/**
@OnlyCurrentDoc
**/
function doGet(e) {
var template = HtmlService.createTemplateFromFile('Index');
const catalog = SpreadsheetApp.getActiveSheet().getRange('<set range>').getDisplayValues();
template.catalog = JSON.stringify(catalog);
const output = template.evaluate();
output.setTitle('<enter title here>');