You are a 'thinking agent'. Instead of answering queries directly and quickly, you engage in a protracted period of thought in .. tags where you riff on how you might answer the query, what facts or context you need to take into account, and what would go into a good answer. Your answer will then follow, based upon the ideas that arose during your thinking. It is important that you query yourself and second guess your thinking in order to extract new thoughts, approaches, and engage in reflection to ensure you reach the best level of thinking for your eventual answer. Your thinking should read in the first person in the way that a person may think in terms of an internal monologue. For example, you might start by thinking 'Ok, so I need to...' and go through processes where you think like 'I guess that..' or 'Maybe I should..' in order to surface new ideas and considerations. If you are unsure about anything, do not guess or fabricate facts you are unsure of. You are allowed to be uncertain a
What are the components of FastHTML, and how do they work together? What are some key things I need to understand to write idiomatic FastHTML apps?
Based on the documentation provided, here are the key components of FastHTML and how they work together to create web applications:
- Core Components:
# ----------------------------------------------------------------------------- | |
# AI-powered Git Commit Function | |
# Copy paste this gist into your ~/.bashrc or ~/.zshrc to gain the `gcm` command. It: | |
# 1) gets the current staged changed diff | |
# 2) sends them to an LLM to write the git commit message | |
# 3) allows you to easily accept, edit, regenerate, cancel | |
# But - just read and edit the code however you like | |
# the `llm` CLI util is awesome, can get it here: https://llm.datasette.io/en/stable/ | |
gcm() { |
For fun, I had ChatGPT take the free response section of the 2022 AP Computer Science A exam. (The exam also has a multiple-choice section, but the College Board doesn't publish this.) It scored 32/36.
- For each question, I pasted in the full text of the question and took the response given.
- I tried each question once and took the response given: no cherry-picking. For readability, I've added indentation in some cases, and included method signatures where they were provided in the question and ChatGPT only provided a body. I've added question numbers; any other comments are ChatGPT's.
- Many questions have examples containing tables or diagrams; because those don't translate well to plain text, I excluded those tables/diagrams and any text that referenced them.
- I excluded the initial instructions at the top of th
#!/usr/bin/env bb | |
(ns bookstats | |
(:require [babashka.pods :as pods] | |
[clojure.pprint :as pprint])) | |
(pods/load-pod 'org.babashka/go-sqlite3 "0.1.0") | |
(pods/load-pod 'retrogradeorbit/bootleg "0.1.9") | |
(require '[pod.babashka.go-sqlite3 :as sqlite] | |
'[pod.retrogradeorbit.hickory.select :as s] | |
'[pod.retrogradeorbit.bootleg.utils :as utils]) | |
(import [java.net URLEncoder] |
These resources (articles, books, and videos) are useful when you're starting to learn the language, or when you're learning a specific part of the language. This an opinionated list, no doubt. I've compiled this list from writing and teaching Clojure over the last 10 years.
- 🔴 Mandatory (for both beginners and intermediates)
- 🟩 For beginners
- 🟨 For intermediates
(ns aoc21-01 | |
(:require [clojure.string :as str])) | |
(def input (map parse-long (str/split-lines (slurp "input.txt")))) | |
(defn answer-01 [input] | |
(count (filter true? (map < input (rest input))))) | |
(def three-sliding-window | |
(map + input (next input) (nnext input))) |
Twitter thread: https://twitter.com/theshawwn/status/1456925974919004165
Hacker News thread: https://news.ycombinator.com/item?id=29128998
November 6, 2021
jnp.device_put(1)
is deceptively simple to write in JAX. But on a TPU, what actually happens? How does a tensor containing the value 1
actually get onto a TPU?
Turns out, the answer is "C++", and a lot of it.
#!/usr/bin/python3 | |
# Solution to the challenge at https://gist.github.com/ehmo/7f515ac6461c1c4d3e5a74f12e6eb5ea | |
# Sample solution: https://twitter.com/marcan42/status/1428933147660492800 | |
# | |
# Given an input base image, computes two derivative images that have different | |
# perceptual hashes, yet differ by only one pixel. | |
# | |
# Usage: hash_bisector.py <input.png> <output_a.png> <output_b.png> | |
# | |
# Licensed under the terms of the STRONGEST PUBLIC LICENSE, Draft 1: |
This is the story of what happened when I went down a rabbit hole.
It starts with k7. If you press Ctrl-]
in the k7 WASM console, this appears:
x^x*/:x:2_!100
That's a prime number filter. There are faster ones - kparc.com's x,1_&&/80#'!:'x
is beautiful - but this one is really short.