Skip to content

Instantly share code, notes, and snippets.

@nathanielbd
nathanielbd / typeracer.js
Created June 8, 2020 23:25
Script for trolling on typeracer.com
var unselectables = document.querySelectorAll("[unselectable='on']");
var text;
for (var i = 0; i < unselectables.length; i++) {
text += unselectables[i].textContent;
}
text = text.replace("undefined", "");
var j = 0;
document.querySelector(".txtInput").addEventListener("mousemove", function() {
document.querySelector(".txtInput").value += text[j];
j++;
@nathanielbd
nathanielbd / skribbl.js
Last active June 13, 2020 05:19
Scripts for trolling on skribbl.io
// guess from a database of words by matching regex
// CTRL-SHIFT-i, copy-paste into console, press `ENTER`:
// ---BEGIN---
var guesser = null;
function cheat() {
var url = "https://skribbliohints.github.io/words.json";
var guesses = [];
var i = 0;
fetch(url)
.then(res => res.json())
@nathanielbd
nathanielbd / morsecode.js
Last active July 9, 2020 21:23
Script for typing on morsecode.me
// CTRL-SHIFT-i, copy and paste into the console, hit `ENTER`:
// You can now focus on the screen and type
// ---BEGIN---
var table = Object.fromEntries(Object.entries(Translator.alphabet()).map(([k, v]) => ([v, k])))
var button = document.getElementById("key");
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
async function dit() {
$(button).trigger("mousedown");
@nathanielbd
nathanielbd / protobowl.js
Created July 29, 2020 21:26
Scripts for trolling on protobowl.com
// Escalate to ninja privileges
// pressing 'f' and 'd' will answer a question correctly
go.id = "_";
// reveal the answer every two seconds
// found in the obfuscated client app code
setInterval(tt, 2000);
// display the answer in the console
// found under window global variables
@nathanielbd
nathanielbd / keybase.md
Created September 29, 2020 16:17
keybase.md

Keybase proof

I hereby claim:

  • I am nathanielbd on github.
  • I am nathanielbd (https://keybase.io/nathanielbd) on keybase.
  • I have a public key ASAZendYsSbxeurhss5-TTdu3jVNG2YmaX0LMaIubYZAbAo

To claim this, I am signing this object:

@nathanielbd
nathanielbd / slowsort.py
Created December 30, 2020 20:33
A reluctant sorting algorithm
# https://www.mipmip.org/tidbits/pasa.pdf
# Pessimal Algorithmsand Simplexity Analysis. Broder, Stolfi
def helper(A, i, j):
# in-place sort the subarray A[i],...,A[j] using multiply-and-surrender
if i >= j:
return
m = (i+j)//2
helper(A, i, m)
helper(A, m+1, j)
if A[m] > A[j]:
@nathanielbd
nathanielbd / perceptron.py
Created January 8, 2021 23:43
Animate the perceptron algorithm with Manim
#!/usr/bin/env python
# See the result: https://nathanielbd.github.io/Perceptron.mp4
from manimlib.imports import *
class Perceptron(GraphScene):
CONFIG = {
"x_min": -1.5,
"x_max": 1.5,
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nathanielbd
nathanielbd / bowditch.py
Created October 30, 2021 18:51
Manim animations to build intuition for Bowditch-Lissajous curves
from manim import *
class BowditchParametric(Scene):
def construct(self):
x_circle = Circle(radius=1.5).move_to(2*UP)
y_circle = Circle(radius=1).move_to(4*LEFT+2*DOWN)
x_dot = Dot(x_circle.point_from_proportion((2*PI-PI/9)/(2*PI)), radius=0.08, color=YELLOW)
y_dot = Dot(y_circle.point_from_proportion(0), radius=0.08, color=YELLOW)
self.t_offset = 0
rate = 0.25
@nathanielbd
nathanielbd / wordle.js
Last active February 11, 2022 07:24
Fail at Wordle by guessing words that give you all grey letters!
// CTRL-SHIFT-i
// Copy-paste this code into the console and enter
// Use the outputted words as your guesses
let solution = JSON.parse(localStorage.getItem("nyt-wordle-state")).solution;
let wordlist = ["cigar", "rebut", "sissy", "humph", "awake", "blush", "focal", "evade", "naval", "serve", "heath", "dwarf", "model", "karma", "stink", "grade", "quiet", "bench", "abate", "feign", "major", "death", "fresh", "crust", "stool", "colon", "abase", "marry", "react", "batty", "pride", "floss", "helix", "croak", "staff", "paper", "unfed", "whelp", "trawl", "outdo", "adobe", "crazy", "sower", "repay", "digit", "crate", "cluck", "spike", "mimic", "pound", "maxim", "linen", "unmet", "flesh", "booby", "forth", "first", "stand", "belly", "ivory", "seedy", "print", "yearn", "drain", "bribe", "stout", "panel", "crass", "flume", "offal", "agree", "error", "swirl", "argue", "bleed", "delta", "flick", "totem", "wooer", "front", "shrub", "parry", "biome", "lapel", "start", "greet", "goner", "golem", "lusty", "loopy", "round",