sam's capsule - Tiny Log

Bad programming, bad jokes, bad idea.

author: samhunter

avatar: 💡

license: DWTFYW

Mon 18 Apr 2022 01:47:46 PM CEST

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?

Fri 15 Apr 2022 11:01:38 PM CEST

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

Thu 07 Apr 2022 11:29:38 AM CEST

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

Sat 02 Apr 2022 10:27:36 AM CEST

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)

Tue 29 Mar 2022 08:48:54 PM CEST

I finally wrote the long (decades) overdue Brainfuck interpreter.

The prototype in Python was rewritten in JavaScript and now it resides

here

.. or here.

Mon 31 Jan 2022 09:55:32 PM CET

Unassuming elegance of a well-written Ansible playbook.

Thu 20 Jan 2022 09:20:24 AM CET

I seriously hate the hoops one has to jump through to create a working EFI boot CD image...

Tue 04 Jan 2022 10:06:18 AM CET

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.

Thu 30 Dec 2021 09:59:23 PM CET

Honestly, there's a separate circle in hell for people who defined keyboard shortcuts in `nano`

https://nano-editor.org/cheatsheet.html

Mon 29 Nov 2021 10:45:56 AM CET

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.

Thu 09 Sep 2021 03:16:21 PM CEST

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.

Tue 07 Sep 2021 12:44:11 PM CEST

Re: @deerbard Sep 7 12:12:02 PM CEST 2021

I could download it. Quite cool, the creature...

Sun 29 Aug 2021 03:56:41 PM CEST

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

Sun 29 Aug 2021 03:53:51 PM CEST

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

Sun 29 Aug 2021 01:11:52 PM CEST

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'

Fri 27 Aug 2021 08:56:13 AM CEST

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.

Tue 24 Aug 2021 09:51:28 PM CEST

Re: @hexdsl Tue 24 Aug 2021 19:17 BST

teeline -- as in 'shorthand system'?

Tue 24 Aug 2021 12:42:25 PM CEST

Context: Not so important, are you?

 #
 ##         you are
 ####        here
 ####         |
 #####        v                  ,
 #####--.--o--o---°------(()---(/)---O-----O-----------------------------------
 #####                         '

Tue 24 Aug 2021 10:21:30 AM CEST

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

Mon 23 Aug 2021 03:22:46 PM CEST

Bigger scheme

                 
           /       \       /
    k --- a         b --- f 
   /       \       /       \
           me --- l         i
   \       /       \       /
    j --- c         d --- e
           \       /
            g --- h

Mon 23 Aug 2021 01:29:56 PM CEST

Learning to keep tabs on my projects in 'swim' (think "Trello on the commandline"):

'Swim' repository at tildegit

Sun 22 Aug 2021 07:16:41 PM CEST

My astrobotany plant

Sat 21 Aug 2021 04:41:48 PM CEST

Re: @bacardi55 Sat 21 Aug 2021 16:16 CEST

you can always check gemini://tinylogs.gmi.bacardi55.io

That's what I do :)

Sat 21 Aug 2021 01:10:24 PM CEST

I might have patched the problem 'lace' has with incorrectly formatted dates (or at least I found a good place to do so).

My modified lace (WIP)

Sat 21 Aug 2021 12:39:04 PM CEST

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

Sat 21 Aug 2021 12:33:22 PM CEST

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)

Thu 19 Aug 2021 11:33:26 PM CEST

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)

Thu 19 Aug 2021 10:10:37 PM CEST

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?"

Thu 19 Aug 2021 08:34:07 PM CEST

tinylog.slo:

[x] Added prompt to the 'editor'

[x] Will skip the header to the first entry (= first line starting with "##")

Thu 19 Aug 2021 07:14:27 PM CEST

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

Thu 19 Aug 2021 12:47:58 PM CEST

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.

Thu 19 Aug 2021 12:38:46 PM CEST

@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? ;)

Thu 19 Aug 2021 07:56:32 AM CEST

Woke up to a new time/data functions specification ;-) Format of the timestamp changed slightly, hopefully it doesn't break anything...

Wed 18 Aug 2021 06:28:40 PM CEST

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

Wed 18 Aug 2021 06:22:20 PM CEST

Psych2Go "6 Sexy Habits"

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

Wed 18 Aug 2021 12:26:26 PM CEST

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 ;)

Wed 18 Aug 2021 12:15:15 PM CEST

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

Tue 17 Aug 2021 09:51:28 PM CEST

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

Tue 17 Aug 2021 07:34:30 PM CEST

Gemini client in six-ish lines of code? nice :) #slope

Tue 17 Aug 2021 06:27:52 PM CEST

The script itself...

Tue 17 Aug 2021 06:27:13 PM CEST

Yessss! It definitely did!

Tue 17 Aug 2021 06:26:50 PM CEST

Will the other entry land where I expected it to appear?

Tue 17 Aug 2021 06:22:23 PM CEST

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

Tue 17 Aug 2021 10:32:06 AM CEST

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?

Slope repository

Sun 15 Aug 2021 06:55:05 PM CEST

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?

Thu 12 Aug 2021 10:38:59 PM CEST

Time to walk the walk - today's snapshot of the zeitgeist on the server -- who would expect that?

Pineapple on a pizza?

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

What editors do you use?

4 vim

2 vi

1 sam

1 ed

1 chalk

1 acme

Wed 11 Aug 2021 10:27:28 PM CEST

Harvested my first astrobotany plant. Farewell, Abigail! Hello, Abigail. Now growing at 1.2x speed.

Fri 06 Aug 2021 10:24:20 PM CEST

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:

Deadpixi's sam

A great set of patches bringing acme into XXI century. A must have in my opinion.

Acme in Go

MDI version of Acme

Acme in text-mode[1]

[1]It looks great and I would love to use it, but for some reasons it refuses to react to my mouse-clicks.

Fri 06 Aug 2021 06:59:20 PM CEST

Started a new project:

A personal assistant for the RTC shell

Tweaking on the 'odyssey'

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;
             }
         }

Odyssey repository

Thu 05 Aug 2021 08:57:32 AM CEST

Added -t (user template) to poll. Now everyone can create their own polls/questionnaires.

Thu 05 Aug 2021 08:17:40 AM CEST

recent.py

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

Wed 04 Aug 2021 06:27:11 PM CEST

poll

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

Wed 04 Aug 2021 01:59:54 PM CEST

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>