If we must stick to hashes for threading, can we maybe make it mandatory to always include a reference to the original twt URL when writing replies?
Instead of
(<a href="https://yarn.girlonthemoon.xyz/search?q=%23123467">#123467</a>) hello foo bar
you would have
(<a href="https://yarn.girlonthemoon.xyz/search?q=%23123467">#123467</a> http://foo.com/tw.txt) hello foo bar
or maybe even:
(<a href="https://yarn.girlonthemoon.xyz/search?q=%23123467">#123467</a> 2025-04-30T12:30:31Z http://foo.com/tw.txt) hello foo bar
This would greatly help in reconstructing broken threads, since hashes are obviously unfortunately one-way tickets. The URL/timestamp would not be used for threading, just for discovery of feeds that you don’t already follow.
I don’t insist on including the timestamp, but having some idea which feed we’re talking about would help a lot.
Regex Isn’t Hard - Tim Kellogg 👈 this is a pretty good conscience article on regexes, and I agree, regex isn’t that hard™ – However I think I can make the TL;DR even shorter 😅
Regex core subset (portable across languages):
Character sets
• a matches “a”
• [a-z] any lowercase
• [a-zA-Z0-9] alphanumeric
• [^ab] any char but a or b
Repetition (applies to the preceding atom)
• ? zero or one
• * zero or more
• + one or more
Groups
• (ab)+ matches “ab”, “abab”, …
• Capture for extract/substitute via $1 or \1
Operators
• foo|bar = foo or bar
• ^ start anchor
• $ end anchor
Ignore non‑portable shortcuts: \w, ., {n}, *?, lookarounds.
@prologic@twtxt.net Yes, C has it. I even thought that C invented it, but it seems to stem from CPL.
The closest to get to if expressions at the moment is to use a lambda:
foo := func() {
if bar {
return "spam"
}
return "eggs"
}()
But that’s also not elegant at all.
?
operator in Go 👈 No. For so many reasons.
@prologic@twtxt.net Which one? I don’t mind the ternary operator at all. In fact, I often find myself missing it in Go. I don’t find the two alternatives particularly elegant:
foo := "eggs"
if bar {
foo = "spam"
}
Or:
var foo string
if bar {
foo = "spam"
} else {
foo = "eggs"
}
To my eye, this just would look a lot nicer:
foo := bar ? "spam" : "eggs"
Or at least as the Pythons do it:
foo = "spam" if bar else "eggs"
The ternary operator especially shines with relatively short expressions.
hmm this would convert down to:
var f os.File
if f, e = os.Open("foo.txt"); e != nil {
log.Fatal("error opening file; %s", e)
}
im not sure if its much better.
I want to propose my own counter-proposal to the discussion that’s ongoing with Go and error handling.
Here it is: https://docs.mills.io/ix4qDHMnQUSPxZ5tXz12Vg?view
It’s very rough and needs much more work, but essentially I want to propose the following change to the language’s grammar:
f := os.Open("foo.txt") or (e error) {
log.Fatal("error opening file; %s", e)
}
Yarn spoiler test:
! foo
@cuaxolotl@sunshinegardens.org Ah, thanks for reporting back! Okay, so you’re basically manually “crawling” feeds right now. 🤔 What do you think about the idea of adding something like # follow_notify = gemini://foo/bar
to your feed’s metadata, so that clients who follow you can ping that URL every now and then? How would you even notice that, do you regularly read your gemini logs? 🤔
Seriously, why would you use nnn, vifm, ranger or foo when you have rover? Tabs, copy/move/delete, easy-to-configure file open, … an #openbsd port is required ^^ https://github.com/lecram/rover
I love shell scripts because they’re so pragmatic and often allow me to get jobs done really quickly.
But sadly they’re full of pitfalls. Pitfalls everywhere you look.
Today, a coworker – who’s highly skilled, not a newbie by any means – ran into this:
$ bash -c 'set -u; foo=bar; if [[ "$foo" -eq "bar" ]]; then echo it matches; fi'
bash: line 1: bar: unbound variable
Why’s that happening? I know the answer. Do you? 😂
Stuff like that made me stop using shell scripts at work, unless they’re just 4 or 5 lines of absolutely trivial code. It’s now Python instead, even though the code is often much longer and clunkier, but at least people will understand it more easily and not trip over it when they make a tiny change.
@xuu@txt.sour.is foo who? 😆
[foo] foo ?
It’s also (expectedly) in the feed file on disk:
2024-08-04T21:22:05+10:00 [foo][foo=][foo][foo=]
@prologic@twtxt.net Try hitting this URL:
https://twtxt.net/external?nick=nosuchuser&uri=https://foo.com
Change nosuchuser
to any phrase at all.
If you hit https://twtxt.net/external?nick=nosuchuser , you’re given an error. If you hit that URL above with the uri
parameter, you can a legitimate-looking page. I think that is a bug.
Maybe interesting for the next webzine #openbsd issue? https://foo.zone/gemfeed/2024-04-01-KISS-high-availability-with-OpenBSD.html <@solene@bsd.network>
I can query the configurations a few different ways. i can request the specific name foo.bar
or a glob like foo.*
or trace the hierarchy trace:some.deep.name.space
which will give me the namespaces some
, some.deep
, some.deep.name
, and some.deep.name.space
. These can be combined.
@lyse@lyse.isobeef.org its a hierarchy key value format. I designed it for the network peering tools i use.. I can grant access to different parts of the tree to other users.. kinda like directory permissions. a basic example of the format is:
@namespace
# multi
# line
# comment
root :value
# example space comment
@namespace.name space-tag
# attribute comments
attribute attr-tag :value for attribute
# attribute with multiple
# lines of values
foo :bar
:bin
:baz
repeated :value1
repeated :value2
each @
starts the definition of a namespace kinda like [name]
in ini format. It can have comments that show up before. then each attribute is key :value
and can have their own #
comment lines.
Values can be multi line.. and also repeated..
the namespaces and values can also have little meta data tags added to them.
the service can define webhooks/mqtt topics to be notified when the configs are updated. That way it can deploy the changes out when they are updated.
[foo] [foo.bar] [foo.baz]
) and it just feels confusing to me, even with indentation. Simple INI files are okay.
@mckinley@twtxt.net Don’t forget the syntax for arrays of sets [[foo.bars]] [[foo.bars]] [[foo.bars]]
@lyse@lyse.isobeef.org Lack of comments are definitely a shortcoming of JSON. I don’t like TOML because it lets you have nested categories ([foo] [foo.bar] [foo.baz]
) and it just feels confusing to me, even with indentation. Simple INI files are okay.
The Prosody XMPP server’s configuration file is just a Lua script because Prosody is written in Lua, and that’s excellent.
I guess I’m read for bed. Instead of grep -rin foo
I just typed rm -rf foo
. What the heck, brain!? O_o Luckily, I just caught it before hitting Enter.
go mills()
😅
So. Some bits.
i := fIndex(xs, 5.6)
Can also be
i := Index(xs, 5.6)
The compiler can infer the type automatically. Looks like you mention that later.
Also the infer is super smart.. You can define functions that take functions with generic types in the arguments. This can be useful for a generic value mapper for a repository
func Map[U,V any](rows []U, fn func(U) V) []V {
out := make([]V, len(rows))
for i := range rows { out = fn(rows[i]) }
return out
}
rows := []int{1,2,3}
out := Map(rows, func(v int) uint64 { return uint64(v) })
I am pretty sure the type parameters goes the other way with the type name first and constraint second.
func Foo[comparable T](xs T, s T) int
Should be
func Foo[T comparable](xs T, s T) int
@prologic@twtxt.net “_foo_”
@prologic@twtxt.net “foo”
@prologic@twtxt.netYes, I think tags should just be #foo, and let the client figure out searching if it cares.
I don’t have any issue with the (foo) subjects, it’s the proliferation of the (foo url) tags. They’re just too long and ugly.
I don’t think I’m implementing twtxt.net-style hashtags (for now?). The “” is bad enough for nicks, but they just make the plain text unreadable.