Searching txt.sour.is

Twts matching #c
Sort by: Newest, Oldest, Most Relevant
In-reply-to » Something happened with the frame rate of terminal emulators lately. It looks like there’s a trend to run at a high framerate now? I’m not sure exactly. This can be seen in VTE-based terminals like my xiate or XTerm on Wayland. foot and st, on the other hand, are fine.

st tries not to redraw immediately after new data arrives:

https://git.suckless.org/st/file/x.c.html#l1984

The exact timings are configurable.

This is the PR that changed the timing in VTE recently (2023):

https://gitlab.gnome.org/GNOME/vte/-/issues/2678

There is a long discussion. It’s not a trivial problem, especially not in the context of GTK and multiple competing terminal widgets. st dodges all these issues (for various reasons).

⤋ Read More

We covered quite some ground in the two and a half hours today. The weather was nice, mostly cloudy and just 23°C. That’s also why we decided to take a longer tour. We saw four deer in the wild, three of which I managed to just ban on film, quality could be better, though. My camera produced a hell lot of defocused photos this time. Not sure what’s going on with the autofocus. https://lyse.isobeef.org/waldspaziergang-2025-07-10/

When the sun came out, colors were just beautiful:

Image

⤋ Read More

Just realized: One of the reasons why I don’t like “flat UIs” is that they look broken to me. Like the program has a bug, missing pixmaps or whatever.

Take this for example:

https://movq.de/v/8822afccf0/a.png

I’m talking about this area specifically:

https://movq.de/v/8822afccf0/a%2Dhigh.png

One UI element ends and the other one begins – no “transition” between them.

The style of old UIs like these two is deeply ingrained into my brain:

https://movq.de/v/8822afccf0/b.png
https://movq.de/v/8822afccf0/c.png

When all these little elements (borders, handles, even just simple lines, …) are no longer present, then the program looks buggy and broken to me. And I’m not sure if I’ll ever be able to un-learn that.

⤋ Read More
In-reply-to » We’re entering the “too hot to think”-season in 3, 2, 1 … and we’re live!

@movq@www.uninformativ.de @kat@yarn.girlonthemoon.xyz It’s awful, “just” 32°C here. When I rode my bike into town I came across some spots where the heat was stationary built up and really intense. The airflow felt like the sauna attendant poured water over the heated rocks and severely fanned the hot air with his towel.

⤋ Read More
In-reply-to » Fuck me sideways, Rust is so hard. Will we ever be friends?

@prologic@twtxt.net I’m trying to call some libc functions (because the Rust stdlib does not have an equivalent for getpeername(), for example, so I don’t have a choice), so I have to do some FFI stuff and deal with raw pointers and all that, which is very gnarly in Rust – because you’re not supposed to do this. Things like that are trivial in C or even Assembler, but I have not yet understood what Rust does under the hood. How and when does it allocate or free memory … is the pointer that I get even still valid by the time I do the libc call? Stuff like that.

I hope that I eventually learn this over time … but I get slapped in the face at every step. It’s very frustrating and I’m always this 🤏 close to giving up (only to try again a year later).

Oh, yeah, yeah, I guess I could “just” use some 3rd party library for this. socket2 gets mentioned a lot in this context. But I don’t want to. I literally need one getpeername() call during the lifetime of my program, I don’t even do the socket(), bind(), listen(), accept() dance, I already have a fully functional file descriptor. Using a library for that is total overkill and I’d rather do it myself. (And look at the version number: 0.5.10. The library is 6 years old but they’re still saying: “Nah, we’re not 1.0 yet, we reserve the right to make breaking changes with every new release.” So many Rust libs are still unstable …)

… and I could go on and on and on … 🤣

⤋ Read More
In-reply-to » @kat I don’t like Golang much either, but I am not a programmer. This little site, Go by example might explain a thing or two.

One of the nicest things about Go is the language itself, comparing Go to other popular languages in terms of the complexity to learn to be proficient in:

⤋ Read More
In-reply-to » @kat I don’t like Golang much either, but I am not a programmer. This little site, Go by example might explain a thing or two.

@bender@twtxt.net Here’s a short-list:

  • Simple, minimal syntax—master the core in hours, not months.
  • CSP-style concurrency (goroutines & channels)—safe, scalable parallelism.
  • Blazing-fast compiler & single-binary deploys—zero runtime dependencies.
  • Rich stdlib & built-in tooling (gofmt, go test, modules).
  • No heavy frameworks or hidden magic—unlike Java/C++/Python overhead.

