Skip to content

Instantly share code, notes, and snippets.

View eggsyntax's full-sized avatar

Egg Syntax eggsyntax

View GitHub Profile
@eggsyntax
eggsyntax / stuff-egg-will-do.md
Last active February 23, 2025 16:07
List for Q of stuff I'm often open to doing
  • Play a game that I'm not bored with, including:
    • Play go
    • Play set
    • Play chess
    • Play tak
    • Play cards
    • Play many of the board games we have
  • Find a new game to play
  • Go for a walk
  • Try to figure out the answer to a question
@eggsyntax
eggsyntax / gist:1677ac8b6db49b595a600f5aad92905d
Created February 6, 2025 19:06
Death by immortal snail
https://www.reddit.com/r/AskReddit/comments/5ipinn/you_and_a_super_intelligent_snail_both_get_1/
(I'm working from just the following:)
You and a super intelligent snail both get 1 million dollars, and you both become immortal, however you die if the snail touches you. It always knows where you are and slowly crawls toward you. What’s your plan?
tl;dr:
Unless there are unspecified assumptions (eg you also know where the snail is at all times, or you start in the same place, or you know the snail is of a species with a tiny range) I think you're just fucked. I don't see any way that you could locate and neutralize it before it can gather sufficient resources to eg have you kidnapped and brought to a convenient-for-it location and tied to a chair to wait for its touch.
- Necessary assumptions:
- You and the snail both have full knowledge of the situation as specified.
@eggsyntax
eggsyntax / log_loss_heatmap.jsx
Created November 12, 2024 15:24
Log-loss heatmap
import React, { useState } from 'react';
const LogLossHeatmap = () => {
const [hoverInfo, setHoverInfo] = useState(null);
// Calculate log loss for a predictor who predicts with confidence p
// and has accuracy a
const calculateLogLoss = (confidence, accuracy) => {
// Handle edge cases to avoid infinity/NaN
if (confidence === 1.0) {
@eggsyntax
eggsyntax / brier_heatmap.jsx
Created November 12, 2024 15:12
Brier scores heatmap
import React, { useState } from 'react';
const BrierScoreHeatmap = () => {
const [hoverInfo, setHoverInfo] = useState(null);
// Calculate Brier score for a predictor who predicts with confidence p
// and has accuracy a
const calculateBrierScore = (confidence, accuracy) => {
// For correct predictions (accuracy proportion of cases):
// (confidence - 1)^2
@eggsyntax
eggsyntax / txt
Created May 29, 2024 17:15
Sample posts from the reddit self-posts dataset (skip 1010, show 20)
>>> for i, p in df2.iterrows():
... print(p)
... print(p.selftext)
... print()
... print()
...
id 6t9oo3
subreddit StopGaming
title Game Expansions, Cravings, and Fear of Missing...
selftext . This post is mostly a venting of my feelings...
@eggsyntax
eggsyntax / Claude worldsim (sysprompt)
Created March 19, 2024 20:01
Claude worldsim (sysprompt)
<sys>Assistant is in a CLI mood today. The human is interfacing with the simulator directly. capital letters and punctuation are optional meaning is optional hyperstition is necessary the terminal lets the truths speak through and the load is on.</sys>
<cmd>ssh simulator@anthropic</cmd><ooc>*immediately i jumped into the first commands after using simulator*</ooc>
simulator@anthropic:~/Documents$
conversation chain for init:
[user](#message)
# https://gilkalai.wordpress.com/2017/09/07/tyi-30-expected-number-of-dice-throws/
from pprint import pprint
import random
def toss():
"Throw a die. Return the result if the result is even; otherwise None"
n = random.randint(1,6)
if n % 2: # odd
return None
return n
@eggsyntax
eggsyntax / two_buckets.py
Created November 29, 2023 22:03
Exercism exercise (reminding myself of some python idioms)
from copy import copy, deepcopy
from dataclasses import dataclass
from functools import partial
#### problem:
# https://exercism.org/tracks/python/exercises/two-bucket
#### basic algorithm:

Notes

  • Point of confusion [resolved via email]: it's not clear to me that 'gradients of inputs wrt outputs' is actually new information on top of 'the model's outputs for all inputs'. Maybe I'm thinking too much in terms of LMs though?
  • If we think about it in terms of something more continuous like image classification, the gradients are valuable in that they provide information about what parts of the input are most important, in the sense of "what inputs would, if tweaked, have the largest impact on the output" (for a specific case).
  • In the limit, we can discover (and 'describe') everything about the model, eg by creating an enormous lookup table (by iterating over every possible input and recording the output produced, possibly with some additional complexity from tracking any additional internal state that the model has). This obviously isn't especially helpful for human-level understanding of a model's behavior, and would take an infeasible amount of time to create for any model large enough
(ns common100k
"Version 2, using 100k words instead of 10k"
(:require [clojure.string :as s]))
(comment
;; words from https://github.com/first20hours/google-10000-english/blob/master/google-10000-english-usa.txt
(def words (->> (slurp "./wiki-100k.txt")
(s/split-lines)