Skip to content

Commit c0ca0a1

Browse files
committed
updates
1 parent 97465c6 commit c0ca0a1

File tree

20 files changed

+309
-89
lines changed

20 files changed

+309
-89
lines changed

ai/books.org

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ https://github.com/iamtrask/grokking-deep-learning
6161
- home https://pragprog.com/titles/pplearn/programming-machine-learning/
6262
- forum https://devtalk.com/books/programming-machine-learning/
6363
- source https://github.com/nusco/progml-code
64+
- errata https://forum.devtalk.com/c/pragprog/pragprog-customers/85?tags=book-programming-machine-learning
6465
- bonus
6566
- chap 4 https://nusco.medium.com/of-gradients-and-matrices-1b19de65e5cd
6667
- chap 5 [[https://levelup.gitconnected.com/the-problem-with-accuracy-3670891b908e][The Problem with Accuracy]]
@@ -560,9 +561,11 @@ Test baseline is 90%. Manually guessed hyperparams.
560561
*** 7 the final challenge
561562
**** new encoding of labels
562563

563-
Label Encoding Problem: multiclass clasification
564+
Goal: recognize all digits.
564565

565-
Solution 1: run many "Weighted Sum Sigmoid" fns and return the one with highest chance.
566+
From _binary classification_ to a _multiclass clasification_ problem.
567+
568+
Solution 1: build a binary classifier for each digit and return the one with highest chance.
566569
Solution 2: we create a matrix of bitsets for the results (=One-Hot Encoding=). We have as many digits as classes.
567570

568571
We use this to initialize the training data.

ai/self.org

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@
9696

9797
* DataSets
9898

99+
- Fashion MNIST
100+
- CIFAR-10
101+
- contains forced aspect-ratio https://x.com/ID_AA_Carmack/status/1366627186732634115
99102
- https://github.com/shramos/Awesome-Cybersecurity-Datasets
100103
- https://en.wikipedia.org/wiki/List_of_datasets_for_machine-learning_research
101104
- https://en.wikipedia.org/wiki/List_of_datasets_in_computer_vision_and_image_processing
@@ -134,6 +137,8 @@
134137
Fanio=2025
135138
B1=
136139
#+end_src
140+
141+
** MNIST
137142
- https://en.wikipedia.org/wiki/MNIST_database
138143
- http://web.archive.org/web/20020622183530/http://yann.lecun.com:80/exdb/mnist/
139144
- Modified NIST (National Institute of Standards and Technology)
@@ -149,3 +154,20 @@
149154
- 60k labels
150155
- 10k images for testing
151156
- 10k labels
157+
- digits distribution https://www.researchgate.net/figure/Distribution-of-digits-in-MNIST-and-Farsi-handwritten-digit-datasets_tbl1_220464658
158+
|---+-------+-------|
159+
| N | train | test |
160+
|---+-------+-------|
161+
| 0 | 5923 | 980 |
162+
| 1 | 6742 | 1135 |
163+
| 2 | 5958 | 1032 |
164+
| 3 | 6131 | 1010 |
165+
| 4 | 5842 | 982 |
166+
| 5 | 5421 | 892 |
167+
| 6 | 5918 | 958 |
168+
| 7 | 6265 | 1028 |
169+
| 8 | 5851 | 974 |
170+
| 9 | 5949 | 1009 |
171+
|---+-------+-------|
172+
| T | 60000 | 10000 |
173+
|---+-------+-------|

challenges/protohackers.org

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,22 @@ home https://protohackers.com/
55
- https://gergely.imreh.net/blog/2022/09/programming-challenge-protohackers-3/
66
- https://geekingfrog.com/blog/post/protohackers-learnings
77
- tunnels
8-
- https://ngrok.com/
9-
- https://telebit.cloud/
8+
- many https://www.reddit.com/r/node/comments/yd99nb/alternatives_to_ngrok/
9+
- https://pinggy.io/
10+
- 60 minutes free tcp tunnels
11+
- eg: tcp://mfmek-201-212-28-49.a.free.pinggy.link:37861
12+
#+begin_src sh
13+
ssh -p 443 -R0:localhost:1234 [email protected]
14+
#+end_src
15+
- https://localtunnel.me/
16+
- http only (?)
17+
- https://tunnelin.com/
1018
- https://github.com/cloudflare/cloudflared
19+
- https://telebit.cloud/
20+
- fails to install (capabilities drop error)
21+
- https://ngrok.com/
22+
- don't work with SmokeTest (?)
23+
- requires credit card for tcp
1124

1225
* code
1326

challenges/self.org

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,7 @@
6161
- https://sadservers.com/
6262
- Terminal Skills
6363
- https://overthewire.org/wargames/bandit/
64+
- +https://cmdchallenge.com/+
65+
- +https://oops.cmdchallenge.com/+
66+
- +https://12days.cmdchallenge.com/+
67+
- source https://gitlab.com/jarv/cmdchallenge

languages/compiled/ml/futhark/self.org

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -296,13 +296,15 @@ Giving related functionality a common abstraction.
296296

297297
** stdlib
298298

299-
- https://futhark-lang.org/docs/prelude/doc/prelude/prelude.html
300299
- https://futhark-lang.org/docs/prelude/
300+
- https://futhark-lang.org/docs/prelude/doc/prelude/prelude.html
301+
- https://futhark-lang.org/docs/prelude/doc/prelude/math.html
302+
301303
- array operations
302-
- First Order Array Combinators:
304+
- First Order Array Combinators: https://futhark-lang.org/docs/prelude/doc/prelude/array.html
303305
- always perform the same operation
304-
- eg: zip/unzip
305-
- Second Order Array Combinators (SOACs)
306+
- eg: zip/unzip https://futhark-lang.org/docs/prelude/doc/prelude/zip.html
307+
- Second Order Array Combinators (SOACs) https://futhark-lang.org/docs/prelude/doc/prelude/soacs.html
306308
- take a functional argument
307309
- eg:
308310
- map (array transformer)
@@ -312,6 +314,8 @@ Giving related functionality a common abstraction.
312314
- is inclusive, it includes the final reduce in it's result
313315
- filter (cost is ~scan+map)
314316

317+
https://futhark-lang.org/docs/prelude/doc/prelude/functional.html
318+
315319
#+begin_src futhark
316320
val id '^a : a -> a -- identity function
317321
val const '^a '^b : a -> b -> a -- constant function
@@ -354,14 +358,15 @@ Giving related functionality a common abstraction.
354358
- a .fut(hark) program might contain a =test block=
355359
- entrypoint can be elided if it is "main"
356360
- futharkscript functions https://futhark.readthedocs.io/en/latest/man/futhark-literate.html
357-
|------------+--------+--------------+-------------------|
358-
| | | <c> | |
359-
| $loadimg | "file" | [][]u32 | row major ARGB |
360-
| $loaddata | "file" | t ¦ (t,t...) | |
361-
| $loadbytes | "file" | []u8 | |
362-
| $loadaudio | "file" | [][]f64 | a row per channel |
363-
| $restore | | | |
364-
|------------+--------+--------------+-------------------|
361+
|------------+----------+--------------+---------------------------|
362+
| | | <c> | |
363+
| $loadimg | "file" | [][]u32 | row major ARGB |
364+
| $loaddata | "file" | t ¦ (t,t...) | |
365+
| $loadbytes | "file" | []u8 | |
366+
| $loadaudio | "file" | [][]f64 | a row per channel |
367+
| $restore | "file" | v | laods file |
368+
| $store | "file" v | - | stores value in v in file |
369+
|------------+----------+--------------+---------------------------|
365370
- =input/output sets=
366371
- can be put on 1 line
367372
- no record or tuples are permitted

languages/interpreted/lisp/racket.org

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,7 @@ https://github.com/racket/racket/wiki/Frequently-Asked-Questions
99
CMSC 430: Design and Implementation of Programming Languages
1010
https://www.cs.umd.edu/class/fall2021/cmsc430/OCaml_to_Racket.html
1111
https://www.youtube.com/watch?v=xKCFkXUcmK4&list=PLsg0tbEwZlcxS17oqa-I4bmmhlvwkUlp6&index=1
12+
13+
#+begin_src sh
14+
raco exe -o ./bin/hello-from-racket ./hello.rkt
15+
#+end_src

languages/interpreted/red/self.org

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,40 @@
88
- tutorial https://redprogramming.com/Home.html
99
- tutorial https://www.red-by-example.org/
1010
- tutorial https://learnxinyminutes.com/docs/red/
11+
- reference https://static.red-lang.org/red-system-specs.html
12+
13+
* language
14+
15+
** types
16+
- use *as* for casting
17+
|-----------+-------------+----|
18+
| integer! | 23 -23 0Fh | 32 |
19+
| byte! | #"a" #"^A" | 8 |
20+
| float! | 1.0 1E3 | 64 |
21+
| float32! | | 32 |
22+
| logic! | true false | ? |
23+
| c-string! | "foo" {bar} | - |
24+
| struct! | | |
25+
| pointer! | | |
26+
|-----------+-------------+----|
27+
28+
- c-string
29+
- a null bytes gets added at the end
30+
- can be: length? or size?
31+
#+begin_src red
32+
foo: "bar" ; "bar"
33+
foo: foo + 1 ; "ar"
34+
#+end_src
35+
36+
37+
** variables / labels / identifiers
38+
39+
- case insensitive
40+
41+
#+begin_src red
42+
foo: 2
43+
foo: bar: 2 ; foo=2 bar=2
44+
#+end_src
45+
46+
* gotchas
47+
- no emacs support

languages/stack/factor/articles.org

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,16 @@
88
- 10 Factor's bootstrap process explained http://factor-language.blogspot.com/2010/01/factors-bootstrap-process-explained.html
99
- paper https://factorcode.org/littledan/dls.pdf
1010
- https://andreaferretti.github.io/factor-tutorial/
11+
- you should write code that does as little shuffling (dup,drop,swap) as possible
12+
- use common patterns, that are better abstracted away into their own words
13+
- both extremely *functional* (fn composition) and largely *imperative* describing operation on a global mutable stack
1114
- https://www.junglecoder.com/blog/factorlang-review
1215
- https://re.factorcode.org/
1316
- https://re.factorcode.org/2014/04/scraping-re-factor.html
17+
- tutorial
18+
- https://docs.factorcode.org/content/article-cookbook.html
19+
- https://docs.factorcode.org/content/article-first-program.html
20+
- https://docs.factorcode.org/content/article-tour.html
1421
- https://docs.factorcode.org/content/article-handbook-library-reference.html
1522
- 12 https://re-factor.blogspot.com/2012/08/literate-programming.html
1623
- book of articles

languages/stack/factor/self.org

Lines changed: 78 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,61 @@
1717

1818
- Stack is used to organize calls to words, NOT as a data structure.
1919
- No package manager.
20-
All libraries of the language are part of the Factor monorepo.
21-
Along with docs.
20+
- All libraries of the language are part of the Factor monorepo.
21+
- Along with docs.
22+
- all values are truthy, except "f"
2223

2324
- vocabularies: named set of words (me: libraries)
2425

26+
** types
27+
https://docs.factorcode.org/content/article-tuple-examples.html
28+
|-----------+---+----------------------------------------------------|
29+
| boolean | ? | t f |
30+
| lists | | { 0 1 2 3 } |
31+
| hashs | | H{ { "Perl" "L. Wall" } { "Factor" "S. Pestov" } } |
32+
| bytearray | | B{ 1 14 18 23 } |
33+
| range | | [0,b] |
34+
|-----------+---+----------------------------------------------------|
2535
** quotations
2636

2737
#+begin_src factor
2838
[ "Hello, World" print ]
2939
#+end_src
30-
- are unammed blocks of code
40+
41+
- https://docs.factorcode.org/content/vocab-fry.html
42+
- is a block of code
43+
- can be pushed to the stack as a value
3144
- you can ~call~ it
45+
|-------+----------------------|
46+
| call | a f -- (f a) |
47+
| dip | a b f -- (f a) b |
48+
| keep | a b f -- (f a b) b |
49+
| bi | a f g -- (f a) (g a) |
50+
| bi@ | a b f -- (f a) (f b) |
51+
| curry | a f -- [f a] |
52+
|-------+----------------------|
53+
54+
** conditionals
3255

56+
#+begin_src factor
57+
0 [] when ! when* leaves test value on stack, WHEN TRUE
58+
0 [] unless
59+
2 ["Two is true" .] ["Invalid" .] if
60+
#+end_src
61+
62+
** loops
63+
|--------------+----------+------------|
64+
| | | <c> |
65+
| times | n f | f0..fn |
66+
| each-integer | n f | f(0)..f(n) |
67+
| each | list f | |
68+
| map | list f | list' |
69+
| reduce | list n f | n' |
70+
| accumulate | list n f | list' n' |
71+
| replicate | | |
72+
| produce | n pred f | list |
73+
| while | n pred f | n' |
74+
|--------------+----------+------------|
3375
** words
3476

3577
#+begin_src factor
@@ -42,11 +84,31 @@
4284

4385
- new words are defined at parse time
4486
- stack effects are used, error is reported if wrong
87+
- modifiers: inline, recursive
4588

4689
- ~combinators~ are words that take quotations
4790
- eg: if, map
4891

49-
- those that manipulate the stack are called *shuffle words*
92+
- *parsing words*
93+
- commonly used to defining literals (eg: list, hash, bytearray)
94+
- interact with the parser
95+
- defined with *SYNTAX:*
96+
- eg: [ ] : ;
97+
98+
*** shuffling words
99+
- manipulate the stack
100+
|-------+-------+---------|
101+
| dup | x | x x |
102+
| drop | x | |
103+
| swap | x y | y x |
104+
| over | x y | x y x |
105+
| dupd | x y | x x y |
106+
| swapd | x y z | y x z |
107+
| nip | x y | y |
108+
| rot | x y z | y z x |
109+
| -rot | x y z | z x y |
110+
| 2dup | x y | x y x y |
111+
|-------+-------+---------|
50112

51113
* Standalone Executables
52114

@@ -62,12 +124,13 @@ https://concatenative.org/wiki/view/Factor/Deployment
62124
* libstdc++.so.6
63125
- does NOT support "stripping" with "strip"
64126
- single core compiler (?
65-
- ~8min in compile "tetris" example
66-
~3Mb
127+
- 35s in compile "hello world", 1.6Mb
128+
- 8min in compile "tetris", ~3Mb
67129

68130
** hello world
69131

70-
- Run in a directory above ~./hello/~
132+
- Binary at ./hello/hello
133+
- Run in a directory above ~./hello/~, in ~./~
71134
#+begin_src sh
72135
$ factor -roots=. -e='USING: namespaces tools.deploy tools.deploy.config ; "." deploy-directory set "hello" deploy'
73136
# 40 seconds
@@ -116,9 +179,13 @@ H{
116179
* libraries/vocabularies
117180

118181
- x11 example https://github.com/letoh/hello-x11-factor
182+
- json
183+
- https://docs.factorcode.org/content/article-json.html
184+
- https://docs.factorcode.org/content/vocab-json.html
119185
- all
120186
https://docs.factorcode.org/content/article-vocab-index.html
121187
https://docs.factorcode.org/content/article-handbook-library-reference.html
188+
- kernel https://docs.factorcode.org/content/vocab-kernel.html
122189
- ui examples https://docs.factorcode.org/content/article-ui.html
123190
- raylib https://github.com/ArnautDaniel/raylib-factor
124191
- https://github.com/ArnautDaniel/raylib-factor/blob/master/examples/piggy/piggy.factor
@@ -128,6 +195,10 @@ H{
128195
https://concatenative.org/wiki/view/Factor/Furnace
129196
https://docs.factorcode.org/content/vocab-furnace.html
130197

198+
* tools
199+
200+
- editor: emacs https://github.com/factor/fuel
201+
131202
* codebases
132203

133204
- ed(itor) clone https://github.com/zphixon/fed

languages/stack/factor/videos.org

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,10 @@
1+
- 25 | Reasons and Resources - Learning The Factor Programming Language https://www.youtube.com/watch?v=OvM1fygiShI
12
- 23 | Battle Snake |
23
- https://www.youtube.com/watch?v=sqHY3YDGj80
34
- https://www.youtube.com/watch?v=tPXAmEsS_6I
45
- https://www.youtube.com/watch?v=9cti_7OLrsw
56
- build an http service using *furnace*
67
- TODO 40:00
7-
* TODO 09 Factor | Doug Coleman
8-
9-
https://vimeo.com/6203360
10-
11-
#+begin_src factor
12-
3 weeks ago noon monday .
13-
USE: roman 2009 >roman .
14-
: average ( seq -- x )
15-
[ sum ] [ length ] bi / ;
16-
{ 1 2 3 4 } average .
17-
1 miles [ km ] undo >float .
18-
[ readln eval>string print t ] loop
19-
#+end_src
20-
218
* TODO 22 Factor | John Benediktsson & Doug Coleman
229

2310
https://www.youtube.com/watch?v=OLh61q4c4XE
@@ -52,6 +39,20 @@ https://www.youtube.com/watch?v=OLh61q4c4XE
5239
[ print ] each
5340
#+end_src
5441

42+
* TODO 09 Factor | Doug Coleman
43+
44+
https://vimeo.com/6203360
45+
46+
#+begin_src factor
47+
3 weeks ago noon monday .
48+
USE: roman 2009 >roman .
49+
: average ( seq -- x )
50+
[ sum ] [ length ] bi / ;
51+
{ 1 2 3 4 } average .
52+
1 miles [ km ] undo >float .
53+
[ readln eval>string print t ] loop
54+
#+end_src
55+
5556
* TODO 08 Factor: an extensible interactive language | Slave Pestov
5657

5758
https://www.youtube.com/watch?v=f_0QlhYlS8g

0 commit comments

Comments
 (0)