Skip to content

Instantly share code, notes, and snippets.

@beala
beala / gist:02029db2d50adee897919034802ab348
Created March 24, 2023 06:56
ChatGPT Plugins Monty Fall Monte Carlo
{
"input": "
(* Define a function to simulate one round of the game *)
simulateRound[] := Module[{doors, carPosition, initialChoice, revealedDoor, switchChoice},
doors = {\"Goat\", \"Goat\", \"Goat\"};
carPosition = RandomInteger[{1, 3}];
doors[[carPosition]] = \"Car\";
initialChoice = RandomInteger[{1, 3}];
revealedDoor = RandomChoice[DeleteCases[Range[3], {initialChoice, carPosition}]];
switchChoice = DeleteCases[Range[3], {initialChoice, revealedDoor}][[1]];
gf has covid [0.95]:
friend has covid [0.14]: true
~friend has covid: false
~gf has covid:
friend has covid [0.02]: true
~friend has covid: false
@beala
beala / concede.yaml
Last active October 27, 2020 14:29
Forecast for https://www.metaculus.com/questions/5356/2020-us-election-concession/ using a small tool for summing the interesting paths in a probability tree.
biden wins [0.85]:
biden large win [0.47]:
results before deadline [0.90]:
trump concedes [0.75]: true
~trump concedes: false
~results before deadline:
trump concedes [0.01]: true
~trump concedes: false
biden moderate win [0.3]:
results before deadline [0.80]:

This question focuses on New York City, which has seen both a reduction in cases from a peak of 6368 confirmed cases on April 6th, and widespread protesting, with the first protests beginning on May 28th. New York City has not entered phase one of reopening, but is slated to begin on June 8th.

This question asks what the average of confirmed new cases per day will be for June 15th to June 21st (7 days, inclusive of both endpoints) as calculated from values in this CSV file in the CASE_COUNT column. The values will be read two weeks later, on July 5th at 10 AM MST to account for reporting lag. If the numbers are not available, or the github repository no longer exists, the question will resolve ambi

@beala
beala / extract.md
Last active April 27, 2020 20:08
Worldometers Country Data Extractor

What is this

This bookmarklet extracts data from worlometers country pages into a downloadable csv file.

Installation

To install it:

  1. If your bookmarks bar is hidden, display it: Ctrl + Shift + b.
  2. Copy the following code into your clipboard. You'll need it in a sec.
@beala
beala / Config
Last active December 16, 2017 21:23
Use Dhall (https://hackage.haskell.org/package/dhall-1.8.2/docs/Dhall-Tutorial.html) and dhall-text (https://github.com/dhall-lang/dhall-text) to generate a training script for tensorflow training.
-- Type decl for parameters to the training script.
{ architecture : Text
, learningRate : List Double
, steps : List Natural
, unknownPercent : Natural
, windowStrideMs : Natural
, startingCheckpoint: Optional Natural
}

Yosemite Valley Sep 3d 1843

Dear Sister Sarah,

I have just returned from the longest & hardest trip I have ever made in the mtns., having been gone over five weeks. I am weary but resting fast, Sleepy but sleeping deep & fast, hungry but eating much – For two weeks I explored the glaciers of the summits east of here, sleeping among the snowy mtns without blankets & with but little to eat on account of its being so inaccessible. After my icy experiences it seems strange to be down here in so warm & flowery a climate.

I will soon be off again determined to use all the season in prosecuting my researches — will go next to Kings river a hundred miles south, then to Lake Tahoe & adjacent mtns. & in winter work in Oakland with my pen. The Scotch are slow but some day I will have the results of my mountain studies in a form in which you all will be able to read & judge of them. In the mean time I write occaisonally for the Overland Monthly but neither these magazine articles nor my first book will form any fini

@beala
beala / TreeRotation.idr
Created March 5, 2017 05:24
Proving some properties of binary trees and rotation in idris.
{-
In this file I:
- Define a binary tree.
- Define a type level predicate for right rotation of a tree. That is, this type
can only be instantiated for trees that can be right rotated.
- Prove that it's decidable if a tree can be right-rotated or not.
- Prove that right-rotating a tree preserves in-order traversal.
-}
-- A binary tree.
@beala
beala / ¯|_(ツ)_|¯.scala
Created June 17, 2016 02:37
I've been using Scala for years and I have no idea how inheritance works. http://docs.scala-lang.org/tutorials/FAQ/initialization-order.html
class C {
val a: Int = 1
val b: Int = a + 10
}
class B extends C {
override val a: Int = 100
}
println(s"a = ${new B().a}")
@beala
beala / Cryptol.agda
Last active June 14, 2016 17:50
A runnable implementation of the "Cryptol view" from the "Power of Pi": http://www.cs.ru.nl/~wouters/Publications/ThePowerOfPi.pdf I also attempted to implement part of SHA-1.
open import Data.Vec hiding (take; drop; [_]; split)
open import Data.Nat using (_*_; ℕ; zero; suc; _+_)
open import Data.Fin using (Fin; _≤_; compare; toℕ)
open import Relation.Binary.Core using (_≡_; refl)
open import Relation.Binary.PropositionalEquality using (cong)
import Data.Bool.Base as B using (if_then_else_; Bool; _∧_; true; false)
-- A runnable implementation of the "Cryptol View" from "The Power of Pi"
-- by Nicolas Oury and Wouter Swierstra with an implementation of SHA-1