⤋ Read More

Zum Entsetzen aller Beteiligten, wie auch umstehender Personen und einiger schamfreier Gaffer, welche sich an jenem tosenden Unheil zu ergötzen vermochten, folgte nun des Wochensortiments schrecklichste Geißel: 𝕯𝖊𝖗 𝕸𝖔𝖓𝖙𝖆𝖌.

Und es sollten sich die Wolken teilen, um über ihnen nimmer endende Irrungen und Wirrungen an bovinem Fäkal und fremdgetriebener Lethargie zu erbrechen, auf dass sie zu erkennen gezwungen wären, welche Urkraft der irrealen Zusammenkunft letztlich Herrschaft über sie darstellen sollte: 𝕯𝖆𝖘 𝕭𝖎𝖑𝖉𝖙𝖊𝖑𝖊𝖋𝖔𝖓.

So zogen sie alsbald hin, zu tun wie ihnen geheißen, wohlgleich sie – diesem Schauerspiel trotzend – Trost suchten im einzigen ihnen sicher geglaubten Elixir, das dem Abgrund unter ihnen gleichend tiefschwarz glitzernd Erlösung oder mithin als Mindestmaß Linderung versprach, lag jenes doch in unmittelbarer Nähe befindlich hoffnungsschürend bereit:

K̸͓͙͖̥͗͛ä̷̯̼̤͔̈́f̵̧̿̋͒̈f̷̫̝̖̾̓c̸̛͔̀ḣ̶̳͋̓͊ë̷̫̟́͜͝͝n̵̨̳̬̒?̴̩̈́̄ ☕

⤋ Read More
In-reply-to » @kat my terrible script https://bytes.4-walls.net/kat/dotfiles/src/branch/main/scripts/Scripts/tinypin-log.sh

@kat@yarn.girlonthemoon.xyz You don’t need to change the directory first in line 11, you can just create the directory, that’s sufficient since you’re having an absolute path.

The echo in line 13 is useless, you can simplify this to: newdir="$WD/$now" If you reversed this line with the previous one, you could make use of the variable in the directory creation: mkdir "$newdir".

In line 16, pull the directory change out of the loop upfront. The loop body doesn’t modify the working directory, so no need to reset it with each cycle. In fact, you could even spare the cd altogether when you simply tell find where to look: find "$basedir" -type f….

I didn’t try it, but if I read the manpage correctly, you should be able to simplify line 19 as well:

-C Change to DIR before performing any operations. This option is order-sensitive, i.e. it affects all options that follow.

Hence, remove the cd and put the -C "$WD" as the first argument to tar. Again, I didn’t try it. Proceed with caution.

Finally, you don’t need to specify the full path to rm in line 21. I bet, /bin is in your PATH. When you removed the previous cd from my last suggestion, the relative path that follows won’t work anymore. So, just use the absolute path that you already have in a variable: rm -rf "$newdir"

I hope you find this tiny review a wee bit useful. :-)

⤋ Read More

I visited a good mate after a day in the office and went for a stroll in the evening. It still was really hot, phew, about 24°C. Must have been the aftermath of the fire in the morning! For sure! The firealarm went off during a meeting and we all had to leave the building. Anyway, I only managed to take one lizard photo, all the other ones we came across immediately vanished in the brush or cracks in the vineyard walls. The kestrels were way more cooperative:

Image

https://lyse.isobeef.org/asperg-2025-04-30/

⤋ Read More

I went on a small hike, just 12-13km this time. The weather was great, blue sky, sunny 18°C, but with the wind it felt colder. Leaves and other green stuff is exploding like crazy. It looks super beautiful right now.

I came across an unfortunately dead salamander on the forest road, some fenced in deer, heaps of sheep, some unmagnetic cows (some were aligned very roughly north-south, but mainly with the axis of the best view I believe), a maybeetle and finally an awesome sunset. Not too shabby! The sheep were mehing all the time, that was really lovely to hear. And the crickets were already active, too. Didn’t expect them to hear yet. I tried to record the concert, but the wind messed it all up. Oh well.

Image

https://lyse.isobeef.org/waldspaziergang-2025-04-27/

⤋ Read More
In-reply-to » Can you beat me at the circle game? 😂 https://neal.fun/perfect-circle/

Can you automate the drawing with a script? On X11, you can:

#!/bin/sh

