Skip to content

Instantly share code, notes, and snippets.

@trevyn
trevyn / main.rs
Created November 25, 2024 11:27
w/ scraper 0.20
use scraper::{Html, Selector};
use std::fs;
use std::path::{Path, PathBuf};
fn process_html_file(file_path: &Path, doc_dir: &Path) {
let relative_path = file_path.strip_prefix(doc_dir).unwrap_or(file_path);
println!("----- {}", relative_path.display());
let html = match fs::read_to_string(file_path) {
Ok(content) => content,
<canvas id="myCanvas" width="2048" height="2048" style="border:1px solid #000000;"></canvas>
<input type="range" min=0 max=20000 value=100 style="width:1000px" oninput="gain=this.value">
<script>
var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
c.style.width = "1024px";
c.style.height = "1024px";

Philosopher AI

The first line below (in italics) is the prompt I gave to OpenAI's GPT-3. Along the way, I made sure to re-prompt GPT-3 by prepending each run with "Philosopher AI:". This helps to keep it from rambling, and start a fresh thought.

After about the first ten quotes, we started appending a few words to the prompt to get more specific answers. All generated content is in bold, to distinguish it from the prompts.

Most of these are first tries. I removed one due to repetition, and one due to being off-topic. Otherwise success rate has been incredibly high (>90%).


@trevyn
trevyn / react-beautiful-dnd+13.0.0.patch
Created August 30, 2020 10:03
`patch-package` file to eliminate `react-beautiful-dnd` drag start delay on iOS
diff --git a/node_modules/react-beautiful-dnd/dist/react-beautiful-dnd.esm.js b/node_modules/react-beautiful-dnd/dist/react-beautiful-dnd.esm.js
index 20c6acf..11de6c0 100644
--- a/node_modules/react-beautiful-dnd/dist/react-beautiful-dnd.esm.js
+++ b/node_modules/react-beautiful-dnd/dist/react-beautiful-dnd.esm.js
@@ -6043,7 +6043,7 @@ function useKeyboardSensor(api) {
var idle$2 = {
type: 'IDLE'
};
-var timeForLongPress = 120;
+var timeForLongPress = 0;
@trevyn
trevyn / automata.clj
Created April 1, 2020 11:45 — forked from juskrey/automata.clj
Clojure POP3 server automata definition
(ns sentinel.pop3.automata
(:require [instaparse.core :as insta]
[clojure.java.io :as io]
[clojure.string :as s]
[sentinel.auto :refer [fsm automate]]
[taoensso.timbre :as timbre]
[sentinel.address :as address]
[sentinel.db.main :as db-main]
[buddy.hashers :as hashers]
[amazonica.aws.s3 :as s3])
@trevyn
trevyn / auto.clj
Created April 1, 2020 11:45 — forked from juskrey/auto.clj
Clojure FSM sample
(ns sentinel.auto
(:require [taoensso.timbre :as timbre]
[clojure.core.match.date :refer :all]
[clojure.core.match :refer [match]]
[clojure.core.match.regex :refer :all]
[clojure.string :as st]
[clojure.core.async :refer [chan close! buffer go-loop to-chan <! >! >!! <!!] :as async]
[clojure.core.async.impl.protocols :as impl]
[clojure.spec.alpha :as s]
[clojure.core.async :as async]))
[TestFlight takeOff:@"<team token>"];
NSString *device= [[UIDevice currentDevice] uniqueIdentifier];
[TestFlight setDeviceIdentifier:device];
TFLog(device);