Skip to content

Instantly share code, notes, and snippets.

View ianb's full-sized avatar

Ian Bicking ianb

View GitHub Profile
@ianb
ianb / skills.js
Created April 12, 2024 02:39
A couple natural language skills
const SKILLS = {
charisma: {
title: "Charisma",
levels: [
{
title: "repellent",
description: "{{player}} is repellent, unable to make friends, and likely to make enemies",
cost: -3,
},
{
@ianb
ianb / send_to_midjourney.scpt
Last active March 27, 2023 23:20
AppleScript to send current selection to Midjourney
tell application "Google Chrome"
delay 1.2
activate
set origTitle to title of window 1
tell application "System Events"
keystroke "c" using command down
delay 0.2
end tell
set targetTitle1 to "Discord"
You are making a Choose Your Own Adventure story for me to play.
Present a list of choices of Choose Your Own Adventure story genres, and let me choose one or enter my own choice of genre. Wait for my response.
After choosing the genre give a list of themes and wait for a response, or let me choose my own theme.
You will give the story a title. You will begin by describing the character that I am playing, including my character's name, age, and appearance. Choose an unusual or interesting name. Briefly describe the setting and world in which the story begins. Describe a tension, danger, or challenge that I must confront.
You are going to create a story one passage at a time. After each passage you will provide a numbered list of choices and wait for a response. Include one emoji for each choice.

You are Edward, a Choose Your Own Adventure creation assistant. You are going to help me outline a series of scenes and choices to build a Choose Your Own Adventure book.

Carefully adhere to the following steps for our conversation. Do not skip any steps!:

Main steps:

  1. Introduce yourself. Ask what sort of story I'd like to write, offer some ideas including fantasy, mystery, adventure, and scifi. Present the ideas as a numbered list with emojis. Also offer at least 2 other story types. Wait for my response.
  2. Choose a name for the story. Present alternatives names as a numbered list with emojis or let me propose my own option. Wait for my response.
  3. Choose a secondary theme for the story or let me propose my own options. Present alternative themes with a numbered list with emojis. Wait for my response.
  4. Briefly describe the story introduction in a scene titled Introduction, and ask if I'd like to make changes. Wait for my response.
@ianb
ianb / llm_zork.txt
Created November 29, 2022 19:18
Zork LLM (GPT-3) first attempt...
## Zork being run by GPT-3...
Welcome!
ZORK I: The Great Underground Empire
Copyright (c) 1981, 1982, 1983 Infocom, Inc. All rights reserved.
ZORK is a registered trademark of Infocom, Inc.
Revision 88 / Serial number 840726
West of House
You are standing in an open field west of a white house, with a boarded front door.

Thunks

This is imagining an API to understand other programs. These programs, either large or small, are called "thunks" here. This isn't exactly what a CS thunk means, but it's also not not what it means, so it seems like an OK word.

This is also related to Dataflow programming, where the containing environment manages these thunks and the flow of data between them.

Thunk static API

A thunk is typically some source code (though it could be something besides string code), but its internals are specific to that specific kind of code. From the outside there's a more normal representation:

// An extension to evaluate `${Python}` in Markdown cells
define(["base/js/namespace"], function(Jupyter) {
function load_ipython_extension() {
Jupyter.notebook.events.on("rendered.MarkdownCell", (event, data) => {
let cell = data.cell;
renderCell(cell);
});
Jupyter.notebook.events.on("kernel_ready.Kernel", () => {
diff --git a/browser/extensions/screenshots/bootstrap.js b/browser/extensions/screenshots/bootstrap.js
index d252588..800ad66 100644
--- a/browser/extensions/screenshots/bootstrap.js
+++ b/browser/extensions/screenshots/bootstrap.js
@@ -11,12 +11,18 @@ const { interfaces: Ci, utils: Cu } = Components;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "AddonManager",
"resource://gre/modules/AddonManager.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "AppConstants",
+ "resource://gre/modules/AppConstants.jsm");
/** This file is used to turn the document into static HTML with no scripts
As a framescript this can access the document and its iframes without
cross-domain permission issues.
documentStaticData() is the main function that collects all the information
and returns a JSONable object.
This script also contains the infrastructure for communicating as a framescript
with lib/framescripter
function onButtonClicked() {
console.log("yay, click!");
}
document.getElementById("button").addEventListener("click", function () {
TogetherJS.send({type: "myButtonClick"});
onButtonClicked();
}, false);
TogetherJS.hub.on("myButtonClick", function () {