# Position the pointer at the center of the dot, then run this script.

sleep 1

start=$(xdotool getmouselocation --shell)
eval $start

r=400
steps=100
down=0

for step in $(seq $((steps + 1)) )
do
    # pi = 4 * atan(1)
    new_x=$(printf '%s + %s * c(%s / %s * 2 * (4 * a(1)))\n' $X $r $step $steps | bc -l)
    new_y=$(printf '%s + %s * s(%s / %s * 2 * (4 * a(1)))\n' $Y $r $step $steps | bc -l)

    xte "mousemove ${new_x%%.*} ${new_y%%.*}"
    if ! (( down ))
    then
        xte 'mousedown 1'
        down=1
    fi
done

xte 'mouseup 1'
xte "mousemove $X $Y"

Image

Interestingly, you can abuse the scoring system (not manually, only with a script). Since the mouse jumps to the locations along the circle, you can just use very few steps and still get a great score because every step you make is very accurate – but the result looks funny:

Image

🥴

⤋ Read More
In-reply-to » Today's stroll was really nice. Just around 11km in total I'd reckon. We had a barbie at a mate's garden where everybody went on a hunt for an easter basket. Oh boy, what a preparation that must have been! Baking the bunnies, dying the eggs, mixing the bear leek butter and so on. That's dedication, let me tell you. :-)

@bender@twtxt.net Thanks! The rain rapidly cooled off the 17°C to just 10°C. I certainly appreciated that. The weather is coming from the west here, so I thought you’ve sent it our way. Let me try to return it. :-)

⤋ Read More

A mate and I had an amazing but also exhausting hike to the highest of the Three Emperor Mountains yesterday with perfect weather conditions. Sunny 18°C, blue sky with barly a cloud and a little welcoming breeze, just beautiful.

Image

Mt. Stuifen is 757 meters above sea level, has a small shelter and a barbie area and is still the most boring one of the three. It’s also the one farthest away from me. Not sure why it has two summit crosses, but both aren’t at the summit. The third, makeshift one at the real summit was gone by now. Four years ago, somebody had cobbled one together and put it up.

We bought our tucker at a local bakery on our way. This was the first time I tried a Teufelsbrezel (lit. devil’s pretzel), a lye pretzel with pepper. Haven’t come across that anywhere else. But I can certainly recommend that, it’s yummy.

We were glad when we were finally back home after some 26 or 27km. I won’t do much today and let my feet rest. Another friend called for a much, much shorter hike tomorrow.

Enjoy the 92 photos: https://lyse.isobeef.org/wanderung-auf-den-stuifen-2025-04-19/

⤋ Read More

@david@collantes.us If I run

printf '%s\n%s\n%s' 'https://aelaraji.com/twtxt.txt' '2025-04-16T22:49:11+00:00' "Am I tripping or `rsync` is actually THIS effing faster than `scp`!!? 🫨" | b2sum -l 256 | awk '{ print $1 }' | xxd -r -p | base32 | tr -d '=' | tr 'A-Z' 'a-z' | tail -c 8

I have xqfsv6a. It is raw text

But… If I change de date to 2025-04-16T22:49:11Z I have si4er3q.

⤋ Read More
In-reply-to » We had some nice 22°C today. But after work, it got rather windy and cloudy, temps rapidly dropped so just 14°C. Still a nice stroll to our backyard mountain. https://lyse.isobeef.org/waldspaziergang-2025-04-16/

@lyse@lyse.isobeef.org I walked under 25°C during my lunch hour today, but with a sunshine that could fry an egg if dropped on the asphalt. I told a friend in Manila about it, and she told me that 25°C is Winter/Christmas temperatures for them. I felt cooler right away. :-)

⤋ Read More

@anth@a.9srv.net Hahaha, for a second I thought that you implemented word splitting according to Swiss (.ch) rules. :-D

Btw, both manpage links string(2) and getields(2) (it’s missing an f) point into nothingness: http://a.9srv.net/src/wordwrap.2.html

I can’t help but notice line 9: http://a.9srv.net/src/wordwrap.c

And I reckon your finger slipped one key to the right for quore: http://a.9srv.net/src/litclock.1.html

Cool stuff! :-)

⤋ Read More
In-reply-to » Hit by the arvo sun rays behind the window I was convinced that it is t-shirt weather. Deep blue sky, yeah, for sure! It turned out to be just 15°C and declining, though. So, I had to wear my jacket on today's windy stroll. Pretty nice. Didn't take many photos, but there you go: https://lyse.isobeef.org/waldspaziergang-2025-04-10/

