From da2ed09c19d7f434ac20783f0082a0627f7a5800 Mon Sep 17 00:00:00 2001 From: Rusty Striker Date: Sat, 11 Jun 2022 18:32:15 +0300 Subject: [PATCH] stories folder and injector story --- index.html | 11 ++-- stories/index.html | 18 +++++++ stories/injector.html | 121 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 144 insertions(+), 6 deletions(-) create mode 100644 stories/index.html create mode 100644 stories/injector.html diff --git a/index.html b/index.html index faf9850..8a2abec 100644 --- a/index.html +++ b/index.html @@ -1,10 +1,9 @@ cat $HOME/template/header.html | sed "s/__PAGE TITLE__/Rusty's website/" - -

- Folders: cd $CURRENT && ls */ -d | sed 's/\///' | python3 $HOME/bscripts/ls_to_a.py -
- Files: cd $CURRENT && ls *.html | python3 $HOME/bscripts/ls_to_a.py -

+

+ Folders: cd $CURRENT && ls */ -d | sed 's/\///' | python3 $HOME/bscripts/ls_to_a.py +
+ Files: cd $CURRENT && ls *.html | python3 $HOME/bscripts/ls_to_a.py +

Welcome, to my WEBSITE! diff --git a/stories/index.html b/stories/index.html new file mode 100644 index 0000000..d75cdd2 --- /dev/null +++ b/stories/index.html @@ -0,0 +1,18 @@ +cat $HOME/template/header.html | sed "s/__PAGE TITLE__/Stories/" + +

Stories

+
+

+ Random stories, either about things I make(programs, games, physical stuff), +
+ or about stuff that happens to me +

+

+ Stories: +
+ cd $CURRENT && ls *.html | python3 $HOME/bscripts/ls_to_a.py +

+
+ + +cat $HOME/template/footer.html diff --git a/stories/injector.html b/stories/injector.html new file mode 100644 index 0000000..54e5b6f --- /dev/null +++ b/stories/injector.html @@ -0,0 +1,121 @@ +cat $HOME/template/header.html | sed "s/__PAGE TITLE__/Injector/" +

+ Folders: cd $CURRENT && ls */ -d | sed 's/\///' | python3 $HOME/bscripts/ls_to_a.py +
+ Files: cd $CURRENT && ls *.html | python3 $HOME/bscripts/ls_to_a.py +

+ +

Injector

+

+ Source Code +

+ +
+

+ So, I have finally made the html "injector" I wanted to make for ages before + I could really start working on this website... +

+ I guess it ain't really an "Injector", but rather it detects a special <INJECT> tag + in html files, and replaces them in what lies between the opening and closing tag, + so something like: +
+ <INJECT>echo Hello world<∖INJECT> +
+ will result in the text: +
+ Hello world +
+ instead
+ which allows me to use bash and THE POWER OF UNIX TERMINAL + to auto update things on my website(like a unified header, footer and such). +

+ It also provides 3 env variables with useful values: +

+ This allows me to do stuff like injecting the files in the directory the current page sits in, + and, because it runs the command in bash, I also get to pipe it around,
+ letting me tranform the output of ls for example, to simple <a> tags using + + a simple python script + +
+ and a call to python3 + (the actual commands are in the top of the source code of this page for example) +

+
+
+

But, can't it leak critical information to the outside world?

+

+ I am not a security expert, but you have full control over the commands, + and they are run on the server/compiling machine during compile time +
+ so unless you let random people push compiling web pages, + it shouldn't have any risks involved. +

+ If your website is open source(like mine) or source available, +
+ well, +
+ you can just use commands that are in the same directory as the compiling websites + (like i keep the build scripts in the bscripts folder). +

+
+
+

The original plan

+

+ The original plan was different, I initially wanted a fully real time thingy, + with specific items in mind, +
+ and only yesterday(10/6/22) I decided to just have simple commands, +
+ which later(roughly 3 minutes after finishing the first draft) +
+ I decided to make into a bash commands, to better have what I aimed for +

+
+
+

Rust can be annoing sometimes

+

+ Rust can be a bitch when it comes to handling strings, + especially when you compare it to C, +
+ where every string is a byte array, and you just handle it as such... +

+ Yes, I know this is due to characters not being uniform in length when using UTF-8, +
+ and I know that C can fuck everything up if you dont watch out for multiple length bytes, +
+ but it's just soo easy destroying strings there and you can just manipulate a string so easily, +
+ without any extra functions or allocations or anything really... +

+
+
+

Still glad I used Rust

+

+ I'm kind of a Rust fanboy(catgirl), + because it lets you not worry about a lot of things, + and mostly because of it STRONG type system, + so it aint a surprise I used it +
+ (and glad because of it) +

+

+ The repetuar of my languages isn't big, it's actually kinda small, + I know Rust well, I can do C quite easily(although I will need a lot of debugging), + I have a lot of experience with C#, and can do JavaScript, Java(tho not really), Python + and probably some more but very slowly.also want to rely on it less and less +
+ (i can also do GDScript if you consider it, as it can only run, afaik, in Godot) +

+

+ So it is usually either using Rust, or C, since I will (hopefully) + wont use python for something big(more than 50 lines of code), + and C# feels locked away on linux(and I don't want to use it outside of work). +

+ +cat $HOME/template/footer.html