Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/interplane-forge/blob/main/growth/g1prep.om # interplane-forge INTERPLANE Forge Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `interplane-forge / growth / g1prep.om` 781 lines ยท 11766 bytes Raw Blame History 1 note growth/g1prep.om: windowed clones, downloads and stars, seed-check history. 2 note Prefixes: fn gr*, global gg*, text tg*. Does not edit the counts journal. Reads it after fzsync. 3 note Trending window default 604800 s (7*86400, WolframLanguageEvaluator). Score = visitor git fetches 4 note plus visitor downloads plus net stars, all inside the window. Zero stays zero. Unknown is separate. 5 text tgwin "window" 6 text tgord "order" 7 text tgtr "trending" 8 text tgnw "new" 9 text tgtrp "/trending" 10 text tgtrj "/trending.json" 11 text tgins "/insights" 12 text tginj "/insights.json" 13 text tggdir "growth/" 14 text tgsdl "seeds.log" 15 text tgfmt "--format=%aN" 16 text tgdotj ".json" 17 text tgact "\"action\":\"" 18 text tgts "\"ts\":" 19 text tgtg "\"target\":\"" 20 text tgstar "star" 21 text tgunst "unstar" 22 text tgrad "rad:" 23 const ggwdef ulong 604800 24 const ggwmax ulong `315360000` 25 global ggwin ulong 1 26 global ggnow ulong 1 27 global ggw0 ulong 1 28 global ggord ulong 1 29 global ggcln ulong 256 30 global ggdlw ulong 256 31 global ggstw ulong 256 32 global ggstu ulong 256 33 global ggscr ulong 256 34 global ggix ulong 256 35 global gglst ulong 256 36 global ggslc ulong 256 37 global ggcon ulong 1 38 global ggcnn ulong 1 39 global ggctr ulong 1 40 global ggcnm uchar 3072 41 global ggcnl ulong 64 42 global ggpen ulong 1 43 global ggpmr ulong 1 44 global ggsrn ulong 1 45 global ggsep ulong 16 46 global ggsec ulong 16 47 global ggfts ulong 1 48 global ggln uchar 128 49 global ggll ulong 1 50 note ggjtr: 1 when the journal did not fit one read (fxo), so window numbers are not measured 51 global ggjtr ulong 1 52 fn grwnum n ulong to ulong 53 v = ulong 0 54 if eq n 0 55 ret 0 56 end 57 for i ulong n bound 12 58 c = get fval i 59 if or lt c 48 gt c 57 60 ret 0 61 end 62 v = add mul v 10 ulong sub c 48 63 end 64 ret v 65 end 66 fn greq t view uchar * n ulong to bool 67 if ne n len t 68 ret false 69 end 70 for i ulong n bound 16 71 if ne get fval i get t i 72 ret false 73 end 74 end 75 ret true 76 end 77 note grsetq: 0 ok (ggord 0 when order is absent), 400 when order or window is malformed 78 fn grsetq to long 79 put ggwin 0 ggwdef 80 n = fqget tgwin 81 if ge n 0 82 if or eq n 0 gt n 9 83 ret 400 84 end 85 w = grwnum ulong n 86 if or eq w 0 gt w ggwmax 87 ret 400 88 end 89 put ggwin 0 w 90 end 91 n = fqget tgord 92 if lt n 0 93 put ggord 0 0 94 ret 0 95 end 96 if greq tgtr ulong n 97 put ggord 0 1 98 ret 0 99 end 100 if greq tgnw ulong n 101 put ggord 0 2 102 ret 0 103 end 104 ret 400 105 end 106 fn grclock to void 107 put ggnow 0 div ulong realns `1000000000` 108 w = get ggwin 0 109 if gt w get ggnow 0 110 put ggw0 0 0 111 else 112 put ggw0 0 sub get ggnow 0 w 113 end 114 end 115 fn grinw ep ulong to bool 116 if lt ep get ggw0 0 117 ret false 118 end 119 ret le ep get ggnow 0 120 end 121 fn greol p ulong n ulong to ulong 122 j = p 123 while lt j n bound `16777216` 124 if eq get fxo j 10 125 ret j 126 end 127 j = add j 1 128 end 129 ret n 130 end 131 fn grpre p ulong t view uchar * to bool 132 if gt add p len t get fxol 0 133 ret false 134 end 135 for k ulong len t bound 32 136 if ne get fxo add p k get t k 137 ret false 138 end 139 end 140 ret true 141 end 142 fn grfind a ulong e ulong t view uchar * to ulong 143 if gt add a len t e 144 ret e 145 end 146 last = sub e len t 147 p = a 148 while le p last bound `16777216` 149 if grpre p t 150 ret p 151 end 152 p = add p 1 153 end 154 ret e 155 end 156 fn grrid i ulong a ulong n ulong to bool 157 if ne get fail i n 158 ret false 159 end 160 for k ulong n bound 64 161 if ne fridbyte i k get fxo add a k 162 ret false 163 end 164 end 165 ret true 166 end 167 fn grrix a ulong n ulong to ulong 168 if eq n 0 169 ret 9999 170 end 171 for i ulong get fan 0 bound FAMAX 172 if grrid i a n 173 ret i 174 end 175 end 176 ret 9999 177 end 178 fn grkind c uchar to ulong 179 if eq c 103 180 ret 0 181 end 182 if eq c 112 183 ret 1 184 end 185 if eq c 97 186 ret 2 187 end 188 if eq c 114 189 ret 3 190 end 191 ret 9 192 end 193 fn graddk i ulong k ulong to void 194 if eq k 0 195 put ggcln i add get ggcln i 1 196 end 197 if or eq k 2 eq k 3 198 put ggdlw i add get ggdlw i 1 199 end 200 end 201 note the scans of a journal or log line in this file step one byte inside fxo[.., e): their bound is 202 note the size of fxo. The lines are written by this server (20 digits, an id of 60 bytes at most), but a 203 note small bound would make a line edited by hand a trap 4 (exit 104). 204 fn grevent a ulong e ulong to void 205 if lt sub e a 6 206 ret 207 end 208 if ne get fxo a 101 209 ret 210 end 211 if ne get fxo add a 1 32 212 ret 213 end 214 k = grkind get fxo add a 2 215 if gt k 3 216 ret 217 end 218 if ne get fxo add a 3 32 219 ret 220 end 221 p = add a 4 222 q = p 223 while lt q e bound `16777216` 224 c = get fxo q 225 if or lt c 48 gt c 57 226 break 227 end 228 q = add q 1 229 end 230 if eq q p 231 ret 232 end 233 if ge q e 234 ret 235 end 236 if ne get fxo q 32 237 ret 238 end 239 ep = ulong 0 240 j = p 241 while lt j q bound `16777216` 242 ep = add mul ep 10 ulong sub get fxo j 48 243 j = add j 1 244 end 245 if not grinw ep 246 ret 247 end 248 r = add q 1 249 if ge r e 250 ret 251 end 252 i = grrix r sub e r 253 if ge i 9999 254 ret 255 end 256 graddk i k 257 end 258 note grlines: only the committed journal (up to fzjend); a torn last batch is not counted, as in counts.om 259 fn grlines to void 260 n = get fxol 0 261 if gt n get fzjend 0 262 n = get fzjend 0 263 end 264 p = ulong 0 265 while lt p n bound `16777216` 266 e = greol p n 267 grevent p e 268 p = add e 1 269 end 270 end 271 fn grclr to void 272 for i ulong FAMAX 273 put ggcln i 0 274 put ggdlw i 0 275 put ggstw i 0 276 put ggstu i 0 277 put ggscr i 0 278 end 279 end 280 fn grscan to void 281 grclr 282 put ggjtr 0 0 283 fzpath 3 0 284 r = frdall 285 if lt r 0 286 ret 287 end 288 if and eq get fxotr 0 1 gt get fzjend 0 get fxol 0 289 put ggjtr 0 1 290 end 291 grlines 292 end 293 note grwm: window counts of source s are measured (source read, whole journal read) 294 fn grwm s ulong to bool 295 if eq get fzsnc s 0 296 ret false 297 end 298 ret eq get ggjtr 0 0 299 end 300 fn gract a ulong e ulong to ulong 301 p = grfind a e tgact 302 if ge p e 303 ret 0 304 end 305 q = add p len tgact 306 if grpre q tgunst 307 ret 2 308 end 309 if grpre q tgstar 310 ret 1 311 end 312 ret 0 313 end 314 fn grts a ulong e ulong to ulong 315 p = grfind a e tgts 316 if ge p e 317 ret 0 318 end 319 q = add p len tgts 320 v = ulong 0 321 k = ulong 0 322 while lt q e bound `16777216` 323 c = get fxo q 324 if or lt c 48 gt c 57 325 break 326 end 327 v = add mul v 10 ulong sub c 48 328 q = add q 1 329 k = add k 1 330 end 331 if eq k 0 332 ret 0 333 end 334 ret v 335 end 336 fn grtgtr a ulong e ulong to ulong 337 p = grfind a e tgtg 338 if ge p e 339 ret 9999 340 end 341 q = add p len tgtg 342 if not grpre q tgrad 343 ret 9999 344 end 345 q = add q len tgrad 346 r = q 347 while lt r e bound `16777216` 348 if eq get fxo r 34 349 break 350 end 351 r = add r 1 352 end 353 if eq r q 354 ret 9999 355 end 356 ret grrix q sub r q 357 end 358 fn grsev a ulong e ulong to void 359 ts = grts a e 360 if and ne ts 0 eq get ggfts 0 0 361 put ggfts 0 ts 362 end 363 act = gract a e 364 if eq act 0 365 ret 366 end 367 if not grinw ts 368 ret 369 end 370 i = grtgtr a e 371 if ge i 9999 372 ret 373 end 374 if eq act 1 375 put ggstw i add get ggstw i 1 376 end 377 if eq act 2 378 put ggstu i add get ggstu i 1 379 end 380 end 381 fn grsoc to void 382 put ggfts 0 0 383 fpb 384 if gt get gsddl 0 0 385 put fpthl 0 0 386 for i ulong get gsddl 0 bound 512 387 fpc get gsdd i 388 end 389 end 390 fpt tslog 391 r = frdall 392 if lt r 0 393 ret 394 end 395 n = get fxol 0 396 p = ulong 0 397 while lt p n bound `16777216` 398 e = greol p n 399 grsev p e 400 p = add e 1 401 end 402 end 403 fn grnet i ulong to ulong 404 t = get ggstw i 405 u = get ggstu i 406 if gt t u 407 ret sub t u 408 end 409 ret 0 410 end 411 note grscore: each part counts only when measured (grwm, gsok); an unmeasured part adds nothing 412 fn grscore to void 413 wc = grwm 0 414 wd = grwm 2 415 for i ulong get fan 0 bound FAMAX 416 s = ulong 0 417 if wc 418 s = add s get ggcln i 419 end 420 if wd 421 s = add s get ggdlw i 422 end 423 if eq get gsok 0 1 424 s = add s grnet i 425 end 426 put ggscr i s 427 end 428 end 429 fn grnlt a ulong b ulong to bool 430 na = get fanl a 431 nb = get fanl b 432 n = na 433 if gt n nb 434 n = nb 435 end 436 for k ulong n bound 128 437 ca = frnbyte a k 438 cb = frnbyte b k 439 if lt ca cb 440 ret true 441 end 442 if gt ca cb 443 ret false 444 end 445 end 446 ret lt na nb 447 end 448 fn grtrn a ulong b ulong to bool 449 sa = get ggscr a 450 sb = get ggscr b 451 if gt sa sb 452 ret true 453 end 454 if lt sa sb 455 ret false 456 end 457 ret grnlt a b 458 end 459 fn grnew a ulong b ulong to bool 460 ta = get falct a 461 tb = get falct b 462 if gt ta tb 463 ret true 464 end 465 if lt ta tb 466 ret false 467 end 468 ret grnlt a b 469 end 470 fn grless a ulong b ulong to bool 471 if eq get ggord 0 2 472 ret grnew a b 473 end 474 ret grtrn a b 475 end 476 fn grswap j ulong to void 477 t = get ggix j 478 put ggix j get ggix sub j 1 479 put ggix sub j 1 t 480 end 481 fn grsift i ulong to void 482 j = i 483 while gt j 0 bound FAMAX 484 if grless get ggix j get ggix sub j 1 485 grswap j 486 j = sub j 1 487 else 488 ret 489 end 490 end 491 end 492 fn grsort to void 493 n = get fan 0 494 for i ulong n bound FAMAX 495 put ggix i i 496 end 497 for i ulong n bound FAMAX 498 grsift i 499 end 500 end 501 fn grlc c uchar to void 502 n = get ggll 0 503 if lt n len ggln 504 put ggln n c 505 put ggll 0 add n 1 506 end 507 end 508 fn grldec v ulong to void 509 d = new uchar 20 0 510 i = ulong 20 511 x = v 512 for it ulong 20 513 i = sub i 1 514 put d i uchar add rem x 10 48 515 x = div x 10 516 if eq x 0 517 break 518 end 519 end 520 for k ulong sub 20 i bound 20 521 grlc get d add i k 522 end 523 end 524 fn grmk to void 525 fpb 526 fpt tfdata 527 fpt tggdir 528 x = makedir fpth 0 get fpthl 0 448 529 end 530 fn grsdpath to void 531 fpb 532 fpt tfdata 533 fpt tggdir 534 fpt tgsdl 535 end 536 note grnote: append "s