💾 Archived View for rawtext.club › ~samhunter › tinylog.gmi captured on 2022-06-11 at 20:38:58. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2022-06-03)
-=-=-=-=-=-=-
Bad programming, bad jokes, bad idea.
author: samhunter
avatar: 💡
license: DWTFYW
I read Brian Kernighan's UNIX memoir a while ago. I guess that's how a successful life looks like -- you're so busy writing about awesome people you worked with that in the end your "memoir" is barely about yourself.
I am especially glad BWK wrote a lot about AWK and Doug McIlroy -- I am pretty sure UNIX wouldn't be such a great system without those two. A small language that could, and a largely unsung genius who invented the Unix pipeline.
@deerbard: check your _local_ vim: `vim --version |grep xterm_clip`... if it says something like '+xterm_clipboard' the "+y will work... If not (or if you're on a remote system) -- you'll have to use your mouse (or the copy/paste functionality of your screen/tmux/dvtm)
`vim` on the console can only use its own clipboard (copy-paste buffer. Actually something like 28 of them. Named.)
If you are using it in an xterm (or whatever people use these days) window, and you want to use your mouse to copy stuff from/into Vim: press and hold Shift while selecting. Then paste it elsewhere, as usual.
You might use the '+' buffer in Gvim (that's mapped to system clipboard IIRC) --> "+y
Reading an old manual file for a Lisp Machine (dated June 8th, 1984) . Just stumbled upon `with-open-file` working exactly the way the the similar statement works in Python.
We're not making much progress, m'key?
How to water your plant "without" a Gemini client:
echo "gemini://astrobotany.mozz.us:1965/app/plant/water" | openssl s_client --connect "astrobotany.mozz.us:1965" -cert $CERTDIR/cert.pem -key $CERTDIR/key.pem -crlf -quiet -ign_eof
`slope` can be compiled now -- ~sloum wrote a nice compiler/linker - it resembles slightly the way the old DOS BASIC compiler worked - by embedding the source and the interpreter in a single executable file.
It might not be the most storage-efficient way, but giving someone a file/link to the file is much easiert than asking them to install all dependencies.
I'm kind of having a Hannibal Smith moment right now: "I love it when a plan comes together"
Except - it never was a "plan". It started with a shocking (not anymore) discovery, that the system I'm on doesn't have the `bc` calculator.
After looking around and finding some, not so suitable, tools a normal person would just find the source package, compile bc and move on.
Well, not me, obviously - I decided to write an RPN calculator in bash... Then the way assemblylanguage routines should handle the stack made me rework the stack of my calc.
Then I wanted to see it... Then it wasn't a calculator anymore -- it turned into a set of command-line macros that allowed me basically write and run ASM programs in Bash ("in", as in mixing bash and assembly commands and sharing the screen and variables.
And now I am just translating the lines into Javascript to make it less 1970's-chic.
A MASM-like assembly interpreter (WiP)
A MASM-like assembly interpreter (WiP)
I finally wrote the long (decades) overdue Brainfuck interpreter.
The prototype in Python was rewritten in JavaScript and now it resides
Unassuming elegance of a well-written Ansible playbook.
I seriously hate the hoops one has to jump through to create a working EFI boot CD image...
Re: @guigui3000@pollux.casa Mon 03 Jan 2022 20:40 CET
1. You can have more than one SSH key. Just give it a different name than id_rsa*
2. As they are all by default located in your ~/.ssh directory you can simply backup them as any other file on the system.
3. Restoring them is easy too -- just copy them back into ~/.ssh.
4. Guestbook for the capsule would require a CGI script, but it's doable.
Honestly, there's a separate circle in hell for people who defined keyboard shortcuts in `nano`
https://nano-editor.org/cheatsheet.html
Regaining momentum after a longish break from online activities (the meaningful ones at least) is hard.
At the moment I'm just trying to water my plant on astrobotany (ngl it would wilt without @deerbard's help, thanks, buddy!) and keep the software I wrote and made public running and patched.
Writing anything new? No, not yet.
Re: @hexdsl Wed 08 Sep 2021 21:47 BST
You can consider me the last person who wouldn't like to try something new, but `fish` is an eleven-foot pole case for me (that's a pole I keep for touching things I wouldn't touch with a ten-foot pole).
I tried to use it, years ago, and I am still slightly appaled.
Re: @deerbard Sep 7 12:12:02 PM CEST 2021
I could download it. Quite cool, the creature...
Re: @deerbard Sun 29 Aug 2021 13:35 CEST
I should stop trying to use backquoted preformatted text in my tinylog, I already found a workaround for GTL, but apparently the issue hits harder in "lace"...
Can you imagine the existential fear of a person who knows everything? (just a thought, luckily I am as ignorant as it gets, with lots still to learn).
Re: @deerbard Sun Aug 29 01:07:10 PM CEST 2021
~/.config/amfora/config.toml [auth.certs] # Client certificates # Set domain name equal to path to client cert # "example.com" = 'mycert.crt' 'astrobotany.mozz.us' = '/home/samhunter/.config/certs/cert.pem'
Re: @deerbard Wed 25 Aug 2021 17:49 CEST
No, it's *years* since I played chess last time. I kind of lost interest, I guess having to "think ahead" at work all the time doesn't help. And -- I should actually begin with that -- I never was a good player.
Re: @hexdsl Tue 24 Aug 2021 19:17 BST
teeline -- as in 'shorthand system'?
Context: Not so important, are you?
# ## you are #### here #### | ##### v , #####--.--o--o---°------(()---(/)---O-----O----------------------------------- ##### '
I guess it's time to stop calling chess a 'strategy game'. It's tactics. You win a battle in chess, not a war. And I guess all the generals that declared any war in the last century a win -- played chess. If chess was a war game the playing should continue after the 'king is defeated' (checkmate). The whites won? Great. Now the whites help blacks rebuild their society. How is the chessboard divided now? Is is still 32 fields for each side? Can a kingless bunch of rooks, lead by a bishop, still try to assasinate the white king?🤔
I can see some variations of the game:
- "German chess" - the losing side divides their side of the board in two, has a small checkers minigame;
- "Polish chess" - after the opening a third side appears on the board and works together with blacks or whites. The losing side never accepts the 'checkmate', at once a king reappears in the different part of the chessboard...;
- "Russian chess" - for every rook killed two new appear, no piece is allowed to retreat;
- "Japanese chess" - there's no particular strategy, all pieces move at once, sacrificing a rook isn't actually optional;
- ... and so on, and so on...
/ \ / k --- a b --- f / \ / \ me --- l i \ / \ / j --- c d --- e \ / g --- h
Learning to keep tabs on my projects in 'swim' (think "Trello on the commandline"):
Re: @bacardi55 Sat 21 Aug 2021 16:16 CEST
you can always check gemini://tinylogs.gmi.bacardi55.io
That's what I do :)
I might have patched the problem 'lace' has with incorrectly formatted dates (or at least I found a good place to do so).
People 'sent' almost 500 messages via gab in the course of the last two weeks. Seeing how much 'life' everybody gets in spite of if -- maybe it's not 'social network' that ruins your lives, but the notifications? ;) [I doubt anyone expects an instant reply in 'gab'...]
Slope has the 'file-append-to', I added a few lines of code to have 'file-read-from' -- for symmetry. To do - 'file-prepend-to' and probably 'file-prepend-at-tag' or something like that for tinylog type files (where all the new content goes between the header and the latest entry)
A: What are you doing on Friday?
B: I want to buy glasses in the afternoon...
A: And then?...
B: And then... We will see.
(I show myself out)
Watching "A Very Secret Service" on Netflix. The French humour at its best. A bit like Louis de Funès movies. Minus the outright slapstick scenes. "Who won WW2?" "...France?"
tinylog.slo:
[x] Added prompt to the 'editor'
[x] Will skip the header to the first entry (= first line starting with "##")
I had a rather lengthy exchange about the rather inadequate support for Unicode characters on Linux console. What works perfectly in a 'text' terminal emulator gets mangled and partially replaced with white squares on the console. Even in FB mode, with the proper encoding and font loaded -- there's still lots of _actually not so weird shit_ that just can't be displayed properly. Okay, meanwhile, Russian or Polish people are not fucked anyymore when trying to read or write on the console. But I pity you if you're trying to write math formulas. I guess only 2² gets displayed properly, all the rest is simply a square.
"I hope it will get better..." said my interlocutor. I'm thinking and thinking and I just cannot see it. Everybody drifted into the world of graphical interfaces, plus the text console does what it was intended to do -- gives you access to the system on a very close, very basic level. Will we ever see emojis in kernel messages? Well, I hope not, because they won't be properly displayed...
Ever noticed how you grow when something you need isn't available? I guess lack of something is a good impulse to kick our butts out off the consumption circle. And every temporary need creates a permanent value.
@deerbard: I don't think I overdo it. I just don't keep using 'you' or their nicknames. Besides: you do realise it's a tongue-in-cheek remark? ;)
Woke up to a new time/data functions specification ;-) Format of the timestamp changed slightly, hopefully it doesn't break anything...
Aside from being one sexy mofo (ngl - can't breathe from laughing) I managed to enable multiline entries in tinylog.slo. It's not a bad day, overall...
- Always learning ✅
- Relaxed body language ✅
- Mindful during discussions ✅
- Don't check the phone 24/7 ✅
- Don't try to be perfect ✅
- Say their name often ✅
Also: _me_ :rofl:
Being "thrown into deep water" at the very beginning of a new job has its advantages. I'm in a training, level 'advanced', for a system I didn't know at all a few months ago, and I do not feel too dumb for it. The feeling of being an impostor is actually a good thing. Keeps you on your toes. If I only had so much fun learning back then, at school ;)
Changed the date format in tinylog.slo. Let's see how it works. Thanks @deerbard for pointing it out (I didn't know I'm under surveillance now ;-) )...
In case someone needs to fold text after 60th column ;-) ->
(for-each (lambda (line) (display line)(newline)) (regex-find ".\{60}[^ ]* *|.*$" Long))
<- Yes. That's pretty much all. 'Long' is a variable holding the long text line you want to fold...
Gemini client in six-ish lines of code? nice :) #slope
Yessss! It definitely did!
Will the other entry land where I expected it to appear?
So, it happened. I didn't expect the first slope script I _might_ use regularly would be a tinylog updater. The gab client (gaby) is already at a quite advanced development stage (minus a necessary rewrite to replace my /etc/passwd hack with a much more standard and efficient fileglob), but wrapping a oneliner I already had in some file updating logic wasn't particularly complex. So here we are. An update from inside a slope script...
After years of avoiding?/neglecting?/not finding use for? Scheme I took a deep dive into a "locally developed" Scheme's dialect - 'slope'. It's really refreshing to take a different approach to solving problems. I am actually amazed how deep has the basic syntax of the language embossed itself in my mind. I must admit -- every time I start a new project in Python -- I have a moment of hesitation -- "how exactly am I going to make it run?". Nothing like that with Scheme. For example - I've noticed slope has a for-each expression, and (I tested it at some point) it works exactly as your intuition tells you, but doing a "loop" using recursion felt so natural. Why is it so? And why am I "at home" with Scheme, but somehow cannot stand Lisp? Questions ;)
Slope is a 'for fun' project. You didn't believe the world needs another language? Another interpreted language? Another interpreted language with lots of parens? Good. That would be a weird assumption. Sloum writes it for fun, because he can. And, kind of as a side effect -- a working, slick and fast tool was created. I did some timing, comparing a standard program running here (written in Python) with my less-than-masterfully crafted bootleg version of it.
$ time ./gab.slo -c test >/dev/null >>> real 0m0.012s|user 0m0.001s|sys 0m0.011s $ time gab -c test > /dev/null >>> real 0m0.066s|user 0m0.054s|sys 0m0.010s
Not bad for a 'toy' language, huh?
I talked with a stranger. Why do people hesitate so much? Postpone stuff indefinitely. Don't call, don't text. Don't outline that story or essay, don't fill the gaps. Don't learn that song, don't lookup that information. When did everybody become so apathetic?
Time to walk the walk - today's snapshot of the zeitgeist on the server -- who would expect that?
- 5 yummy! :P
- 1 disgusting :$
- 1 A pizza is a pizza :D
A bit less of a surprise here, though -- we're definitely the vi(m) crew here...
4 vim
2 vi
1 sam
1 ed
1 chalk
1 acme
Harvested my first astrobotany plant. Farewell, Abigail! Hello, Abigail. Now growing at 1.2x speed.
I kind of love-hate the simplicity of Plan9 editors. From one point of view they're strictly following the tenets of Unix - "one job, but well done". An editor isn't a mail client, web browser, file manager... They're not syntax highlighter either... They're heavily depending on mouse. Or mouse chordings, combined with keyboad operations. They probably work great with mouse held in right hand (what I, as a lefty, don't do).
Still prefer the "impure" versions:
A great set of patches bringing acme into XXI century. A must have in my opinion.
[1]It looks great and I would love to use it, but for some reasons it refuses to react to my mouse-clicks.
Started a new project:
A personal assistant for the RTC shell
I must admit, some pieces of code I (re-)write make me proud, even if it's basically just snipping on the existing code.
diff --git a/files/update.cpp b/files/update.cpp index 773dbc6..6fdfd4b 100644 --- a/files/update.cpp +++ b/files/update.cpp @@ -37,23 +37,11 @@ int main(int argc, char *argv[]) { current_mission.ships[i].x += dx[i]; // Check if there is a change of status for (int i = 0; i < current_mission.nfleet; i++) { - if (current_mission.ships[i].status == STATUS_LEG1 && - (int)current_mission.ships[i].x >= current_mission.duration[STATUS_LEG1]) { - current_mission.ships[i].status= STATUS_MISSION; - current_mission.ships[i].x = 0; - } - if (current_mission.ships[i].status == STATUS_MISSION && - (int)current_mission.ships[i].x >= current_mission.duration[STATUS_MISSION]) { - current_mission.ships[i].status= STATUS_LEG2; - current_mission.ships[i].x = 0; - } - if (current_mission.ships[i].status == STATUS_LEG2 && - (int)current_mission.ships[i].x >= current_mission.duration[STATUS_LEG2]) { - current_mission.ships[i].status= STATUS_DONE; - current_mission.ships[i].x = 0; - } if (current_mission.ships[i].status == STATUS_DONE) { current_mission.ships[i].x = 0; + } else if ( (int)current_mission.ships[i].x >= current_mission.duration[current_mission.ships[i].status]) { + current_mission.ships[i].status++; + current_mission.ships[i].x = 0; } }
Added -t (user template) to poll. Now everyone can create their own polls/questionnaires.
Freshly created linkulator files of a new user caused a false positive, because linkulator change detection used simple mtime check. It's fixed now. Because the script has to read the last line of the linkulator.data file the timing slightly increased (~260-270ish now).
Changed the checking method for all 'folder based' services: recent.py dives (one level so far) into them and returns mtime of the newest file (was the folder itself before).
That was quick, approximately 30 minutes from a vague idea to implementation. And it's simple - just a text file with an obvious markup, extendable and completely under control of the user (as it should be on RTC).
$ poll -l editor What editors do you use? geek4hire Programmer, looking for project os What's your primary operating system? sodapop Pepsi or Coke?
So far only a couple of polls, and not-yet-decentralised (I'm working on it), but already usable. Due to the methodology behind it (files in users' HOMEs) not really a democracy tool (voting is far from anonymous), but I hope it'll find some use here. Or not...
What editors do you use? (mark the ones you use frequently, you can add others, just keep the file clean) [x] vi [x] vim [ ] emacs [ ] nano [ ] joe [x] ed [x] sam [x] acme
A weirdo as myself cannot just do the stuff in awk(1) and move on...
Both oneliners:
+ filter out the "comment lines" beginning with "##"
+ create an entry for every first word of remaining lines in an associative array/hash
+ output a list of unique usernames
tmp $ time awk '!/^##/{a[$1]++}END{for(u in a){print u}}' online.log | sort > online.a real 0m0.013s user 0m0.009s sys 0m0.003s tmp $ time { unset -v 'q'; declare -A q; while read -r a b ; do [[ "$a" =~ ^##$ ]] || q[$a]="x" ; done < online.log; printf "%s\n" ${!q[@]} ;} | sort > online.s real 0m0.152s user 0m0.105s sys 0m0.045s tmp $ diff online.a online.s tme $
Fun ;)
<EOL>