You can explicitly use colors in manpages. I saw this in the apt
manpage of Ubuntu recently, which, for some reason, uses blue text in one place:
https://movq.de/v/de5ab72016/s.png
Makes little sense to me. Iâm glad that most manpages donât do this. I wouldnât want unicorn vomit all over the place.
Using colors can be done using the low level commands \m
and \M
:
.TH foo_program 3
\m[blue]I'm blue\m[], da ba dee.
\m[red]\M[yellow]I'm red on yellow.\m[]\M[]
This is quite horrible.
@kat@yarn.girlonthemoon.xyz On the one hand, all these programs have a very long history and the technology behind manpages is actually very powerful â you can use it to write books:
https://www.troff.org/pubs.html
I have two books from that list, for example âThe UNIX programming environmentâ:
https://movq.de/v/c3dab75c97/upe.jpg
Itâs a bit older, of course, but it looks and feels like a normal book, and it uses the same tech as manpages â which I think is really cool. đ
Itâs comparable to LaTeX (just harder/different to use) but much faster than LaTeX. You can also do stuff like render manpages as a PDF (man -Tpdf cp >cp.pdf
) or as an HTML file (man -Thtml cp >cp.html
). I think I once made slides for a talk this way.
On the other hand, traditional manpages (i.e., ones that are not written in mandoc) do not use semantic markup. They literally say, âthis text is bold, that text over here is italicsâ, and so on.
So when you run man foo
, it has no other choice but to show it in black, white, bold, underline â showing it in color would be wrong, because thatâs not what the source code of that manpage says.
Colorizing them is a hack, to be honest. Youâre not meant to do this. (The devs actually broke this by accident recently. They themselves arenât really aware that people use colors.)
If mandoc and semantic markup was more commonly used, I think it would be easier to convince the devs to add proper customizable colors.
@lyse@lyse.isobeef.org defn foo(_ x _): # Ignored arguments
@aelaraji@aelaraji.com I use Alt+.
all the time, itâs great. đ
FWIW, another thing I often use is !!
to recall the entire previous command line:
$ find -iname '*foo*'
./This is a foo file.txt
$ cat "$(!!)"
cat "$(find -iname '*foo*')"
This is just a test.
Yep!
Or:
$ ls -al subdir
ls: cannot open directory 'subdir': Permission denied
$ sudo !!
sudo ls -al subdir
total 0
drwx------ 2 root root 60 Jun 20 19:39 .
drwx------ 7 jess jess 360 Jun 20 19:39 ..
-rw-r--r-- 1 root root 0 Jun 20 19:39 nothing-to-see
fn sub(foo: &String) {
println!("We got this string: [{}]", foo);
}
fn main() {
// "Hello", 0x00, 0x00, "!"
let buf: [u8; 8] = [0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x00, 0x00, 0x21];
// Create a string from the byte array above, interpret as UTF-8, ignore decoding errors.
let lossy_unicode = String::from_utf8_lossy(&buf).to_string();
sub(&lossy_unicode);
}
Create a string from a byte array, but the result isnât a string, itâs a cow đŽ, so you need another to_string()
to convert your âstringâ into a string.
- https://doc.rust-lang.org/std/string/struct.String.html#method.from_utf8_lossy
- https://doc.rust-lang.org/std/borrow/enum.Cow.html
I still have a lot to learn.
(into_owned()
instead of to_string()
also works and makes more sense to me, itâs just that the compiler suggested to_string()
first, which led to this funny example.)
tar
and find
were written by the devil to make sysadmins even more miserable
@kat@yarn.girlonthemoon.xyz @movq@www.uninformativ.de @prologic@twtxt.net Yeah, Iâm also having them in my repertoire for ages, so Iâm used to the weird command line options. From todayâs perspective, theyâre not consistent with the rest of the typical shell utilities, thatâs for sure.
Regarding find | grep foo
, I recommend find -name '*foo*'
, prologic. Also, I regularly use -type d
and -type f
to find directories or files.
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://txt.sour.is/search?q=%23123467">#123467</a>) hello foo bar
you would have
(<a href="https://txt.sour.is/search?q=%23123467">#123467</a> http://foo.com/tw.txt) hello foo bar
or maybe even:
(<a href="https://txt.sour.is/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.
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.
[foo] foo ?
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.
@mckinley@twtxt.net Donât forget the syntax for arrays of sets [[foo.bars]] [[foo.bars]] [[foo.bars]]
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.
FOLLOW: @foo@txt.sour.is from @foo@txt.sour.is using twtxt/0.1.0@9fdcb47