diff --git a/changelog b/changelog index 1cdfa9d..8eadf40 100644 --- a/changelog +++ b/changelog @@ -1,17 +1,17 @@ -2024-02-18: Cleaned up header css, added changelog. -2024-02-24: Made dir_index.html slightly less cursed server side -2024-04-10: Fix albert hacking my website by rewriting the entire backend (lol) -2024-04-12: Add "natalie-sightings.html" -2024-04-14: Add "cool-sites.html", update home.html to actually be html compliant, updated comment system, add 88x31 collection, minor modification to "natalie-info.html". -2024-04-25: Move hosting to server taken from school basement, (somewhat notable) -2024-04-26: Updated server-migration.html, site-info.html. -2024-05-03: Added link to blog page in home.html, added random statement to home page upon each load -2024-05-11: Rewrote the webserver code, again. Fixed a few things in home.html. +2024-02-18: cleaned up header css, added changelog. +2024-02-24: made dir_index.html slightly less cursed server side +2024-04-10: fix albert hacking my website by rewriting the entire backend (lol) +2024-04-12: add "natalie-sightings.html" +2024-04-14: add "cool-sites.html", update home.html to actually be html compliant, updated comment system, add 88x31 collection, minor modification to "natalie-info.html". +2024-04-25: move hosting to server taken from school basement, (somewhat notable) +2024-04-26: updated server-migration.html, site-info.html. +2024-05-03: added link to blog page in home.html, added random statement to home page upon each load +2024-05-11: rewrote the webserver code, again. Fixed a few things in home.html. 2024-05-19: update theme to be in compliance with new laptop. depricate laptop page -2024-07-06: Now supports http and https. This creates a race condition in theory. Don't care +2024-07-06: now supports http and https. this creates a race condition in theory. don't care 2024-07-09: updated natalie-info.html at the request of cinnabar, who was annoyed at the small number of incorrect things 2024-07-18: create & add header to all pages, changes to css so as to scale with vw -2024-07-24: Append to list of interesting sights, add page complaining about discord +2024-07-24: append to list of interesting sights, add page complaining about discord 2024-07-24: add thoughts page in /html/, update natalie info page 2024-07-24: updated wording in site-info.html, add /stats/ routes, update home.html to make filetree hidden by default because it is big 2024-07-25: rewrite css because winter told me to. Now has dark mode based on a media query. @@ -19,7 +19,7 @@ 2024-07-26: add git.natalieee.net 2024-07-26: update site-info.html 2024-07-26: I have a dns server now. oops. there go my sleeping plans. email me if you want to use it for some insane reason. -2024-07-27: Update style on non blog posts +2024-07-27: update style on non blog posts 2024-07-27: modernize /html/site-info.html, finally 2024-07-27: improve image accessibility, update blog posts to be compliant with new style 2024-07-28: add support for planned footer in all relevant html documents, simplify inclusion of other documents in a document using include script @@ -36,3 +36,4 @@ 2024-09-05: hopefully? fix issue with natalie-info.html, update home.html 2024-09-07: add additional random homepage statements 2024-09-07: add license, finally; edit site-info +2024-09-12: update style.css to support syntax highlighting diff --git a/html/thoughts/python-goto b/html/thoughts/python-goto new file mode 100644 index 0000000..29b0fa8 --- /dev/null +++ b/html/thoughts/python-goto @@ -0,0 +1,170 @@ + + +python is extremely extensible, though I'm not sure that is intentional. +
+from goto_label import * +count = 0 +#LABEL lol +print('this prints twice') +count += 1 +goto &lol if (count <= 1) else goto &goto_statements_are_a_perfectly_reasonable_thing_to_have_in_python + +#LABEL last_print +print('this prints last') +goto &stop + +#LABEL ellipsis +print('at least Ellipsis() has some use now, for normal reasons that make sense') +goto &last_print + +#LABEL goto_statements_are_a_perfectly_reasonable_thing_to_have_in_python +print('I am sure this is how the variety of language features I am abusing were intended to be used') +goto &ellipsis +#LABEL stop +... + ++its beautiful.
+this prints twice +this prints twice +I am sure this is how the variety of language features I am abusing were intended to be used +at least Ellipsis() has some use now, for normal reasons that make sense +this prints last ++
+import sys, inspect + +debug = False + +def prepare_labels(fp, scope): + with open(fp, 'r') as f: + lines = f.readlines() + + for lineno, line in enumerate(lines): + if line.startswith('#LABEL'): + # 1 + 1, first to account for 0 index then to account for comment line + scope.__setitem__(line.split(' ')[1].strip(), type( + 'label', + (object,), + dict(line=lineno+2) + )()) + +_goto = type('goto', (object,), dict(__and__=lambda _, other: _goto(other.line))) + +goto = _goto() + +def _goto(lineno): + if debug: print(lineno) + frame = sys._getframe().f_back.f_back + called_from = frame + + def hook(frame, event, arg): + if event == 'line' and frame == called_from: + try: + frame.f_lineno = lineno + except ValueError as e: + print("jump failed:", e) + while frame: + frame.f_trace = None + frame = frame.f_back + return None + return hook + + while frame: + frame.f_trace = hook + frame = frame.f_back + sys.settrace(hook) + +prepare_labels(inspect.stack()[-1].frame.f_code.co_filename, inspect.stack()[-1].frame.f_globals) + ++
+from goto_label import * + +def fib(n): + depth = 0 + a = 1 + b = 0 +#LABEL fib_start + print(a) + a, b, depth = b, b + a, depth + 1 + if depth > n+1: goto &fib_end + goto &fib_start +#LABEL fib_end + ... + +fib(20) + ++
+from goto_label import * + +def fizzbuzz(n): + count = 0 +#LABEL fizz_start + str = '' + if n == count: goto &fizz_end; + count += 1 + if count % 3 == 0: goto &fizz; +#LABEL buzz_check + if count % 5 == 0: goto &buzz; + goto &output; + +#LABEL fizz + str += 'fizz' + goto &buzz_check; +#LABEL buzz + str += 'buzz' +#LABEL output + print(str if str else count) + goto &fizz_start; +#LABEL fizz_end + ... + +fizzbuzz(100) + ++