Searching yarn

Twts matching #foo
Sort by: Newest, Oldest, Most Relevant

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.

⤋ Read More

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.

#regex101

⤋ Read More
In-reply-to » @prologic 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:

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

⤋ Read More
In-reply-to » My take on the discussion to introduce an ? 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.

⤋ Read More
In-reply-to » I want to propose my own counter-proposal to the discussion that's ongoing with Go and error handling.

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.

⤋ Read More

@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? 🤔

⤋ Read More

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.

⤋ Read More
In-reply-to » @lyse As far as I know, they're still visible in the Web UI. Although, in the mobile app and youtube.com, I believe it tells you that the video isn't available without having to click on it. They don't tell you that in the RSS feed, and I agree; it gets annoying.

It’s also (expectedly) in the feed file on disk:

2024-08-04T21:22:05+10:00	[foo][foo=][foo][foo=]

⤋ Read More
In-reply-to » @stigatle / @abucci My current working theory is that there is an asshole out there that has a feed that both your pods are fetching with a multi-GB avatar URL advertised in their feed's preamble (metadata). I'd love for you both to review this PR, and once merged, re-roll your pods and dump your respective caches and share with me using https://gist.mills.io/

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

⤋ Read More
In-reply-to » Yeah, the lack of comments makes regular JSON not a good configuration format in my view. Also, putting all keys in quotes and the use of commas is annoying. The big upside is that's in lots of standard libraries.

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.

⤋ Read More
In-reply-to » Yeah, the lack of comments makes regular JSON not a good configuration format in my view. Also, putting all keys in quotes and the use of commas is annoying. The big upside is that's in lots of standard libraries.

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

Image

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.

⤋ Read More
In-reply-to » @lyse 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.

@mckinley@twtxt.net Don’t forget the syntax for arrays of sets [[foo.bars]] [[foo.bars]] [[foo.bars]]

⤋ Read More
In-reply-to » Question of the day: What configuration file formats do you all like and use?

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

⤋ Read More
In-reply-to » slides/go-generics.md at main - slides - Mills -- I'm presenting this tomorrow at work, something I do every Wednesday to teach colleagues about Go concepts, aptly called 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

⤋ Read More