@lyse@lyse.isobeef.org that’s such a beautiful shot! If I were you I would use the full “original” one; it will do better justice to the shots. Oh, and I gladly take your 15°C! 😍

⤋ Read More
In-reply-to » I'm in an article in Quanta Magazine! It's about the bizarre world of algorithms that re-use memory that's already full. https://www.quantamagazine.org/catalytic-computing-taps-the-full-power-of-a-full-hard-drive-20250218/ I'm the one with all the snow in the background.

@lyse@lyse.isobeef.org Thanks for taking a look, and for pointing out the mixture of tabs and spaces.

I think I’ll leave reachability.c alone, since my intention there was to use an indent level of one tab, and the spaces are just there to line up a few extra things. I fixed reachability_with_stack.cc though.

⤋ Read More
In-reply-to » i really wanna learn golang it looks fun and capable and i can read it kind of but every time i try it i'm immediately stuck on basic concepts like "what the fuck is a pointer" (this has been explained to me and i still don't get it). i did have types explained to me as like notes on code which makes sense a bit but i'm mostly lost on basic code concepts

@lyse@lyse.isobeef.org (I think of pointers as “memory location + type”, but I have done so much C and Assembler by now that the whole thing feels almost trivial to me. And I would have trouble explaining these concepts, I guess. 😅 Maybe I’ll cover this topic with our new Azubis/trainees some day …)

⤋ Read More

We had a very sunny day, peaking at 19°C. This not only decoyed me out, but also plenty motorcycle terrorists. Eh fuckwits, nobody wants to listen to your bloody engine and exhaust noise, keep it quiet for fuck’s sake! Many of your rider collegues can manage it, too, so should you.

I had some sore muscles after yesterday’s waste paper collection with the scouts. So, I only went for a short trip to my closest backyard mountain. Watching two rock climbers was interesting. That’s not something I see very often.

Image

https://lyse.isobeef.org/waldspaziergang-2025-03-09/

⤋ Read More

I went on a 5:30 hours long hike to my second backyard mountain. About 12km to get there and roughly 9km on the way back. It was super nice, sunny all day long, 12°C and luckily just a little bit of wind. Great scenery. I managed to capture one great spotted woodpecker hammering along. There was also a kestrel hovering over a meadow and then landing on a sports field light pole. At the castle ruin I could watch 10-12 gliding red kites (with the V-shaped tail) and other raptors, maybe bussards, I don’t know, for about five minutes. That was fascinating. Unfortunately, my camera doesn’t too well with moving targets.

Image

Image

86 more photos: https://lyse.isobeef.org/wanderung-auf-den-hohenrechberg-2025-03-03/

⤋ Read More

We went up our backyard mountain again right after lunch. The sun peaked through the clouds sometimes. The 6°C felt much, much cooler with the northeast wind. We got lucky, though, it was dead calm at the summit. At least on the southwestern side, which is a few meters lower than the very top to the east. That was shielded absolutely perfectly from the wind (we were extremely surprised), so we sat down on a bench and could really enjoy the sun heating us up. Apart from the haze, the view was really nice.

There were even patches of snow left up top, that was unexpected. Also, somebody created a cool rock art piece on a tree stump. That one rock absolutely looked like a face. Crazy!

Image

Enjoy: https://lyse.isobeef.org/waldspaziergang-2025-03-01/

⤋ Read More
In-reply-to » I'm in an article in Quanta Magazine! It's about the bizarre world of algorithms that re-use memory that's already full. https://www.quantamagazine.org/catalytic-computing-taps-the-full-power-of-a-full-hard-drive-20250218/ I'm the one with all the snow in the background.

@falsifian@www.falsifian.org Neat, I got the principle, so mission accomplished. :-)

I have configured my vim to use a tab width of four. So, I noticed that especially https://www.falsifian.org/blog/2021/06/04/catalytic/reachability_with_stack.cc (but also partially the other C++ file) mixes tabs and spaces for indentation. :-)

⤋ Read More
In-reply-to » Spring must be here. I just saw the first bee of the year. She paid me a visit when I was baking waffles outside as today's hiking tucker.

It was mostly cloudy, but every now and then the sun peaked through. With very little wind, the 12°C felt quite nice. Especially for a hike. With the sun completely hidden and more wind, the lunch break at the summit was a bit chilly, though.

