# 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 2642
# self = https://watcher.sour.is?uri=https://twtxt.net/user/adi/twtxt.txt&offset=742
# next = https://watcher.sour.is?uri=https://twtxt.net/user/adi/twtxt.txt&offset=842
# prev = https://watcher.sour.is?uri=https://twtxt.net/user/adi/twtxt.txt&offset=642
@movq What kind of laziness?
@movq I migrated to Void from Arch.
@mckinley Also, I believe Windows Subsystem for Linux is great. πŸ˜›
@mckinley I mostly run Windows Terminal and Chrome.
@eldersnake @movq @prologic Void Linux is my favorite linux.
@anth Haha! Awesome answer!
@prologic @movq All my laptops broke down, this is a borrowed laptop and I rather not change OS. I usually work via ssh. https://mkws.sh is an OpenBSD VPS hosted by http://openbsd.amsterdam/, I do most of my work there. I run another small Void Linux VPS. I'm not that hardcore. 😁
@prologic @movq All my laptops broke down, this is a borrowed laptop and I rather not change OS. I usually work via SSH. https://mkws.sh is a OpenBSD machine. I'm not that hardcore. 😁
@prologic @movq All my laptops broke down, this is a borrowed laptop and I rather not change OS. I usually work via ssh. https://mkws.sh is an OpenBSD VPS hosted by http://openbsd.amsterdam/. I run another small Void Linux VPS. I'm not that hardcore. 😁
@prologic @lyse Poor "monkeys" 😁
@adi @anth Never used Plan 9 @prologic? Feels like another planet. πŸ˜› Give it a go.
Ah, Windows has a built in emoji picker under Win+;.
@anth What browser are you using on Plan 9?
@mckinley Let me know how it goes.
@anth How did you figure out it's Linux and not BSD?
@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.
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:

$ /bin/sh -c "foo() {
       printf "Hello World"
}; foo"

You have the function definition there and the call which works.
When 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.
@prologic 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.
@prologic (#ipbjj5q) Is this a valid function definition? Are we allowed to define the body on the same line?


$ cat foo
foo() { printf "Hello World" }
$ sh foo
foo[1]: syntax error: 
{' unmatched



$ cat foo
foo() {
printf "Hello World"
}
$ /bin/sh -c "$(cat foo); foo"


Works well.


/bin/sh -c '$(cat foo); foo'


Doesn't.

 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?

t

f() {
uname
}


t2

#!/bin/sh

. ./t
f
ssh -T adi@REMOTE << EOF
$(cat t)
f
EOF
@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? πŸ˜›
@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 ? πŸ˜›
@adi @mckinley

> 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.

Is this pp ? πŸ˜› Did you get pp: Buffer overflow? πŸ˜›
@mckinley sed 's/"/'\\''/g' I guess for double quotes.
@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 @mckinley Take share/sitemap.uppxml:


<?xml version='1.0' encoding='UTF-8'?>
<urlset xmlns='http://www.sitemaps.org/schemas/sitemap/0.9'>
#!
for f in *.html
do
#!
<url>
        <loc>$1/$(basename "$f")</loc>
        <lastmod>$(lmt -f '%Y-%m-%dT%H:%M:%SZ' "$f" | cut -d' ' -f1)</lastmod>
        <priority>1.0</priority>
</url>
#!
done
#!
</urlset>


lmt 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 @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#!\nfind . -name '*.html' | while read f\ndo\n#!\n<url>\n        <loc>$1/$(basename "$f" | pe)</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 It's not great towards bad at editing HTML, but editing HTML is the exception, most of the times is 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 Point is some people would say add Markdown capabilities to the main binary, or add a web server, or add live reaload 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:


#!/bin/sh

export DEV=1

https &

find . -type f  -name 'mkws' -o -name '*.upp*' | entr ./bin/mkws https://mkws.sh


https is https://clbin.com/tIIMk, entr is http://eradman.com/entrproject/.
@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 distributed 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\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

> but it’d be cool to have just one file static linked executable that does it all.

Maybe 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:


ssh -T "$1" << EOF | uudecode
@prologic @adi Can't edit, uudecode not uuencode, this one:\n\n
\nssh -T "$1" << EOF | uudecode\n
@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 uudecode which is getting it's input from stdout.
@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:


tar -czf - ws.sh|uuencode "\$f"
>&2 printf "Writing %s\\n" "\$f"


>&2 printf "Writing %s\\n" "\$f" goes to stderr and doesn't interfere with uuencode which is getting it's input from stdout.
@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
@prologic Because I'm outputting it as "plain text".


ssh -T "$1" << EOF | uudecode
>&2 printf "Packing for %s\\n" "\$(uname)"
trap "rm -rf $tmp" EXIT INT HUP TERM
cd "$tmp"
...
f=mkws-"\$(uname | tr '[:upper:]' '[:lower:]')"@"$(echo "$5"| tr _ .)".tgz
tar -czf - ws.sh|uuencode "\$f"
>&2 printf "Writing %s\\n" "\$f"
EOF
}
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?