Skip to content

Instantly share code, notes, and snippets.

View matthen's full-sized avatar

Matt Henderson matthen

View GitHub Profile
@matthen
matthen / numerals.nb
Last active April 20, 2024 19:44
Chinese numerals
characters = {"一", "二", "三", "四", "五", "六", "七", "八", "九", "十", "十一",
"十二", "十三", "十四", "十五", "十六", "十七", "十八", "十九", "二十", "二十一", "二十二",
"二十三", "二十四", "二十五", "二十六", "二十七", "二十八", "二十九", "三十", "三十一",
"三十二", "三十三", "三十四", "三十五", "三十六", "三十七", "三十八", "三十九", "四十",
"四十一", "四十二", "四十三", "四十四", "四十五", "四十六", "四十七", "四十八", "四十九",
"五十", "五十一", "五十二", "五十三", "五十四", "五十五", "五十六", "五十七", "五十八",
"五十九", "六十", "六十一", "六十二", "六十三", "六十四", "六十五", "六十六", "六十七",
"六十八", "六十九", "七十", "七十一", "七十二", "七十三", "七十四", "七十五", "七十六",
"七十七", "七十八", "七十九", "八十", "八十一", "八十二", "八十三", "八十四", "八十五",
"八十六", "八十七", "八十八", "八十九", "九十", "九十一", "九十二", "九十三", "九十四",
@matthen
matthen / hello_world.py
Last active April 26, 2024 12:17
Hello world in python, using genetic algorithm
"""Hello world, with a genetic algorithm.
https://twitter.com/matthen2/status/1769368467067621791
"""
import random
import time
from dataclasses import dataclass
from itertools import chain
from typing import Iterable, List
smoothstep[t_, t0_, t1_] :=
With[{tt = (t - t0)/(t1 - t0)},
If[tt < 0, 0, If[tt > 1, 1, 6 tt^5 - 15 tt^4 + 10 tt^3]]];
a = 0.918;
p = ShearingMatrix[a, {1, 0}, {0, 1}].{Cos[th], Sin[th]}; \[Theta] =
ArcTan @@ Reverse[(p /. NMaximize[Norm[p], th][[2]])];
yscale = (RotationMatrix[\[Theta]].(p /. {th -> \[Theta]}))[[2]];
xscale = (RotationMatrix[\[Theta]].(p /. {th -> \[Theta] -
Pi/2}))[[1]];
\[Theta]2 = ArcTan @@ ((ScalingTransform[{(1/xscale) , (1/yscale) }].
python_binary(
name = "test_main",
main = "test_main.py",
deps = [":tensorflow"],
)
"""Third party python dependencies, installed using pip.
See README.md for help in constructing these rules.
We can make this file beautiful and searchable if this error is corrected: No tabs found in this TSV file in line 0.
AskReddit
politics
The_Donald
nba
worldnews
news
nfl
leagueoflegends
soccer
funny