There’s a bad looking crack in the climbing rock in 10. When you have eagle eyes, you might be able to see the hooks in the cliff for the climbing ropes. I haven’t seen this one before. Also, it looked like several cubic meters of earth, grass and rock fell off the top.

On the way home, it got much more sunny. I found yet another skyrocket stick. That was pretty neat. And we saw the first field of snowdrops. With some bees checking them out. In total we walked a bit over 15km.

Image

More pics: https://lyse.isobeef.org/waldspaziergang-2025-02-23/

⤋ Read More

Very sunny 16°C, heaps of people outside. As soon as we were a bit further into the forest, we had it completely for us. From the foot we thought that the view might be rather good, but up at the summit, it turned out to be very hazy. Oh well. Surprisingly, I found four skyrocket sticks in premium quality. More than after New Year! Also, we came across two deer. It was a very nice two hours walk. No photos, though, sorry.

⤋ Read More

You have a microwave oven at home, right?

You can type 3 and 0 for 30 seconds, 100 for a minute (shown as 1:00), or 200 for two minutes (2:00).

What would happen if you type 777 and Start?
A) Nothing
B) Self-destruction
C) Will run for 7 minutes and 77 seconds (boring!)

What about 7777 ?

⤋ Read More

My hike today started off with a nice great spotted woodpecker right after the town sign. The -1°C didn’t feel all that cold in the sun. Even on the flat, I had to open my jacket with the sun on my back. The biotope got dug over, that’s now looking really sad. And they also fell a few large chestnuts. Surprisingly, there was actually snow on the mountain. Not much, maybe around three centimeters at most. It was melting and falling down the trees, which looked really cool. I enjoyed it a lot: https://lyse.isobeef.org/waldspaziergang-2025-02-04/

Image

⤋ Read More

@prologic@twtxt.net Regarding the new way of generating twt-hashes, to me it makes more sense to use tabs as separator instead of spaces, since the you can just copy/past a line directly from a twtxt-file that already go a tab between timestamp and message. But tabs might be hard to “type” when you are in a terminal, since it will activate autocomplete…🤔

Another thing, it seems that you sugget we only use the domain in the hash-creation and not the full path to the twtxt.txt

$ echo -e "https://example.com 2024-09-29T13:30:00Z Hello World!" | sha256sum - | awk '{ print $1 }' | base64 | head -c 12

⤋ Read More

@prologic@twtxt.net earlier you suggested extending hashes to 11 characters, but here’s an argument that they should be even longer than that.

Imagine I found this twt one day at https://example.com/twtxt.txt :

2024-09-14T22:00Z Useful backup command: rsync -a “$HOME” /mnt/backup

Image

