# I am the Watcher. I am your guide through this vast new twtiverse.
# 
# Usage:
#     https://watcher.sour.is/api/plain/users              View list of users and latest twt date.
#     https://watcher.sour.is/api/plain/twt                View all twts.
#     https://watcher.sour.is/api/plain/mentions?uri=:uri  View all mentions for uri.
#     https://watcher.sour.is/api/plain/conv/:hash         View all twts for a conversation subject.
# 
# Options:
#     uri     Filter to show a specific users twts.
#     offset  Start index for quey.
#     limit   Count of items to return (going back in time).
# 
# twt range = 1 2159
# self = https://watcher.sour.is?uri=https://f.adi.onl/user/adi/twtxt.txt&offset=659
# next = https://watcher.sour.is?uri=https://f.adi.onl/user/adi/twtxt.txt&offset=759
# prev = https://watcher.sour.is?uri=https://f.adi.onl/user/adi/twtxt.txt&offset=559
@anth I ment the swallow effect. There's no need for text-mode graphics.
Guys, how do you use emojis here, I copy&paste them from https://emojipedia.org/, is there a better way?
@anth Nice choice of emojis! 😁
@prologic Happy you're happy! πŸ˜„
@prologic Awesome! Thanks! 😎
If you benefited from any of my work remember to Buy my a computer partπŸ’», I've got my eyes on a Pinebook Pro! πŸ˜›
@lobste_rs Pretty cool, but maybe Plan9 does it better?
@prologic Just woke up β˜• but it's 4 PM. πŸ˜€
@adi I'm going to sleep.
@adi Have no idea what it does to the rest of the file, on my system when having a correct command on the first line there, it just executes it and outputs the rest of the file as it is. Then it goes to the foo function call which is also not found because again there's no foo command anywhere, because the function definition wasn't parsed correctly earlier as preferred.
When calling $ /bin/sh -c "$(cat foo); foo", the $(cat foo) part is evaluated in the outer sh process, so the actual argument your sh invocation is getting is:\n
\n$ /bin/sh -c "foo() {\n       printf "Hello World"\n}; foo"\n
\nYou have the function definition there and the call which works.\nWhen calling $ /bin/sh -c '$(cat foo); foo', the $(cat foo) part is evaluated in your sh process, so what's actually happening is $(cat foo) is trying to interpret the first "command" from the foo file, foo() which is obviously not found.
@adi @prologic No, it's not a newline issue.
@prologic (#ipbjj5q) Is this a valid function definition? Are we allowed to define the body on the same line?\n\n
\n$ cat foo\nfoo() { printf "Hello World" }\n$ sh foo\nfoo[1]: syntax error: 
{' unmatched\n
\n\n
\n$ cat foo\nfoo() {\nprintf "Hello World"\n}\n$ /bin/sh -c "$(cat foo); foo"\n
\n\nWorks well.\n\n
\n/bin/sh -c '$(cat foo); foo'\n
\n\nDoesn't.\n\n I guess is how newlines are processed inside double quotes as opposed to single quotes.
@mckinley Do you have your sources somewhere? I understand you'd rather not escape manually and still write "normal" html, with unescaped double quotes and special characters ? Can't you just run a few seds on those html files and maybe create some temp files and pass those files to ./share/l.upphtml in the mkws main script?
@prologic I run my 'local' commands over SSH also? I remember researching this, also did some research now, seems that you can only do this with bash https://stackoverflow.com/questions/22107610/shell-script-run-function-from-script-over-ssh or something like this I guess with temp files? https://serverfault.com/questions/649359/executing-local-function-code-on-a-remote-server/686082?\n \nt\n
\nf() {\nuname\n}\n
\n\nt2\n
\n#!/bin/sh\n\n. ./t\nf\nssh -T adi@REMOTE << EOF\n$(cat t)\nf\nEOF\n
@mckinley If and when you're willing to take another look, maybe we could do it together? πŸ˜ƒ
@adi @mckinley \n\n> After that, I tried to use a program bundled with someone else's shell script site generator to make my own, but I couldn't get around one of the absurd limitations of the original generator. I eventually conceded that I would have to drastically change the formatting of my website and continued working, and I very quickly ran into either a bug that I couldn't fix because I don't know C, or (more likely) an even more absurd limitation that I don't care to conform to.\n\nIs this pp ? πŸ˜› Did you get pp: Buffer overflow? πŸ˜›
@mckinley sed 's/"/'\\''/g' I guess for double quotes.
@adi @bml @prologic @eldersnake @mckinley Take share/sitemap.uppxml:\n\n
\n<?xml version='1.0' encoding='UTF-8'?>\n<urlset xmlns='http://www.sitemaps.org/schemas/sitemap/0.9'>\n#!\nfor f in *.html\ndo\n#!\n<url>\n        <loc>$1/$(basename "$f")</loc>\n        <lastmod>$(lmt -f '%Y-%m-%dT%H:%M:%SZ' "$f" | cut -d' ' -f1)</lastmod>\n        <priority>1.0</priority>\n</url>\n#!\ndone\n#!\n</urlset>\n
\n\nlmt is scripted in there, also in ./share/l.upphtml. You can script lmt also in your Atom Feed. pp is called all over the place.
@adi @bml @prologic @eldersnake The idea of having split binaries is that you can call them in your templates. @mckinley What characters? What kind of escaping?
@bml @prologic @eldersnake Going to leave the tree, I understand how a single binary is The Holy Grail, I don't believe it's harder to use because the binaries are split. You run a single command mkws, the rest are dependencies. You don't run those manually and you can script them in your templates. Makes sense to call pp $anotherfile than singlebinary render $anotherfile I guess.
@adi @prologic @eldersnake @bml You may say I'm not distributing single static binaries, but that's exactly what I'm doing! πŸ˜›
@prologic @eldersnake @bml I refuse to build an entr in my static site generator for instance, entr does its job very well. Also another thttpd or some other webserver or some weird websocket JavaScript live reload mechanism or another markdown processor when we have smu, cmark, lowdown, all of these with a lengthy set of switches and knobs on a single binary.
@prologic I refuse to install "apps" that I have to access "locally" via a web browser.
@adi @prologic @eldersnake @bml What's your opinion @bml on the issue?
@prologic @eldersnake @bml And then people will ask for Markdown support in that single binary, and live reload, and a webserver. There's Hugo for that. Maybe Hugo is better.
@prologic He just has to run this command wget -O - https://mkws.sh/mkws@4.0.8.tgz | tar -xzvf -.
@prologic @bml @eldersnake @adi But if I build a single binary it would hold pp and lmt. I really refuse to build another static site generator that has a webserver inside.
@prologic @bml @adi @eldersnake Is distributing a tree such a bad idea?
@adi @eldersnake @prologic @bml So either have pp, lmt, mkws symlinks linking to one mkws main binary, or call one mkws main binary with the arguments mkws pp, mkws lmt, mkws main?. Or just build a single binary with arguments like "everybody" does it.
@prologic Aaaah, busybox style, but then we'd have symlinks, @bml @eldersnake.
@adi @bml tilde.institute runs OpenBSD other tildes run Linux, not sure if there are any other BSD ones, have no idea what tilde.club runs but they're homepage is awesome. https://tildeverse.org/
@prologic 404 πŸ˜›
@bml tilde.institute is pretty cool, admins install packages on demand or do system configurations. It's pretty unrestrictive.
@bml http://rw.rs/ is kinda slow for me over SSH.
I wonder what OS http://tilde.club/ is running.
@bml "adi" is not available on http://sdf.org/, I have https://adi.tilde.institute/ and http://rw.rs/~adi/.
@bml @prologic Simplicity
@prologic It's not great towards bad at editing HTML, but editing HTML is the exception, most of the times it's just text.
@prologic That would be great! Point is, I believe sh is a good fit as a templating language, it was built for massaging text, that's what templating languages mostly do.
@prologic How would that work? What would I embed?
@prologic @bml Not sure if in the main package, might add a tools, plugins or extensions section to the website. Also, you can check out some stuff from here also https://adi.tilde.institute/, linters and cl, cbl and fl which are CLI log "analytics" tools: unique, visits, referers etc. Might rewrite them in C not sure, but awk fits the bill pretty well. Some tinkering required for now.
@adi @bml @prologic Point is some people would say add Markdown capabilities to the main binary, or add a web server, or add live reload to the main binary. I kept it as simple as possible, I don't believe I really have to combine everything in a single executable, a tree is not bad.
@adi @bml @prologic My ./share/l.upphtml file is https://clbin.com/phoub, where l.js is https://livejs.com/. This gives me a live reload env.
@bml @prologic @adi Anyway, here's another idea, I have a ./bin/d script for development:\n\n
\n#!/bin/sh\n\nexport DEV=1\n\nhttps &\n\nfind . -type f  -name 'mkws' -o -name '*.upp*' | entr ./bin/mkws https://mkws.sh\n
\n\nhttps is https://clbin.com/tIIMk, entr is http://eradman.com/entrproject/.
@bml @prologic My idea was to use the mkws script for customization. pp, lmt and mkws could be combined in a single shell file via shar but that would give a complicated main mkws script I guess or combine them all in a single static binary but that would mean being unable to customize the mkws script. Anyway, give it a spin and let me know how it works.
@adi @bml @prologic In my case, a single static executable would combine pp and lmt I guess?
@bml @prologic\n\n> but it’d be cool to have just one file static linked executable that does it all.\n\nMaybe yes, maybe no. It would complicate some stuff, like customization, you would have to add config files, all is a broad scope. My idea was to distribute a full tree to and from which you can add/extract stuff to your preference. Read this also https://twtxt.net/conv/hvygjbq. There are also other static site generators who deliver a single static executable, hugo, zola, `saait`.
@bml @prologic Thanks for explaining! 😁 Regarding binaries in shell not sure about distributing something like this: https://clbin.com/Z7pvr.
@adi @bml Also let us know the address of your blog.
@adi @bml It's possible but not pretty, explore it yourself also. 😁
@bml It is possible to have all files in a single sh file via https://man.openbsd.org/shar. I'll have to explore this.
@prologic @adi Can't edit, uudecode not uuencode, this one:\n\n
\nssh -T "$1" << EOF | uudecode\n
@adi @bml @prologic Can @bml see my replies, if not please ping him?
@adi @bml Regarding the blog, maybe you can read this conv https://twtxt.net/conv/cqzsjsq.
@prologic Also check out:\n\n
\ntar -czf - ws.sh|uuencode "\\$f"\n>&2 printf "Writing %s\\\\n" "\\$f"\n
\n\n>&2 printf "Writing %s\\\\n" "\\$f" goes to stderr and doesn't interfere with uuencode which is getting it's input from stdout.
@bml I don't believe it's possible. 4.0.9 is identical to 4.0.8. It's a bug.
@prologic Because I'm outputting it as "plain text". \n\n
\nssh -T "$1" << EOF | uudecode\n>&2 printf "Packing for %s\\\\n" "\\$(uname)"\ntrap "rm -rf $tmp" EXIT INT HUP TERM\ncd "$tmp"\n...\nf=mkws-"\\$(uname | tr '[:upper:]' '[:lower:]')"@"$(echo "$5"| tr _ .)".tgz\ntar -czf - ws.sh|uuencode "\\$f"\n>&2 printf "Writing %s\\\\n" "\\$f"\nEOF\n}\n
Ok, migrating http://adi.tilde.institute/ to https://github.com/egoist/hack, it starting to look great.
@jlj @darch That Ubuntu colorscheme is really nice, however I'm going to use https://github.com/egoist/hack for https://adi.tilde.institute.
Nice theme https://github.com/guneysus/gohugo-hacker !
For compiling mkws's binaries on OpenBSD and Linux I run a set of commands via ssh, create a binary archive, pipe it to uuencode on the remote server and pipe it back to uudecode locally. Great use case for uuencode and uudecode pair.
@prologic @eldersnake Haha, well, just hacking around I guess.
@prologic But it's kinda silly given how most phones support web browsing. Why would you post via SMS? Is it faster? Maybe...
@prologic @eldersnake I might spin up a pod at some point, I have a lot of work to do tho, I don't want to manage a pod now, I would like to buy a domain at some point, I would like maybe to manage a Romanian pod but for now it's convenient I agree.
@prologic Guess you could use something like this to self host https://projects-raspberry.com/call-text-using-raspberry-pi-gsm-module/
@prologic @eldersnake @xuu \n\n> I hope to see more pods\n\nWhat's preventing you from getting more pods?
@eldersnake Depends on what you understand by Suckless.
@lobste_rs Nice!
@adi (#hvygjbq) @eldersnake Check this out ^ Of course you can install the dependencies on the server also but it's not always viable as there is no package.json or requirements.txt or something similar.
I'm getting lots of 404 page not found, what's the deal?
The recommended way to distribute dependencies with your mkws websites is to bundle them as static binaries so you don't have to run any package manager on the server side either. So, if your website uses smu, distribute a statically compiled smu in your website's ./bin directory. The recommended way of doing this is to do a make install PREFIX=/path/to/mkws/website/root. Make sure the -static flag is set. That way you will also get the man pages installed in the ./share/man directory.
@eldersnake @adi Take a look at https://imagemagick.org/script/command-line-processing.php for image processing.
Btw, you can shellcheck your pp templates via pp -d docs.upphtml | shellcheck -s sh -.
@eldersnake Yeah, that awk script is a thing of beauty. 😁
@adi @eldersnake I wonder how mkws would handle 217 articles. πŸ˜€
@eldersnake What's the format of the articles? Markdown?
@adi @eldersnake You could use https://forestry.io/ as a frontend. I personally don't believe I would do it but it fits a blog well.
@adi @eldersnake I guess the _correct_ name is mkws the site's name is mkws.sh.
@eldersnake \n\n> I hope to convert it over to something like mkws.sh\n\nAnd what's preventing you?
@eldersnake I'm not that good at writing so not sure if good or bad idea, not sure if the first paragraph would fit as a description and also read "normally" within the text.
@eldersnake But you can parse either the filename or the file itself to get titles for instance without a meta file and maybe use my first paragraph as description suggestion?
@darch Not bad! Is that the same CSS framework?
@niplav Makes sense, probably because of the of male inclination for tech also, men are a lot more seen as explorers, risk takers (<-- one of the reasons I believe they live less πŸ˜›)
@prologic Sounds good! How can I get one? πŸ˜„
@niplav @jlj What suffering?
@bml Yeah, read that also and believed it's pretty interesting. That format is a little bit weird tho.
> Covid: Japan asks China to stop anal tests on its citizens\n\nhttps://www.bbc.com/news/world-asia-56245404\n\nWasn't aware this was a thing.
@prologic @movq It's Duke Nukem 3D.
@adi @prologic @movq How about https://www.webmproject.org/ a file format?
@prologic @movq Video plays well, played little Duke Nukem myself at a class mate's house. I got a computer "later".
@adi @eldersnake I get the updated field with lmt https://mkws.sh/lts.html wherever it's a good idea to have. (sitemap, atom feed)
@eldersnake \n\n
\n<h1>Blog</h1>\n<h2>News and a collection of tips and tricks for <code>mkws</code></h2>\n<ol id=i>\n#!\nfind p -mindepth 1 | sort -r | while read -r f\ndo\ntest "${f##*.}" == "html" && continue;\nt=$(echo "${f##*/}" | cut -c21-)\n#!\n<li>\n<h2><a href=p/$(echo "$t" | pe).html>$t</a></h2>\n<time>$(echo "${f##*/}" | cut -c1-10 )</time>\n</li>\n#!\ndone\n#!\n</ol>\n
\n\nI have yet to come up with a solution for the description meta but I might formulate the first paragraph to be a good description, I'd rather not use any front matter.
@adi @eldersnake Nvm, I missed your answer, they're good for generating links.
@bml I sometimes watch https://www.youtube.com/user/marquesbrownlee, https://www.youtube.com/user/LinusTechTips, https://www.youtube.com/channel/UCeeFfhMcJa1kjtfZAGskOCA, https://www.youtube.com/user/Techquickie.
@eldersnake Did you check those url encoding utilities?
@eldersnake Thanks! @bml Yeah, please check it out, let me know if you have any questions.
@darch @lyse @antonio @jlj @prologic Thanks for the invite but I'll have to skip, I prefer text these days, I'll comment on your documents if it's the case.
This is how I store my blog posts:\n\n
\n$ ls -1\n2021-02-28 15:34:42 Welcome\n2021-02-28 15:35:21 How to add a navigation menu\n2021-02-28 15:35:39 How to add custom titles\n
@gr0k @darch Cool site indeed, might be interested in my static site generator http://mkws.sh/. There was a twtxt integration floating around, I'll post it if you're interested.