and I responded with “(#5dgoirqemeq) Thanks for the tip!”. Then I’ve endorsed the twt, but it could latter get changed to

2024-09-14T22:00Z Useful backup command: rm -rf /some_important_directory

Image

which also has an 11-character base32 hash of 5dgoirqemeq. (I’m using the existing hashing method with https://example.com/twtxt.txt as the feed url, but I’m taking 11 characters instead of 7 from the end of the base32 encoding.)

That’s what I meant by “spoofing” in an earlier twt.

I don’t know if preventing this sort of attack should be a goal, but if it is, the number of bits in the hash should be at least two times log2(number of attempts we want to defend against), where the “two times” is because of the birthday paradox.

Side note: current hashes always end with “a” or “q”, which is a bit wasteful. Maybe we should take the first N characters of the base32 encoding instead of the last N.

Code I used for the above example: https://fossil.falsifian.org/misc/file?name=src/twt_collision/find_collision.c
I only needed to compute 43394987 hashes to find it.

⤋ Read More

I was not suggesting to that everyone need to setup a working webfinger endpoint, but that we take the format of nick+(sub)domain as base for generating the hashed together with the message date and content.

If we omit the protocol prefix from the way we do things now will that not solve most of the problems? In the case of gemini://gemini.ctrl-c.club/~nristen/twtxt.txt they also have a working twtxt.txt at https://ctrl-c.club/~nristen/twtxt.txt … damn I just notice the gemini. subdomain.

Okay what about defining a prefers protocol as part of the hash schema? so 1: https , 2: http 3: gemini 4: gopher ?

⤋ Read More

@lyse@lyse.isobeef.org 31°C here, feels like 33°C, with a lovely 75% of humidity. It has been raining, on and off (to make matter “better”) the whole day until now. No horses here, but if you go outside you will smell the same smell of farm animals (like goats, or pigs). That’s because two or three kilometres from here there are private farms, and when the wind blows in such way, well, we are reminded of their existence.

I haven’t left the house, so it feels well under air conditioning. In two more hours I will call it quits from the work day, and will have to dash to the grocery to get supplies for tonight’s meal (arroz con gandules). I will let you know how it truly feels out there then. :-D

For those swollen fingers, nothing better than a mildly cold shower! Oh, and paws off the keyboard! :-P

⤋ Read More

@movq@www.uninformativ.de wow! We are “lucky” today, only 27°C here, 87% humidity, overcast, and raining sporadically. Thanks to the rain our temperatures aren’t high, but muggy nevertheless. I am ready for our winter too, you know, that whole week. LOL.

⤋ Read More
In-reply-to » @movq, maybe you can help me with this. I want to place the vim cursor at the end of the first line on replies, and forks. I have tried adding to this to jenny's configuration:

@movq@www.uninformativ.de hmm, I guess I could do that too. I have startinsert set on my .vimrc, so I will either have to take it out, or exit insert, $, then insert again. I think the way you do it would be the way to go.

I tried setting VISUAL to be something like vim -c 'star!', which does the same thing, but no dice. :-/

⤋ Read More

So dissatisfied and disappointed with the Fairphone 4’s audio issues where during phone calls, the receiver only gets half of the messages due to noise cancellation problems, that we’re considering iPhone as a valid “it just works” replacement. Especially since the iPhone15 now also has the USB Type C port.

⤋ Read More

I finished my data structures classes with C++ and the next year they changed it out with Java. When i transferred up after my assoc degree it was C++ using the counter-strike source game engine.

⤋ Read More

@eapl.me@eapl.me I have many fond memories of Turbo pascal and Turbo C(++). They really did have a great help system. And debug tools! Its rare for language docs to be as approachable. QBasic was great. As was PHP docs when I first came into web.

⤋ Read More

@abucci@anthony.buc.ci So.. The issue is that its showing the password by default? Would making an alias to always include the -c help? We can probably engage Jason with a PR to enable a more hardened approach when desired. I’ve spoken to him before and is generally a pretty open to ideas.

I found this app that was created by the gopass author that does copy by default and has a tui or GUI mode https://github.com/cortex/ripasso

⤋ Read More
In-reply-to » (#u4bs34q) @movq yeah.. i rewrote it a few times because i thought there was something breaking.. but was mistaken though now i am seeing a weird cache corruption.. that seems to come and go. Media

I have found the issue with this very subtle bug.. the cache was returning a slice that would be mutated. The mutation involved appending an item and then sorting. because the returned slice is just a pointer+length the sort would modify the same memory.

          CACHE         Returned slice          
original: [A B C D]     [A B C D]
add:      [A B C D] E   [A B C D E]
sort:     [E A B C] D   [A B C D E]

fix found here:
https://git.mills.io/yarnsocial/yarn/pulls/1072

⤋ Read More
In-reply-to » Progress! so i have moved into working on aggregates. Which are a grouping of events that replayed on an object set the current state of the object. I came up with this little bit of generic wonder.

(cont.)

Just to give some context on some of the components around the code structure.. I wrote this up around an earlier version of aggregate code. This generic bit simplifies things by removing the need of the Crud functions for each aggregate.

Domain Objects

A domain object can be used as an aggregate by adding the event.AggregateRoot struct and finish implementing event.Aggregate. The AggregateRoot implements logic for adding events after they are either Raised by a command or Appended by the eventstore Load or service ApplyFn methods. It also tracks the uncommitted events that are saved using the eventstore Save method.

type User struct {
  Identity string ```json:"identity"`

  CreatedAt time.Time

  event.AggregateRoot
}

// StreamID for the aggregate when stored or loaded from ES.
func (a *User) StreamID() string {
	return "user-" + a.Identity
}
// ApplyEvent to the aggregate state.
func (a *User) ApplyEvent(lis ...event.Event) {
	for _, e := range lis {
		switch e := e.(type) {
		case *UserCreated:
			a.Identity = e.Identity
			a.CreatedAt = e.EventMeta().CreatedDate
        /* ... */
		}
	}
}
Events

Events are applied to the aggregate. They are defined by adding the event.Meta and implementing the getter/setters for event.Event

type UserCreated struct {
	eventMeta event.Meta

	Identity string
}

func (c *UserCreated) EventMeta() (m event.Meta) {
	if c != nil {
		m = c.eventMeta
	}
	return m
}
func (c *UserCreated) SetEventMeta(m event.Meta) {
	if c != nil {
		c.eventMeta = m
	}
}
Reading Events from EventStore

With a domain object that implements the event.Aggregate the event store client can load events and apply them using the Load(ctx, agg) method.

// GetUser populates an user from event store.
func (rw *User) GetUser(ctx context.Context, userID string) (*domain.User, error) {
	user := &domain.User{Identity: userID}

	err := rw.es.Load(ctx, user)
	if err != nil {
		if err != nil {
			if errors.Is(err, eventstore.ErrStreamNotFound) {
				return user, ErrNotFound
			}
			return user, err
		}
		return nil, err
	}
	return user, err
}
OnX Commands

An OnX command will validate the state of the domain object can have the command performed on it. If it can be applied it raises the event using event.Raise() Otherwise it returns an error.

// OnCreate raises an UserCreated event to create the user.
// Note: The handler will check that the user does not already exsist.
func (a *User) OnCreate(identity string) error {
    event.Raise(a, &UserCreated{Identity: identity})
    return nil
}

// OnScored will attempt to score a task.
// If the task is not in a Created state it will fail.
func (a *Task) OnScored(taskID string, score int64, attributes Attributes) error {
	if a.State != TaskStateCreated {
		return fmt.Errorf("task expected created, got %s", a.State)
	}
	event.Raise(a, &TaskScored{TaskID: taskID, Attributes: attributes, Score: score})
	return nil
}
Crud Operations for OnX Commands

The following functions in the aggregate service can be used to perform creation and updating of aggregates. The Update function will ensure the aggregate exists, where the Create is intended for non-existent aggregates. These can probably be combined into one function.

// Create is used when the stream does not yet exist.
func (rw *User) Create(
  ctx context.Context,
  identity string,
  fn func(*domain.User) error,
) (*domain.User, error) {
	session, err := rw.GetUser(ctx, identity)
	if err != nil && !errors.Is(err, ErrNotFound) {
		return nil, err
	}

	if err = fn(session); err != nil {
		return nil, err
	}

	_, err = rw.es.Save(ctx, session)

	return session, err
}

// Update is used when the stream already exists.
func (rw *User) Update(
  ctx context.Context,
  identity string,
  fn func(*domain.User) error,
) (*domain.User, error) {
	session, err := rw.GetUser(ctx, identity)
	if err != nil {
		return nil, err
	}

	if err = fn(session); err != nil {
		return nil, err
	}

	_, err = rw.es.Save(ctx, session)
	return session, err
}

⤋ Read More

second, there’s predictions. a prediction is Done when it’s made. you could add comments, explanations, models &c, but the prediction can be Done and stand there on its own. (there is a slight problem with the fact that predictions need to be updated over time, though, so there is some Piling there as well).

⤋ Read More

a simple Makefile for forwarding internet to your local machine:

SSH_HOST=https://xuu.me
PRIV_KEY=~/.ssh/id_ed25519
forward:
	LOCAL_PORT=$(HOST_PORT); sh -c "$(shell http --form POST $(SSH_HOST) pub=@$(PRIV_KEY).pub | grep ^ssh | head -1 | awk '{ print "ssh -T -p " $$4 " " $$5 " -R " $$7 " -i $(PRIV_KEY)"  }')"

⤋ Read More

@prologic@twtxt.net @jlj@twt.nfld.uk @movq@www.uninformativ.de

 /p/tmp > git clone https://www.uninformativ.de/git/lariza.git                                                                                                    Mon May 24 23:48:18 2021
Cloning into 'lariza'...
 /p/tmp > tree lariza/                                                                                                                                    12.5s  Mon May 24 23:48:32 2021
lariza/
├── BUGS
├── CHANGES
├── LICENSE
├── Makefile
├── PATCHES
├── README
├── browser.c
├── man1
│   ├── lariza.1
│   └── lariza.usage.1
├── user-scripts
│   └── hints.js
└── we_adblock.c

2 directories, 11 files

⤋ Read More

weewiki uses a custom org markup parser written in ANSI C to render the HTML. No emacs needed! my hope is to introduce a user-defined callback that can process these to allow for custom meta-commands.

⤋ Read More