Searching yarn

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

I wrote some code to try out non-hash reply subjects formatted as (replyto ), while keeping the ability to use the existing hash style.

I don’t think we need to decide all at once. If clients add support for a new method then people can use it if they like. The downside of course is that this costs developer time, so I decided to invest a few hours of my own time into a proof of concept.

With apologies to @movq@www.uninformativ.de for corrupting jenny’s beautiful code. I don’t write this expecting you to incorporate the patch, because it does complicate things and might not be a direction you want to go in. But if you like any part of this approach feel free to use bits of it; I release the patch under jenny’s current LICENCE.

Supporting both kinds of reply in jenny was complicated because each email can only have one Message-Id, and because it’s possible the target twt will not be seen until after the twt referencing it. The following patch uses an sqlite database to keep track of known (url, timestamp) pairs, as well as a separate table of (url, timestamp) pairs that haven’t been seen yet but are wanted. When one of those “wanted” twts is finally seen, the mail file gets rewritten to include the appropriate In-Reply-To header.

Patch based on jenny commit 73a5ea81.

https://www.falsifian.org/a/oDtr/patch0.txt

Not implemented:

  • Composing twts using the (replyto 
) format.
  • Probably other important things I’m forgetting.

​ Read More
In-reply-to » (replyto http://darch.dk/twtxt.txt 2024-09-15T12:50:17Z) @sorenpeter I like this idea. Just for fun, I'm using a variant in this twt. (Also because I'm curious how it non-hash subjects appear in jenny and yarn.)

I’m not advocating in either direction, btw. I haven’t made up my mind yet. 😅 Just braindumping here.

The (replyto:
) proposal is definitely more in the spirit of twtxt, I’d say. It’s much simpler, anyone can use it even with the simplest tools, no need for any client code. That is certainly a great property, if you ask me, and it’s things like that that brought me to twtxt in the first place.

I’d also say that in our tiny little community, message integrity simply doesn’t matter. Signed feeds don’t matter. I signed my feed for a while using GPG, someone else did the same, but in the end, nobody cares. The community is so tiny, there’s enough “implicit trust” or whatever you want to call it.

If twtxt/Yarn was to grow bigger, then this would become a concern again. But even Mastodon allows editing, so how much of a problem can it really be? 😅

I do have to “admit”, though, that hashes feel better. It feels good to know that we can clearly identify a certain twt. It feels more correct and stable.

Hm.

I suspect that the (replyto:
) proposal would work just as well in practice.

​ Read More
In-reply-to » (replyto http://darch.dk/twtxt.txt 2024-09-15T12:50:17Z) Hmm, but yarnd also isn't showing these twts as being part of a thread. @prologic you said yarnd respects customs subjects. Shouldn't these twts count as having a custom subject, and get threaded together?

@quark@ferengi.one It looks like the part about traditional topics has been removed from that page. Here is an old version that mentions it: https://web.archive.org/web/20221211165458/https://dev.twtxt.net/doc/twtsubjectextension.html . Still, I don’t see any description of what is actually allowed between the parentheses. May be worth noting that twtxt.net is displaying the twts with the subject stripped, so some piece of code is recognizing it as a subject (or, at least, something to be removed).

​ Read More
In-reply-to » @bender I should put the template that is used by default as a file in the repo. Look at the source for now and you'll see 😅

@aelaraji@aelaraji.com this is my change on main.go (but it can be done on a template now, so no reason to touch the code):

                                 <time class="dt-published" datetime="{{ $twt.Created | date "2006-01-02T15:04:05Z07:00" }}">
                                        {{ $twt.Created | date "2006-01-02 15:04:05 MST" }}
                                  </time>

See https://ferengi.one. I am going to further customise things, but that’s a start.

​ 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

There is a bug in yarnd that’s been around for awhile and is still present in the current version I’m running that lets a person hit a constructed URL like

YOUR_POD/external?nick=lovetocode999&uri=https://socialmphl.com/story19510368/doujin

and see a legitimate-looking page on YOUR_POD, with an HTTP code 200 (success). From that fake page you can even follow an external feed. Try it yourself, replacing “YOUR_POD” with the URL of any yarnd pod you know. Try following the feed.

I think URLs like this should return errors. They should not render HTML, nor produce legitimate-looking pages. This mechanism is ripe for DDoS attacks. My pod gets roughly 70,000 hits per day to URLs like this. Many are porn or other types of content I do not want. At this point, if it’s not fixed soon I am going to have to shut down my pod. @prologic@twtxt.net please have a look.

​ Read More
In-reply-to » Correct, @bender. Since the very beginning, my twtxt flow is very flawed. But it turns out to be an advantage for this sort of problem. :-) I still use the official (but patched) twtxt client by buckket to actually fetch and fill the cache. I think one of of the patches played around with the error reporting. This way, any problems with fetching or parsing feeds show up immediately. Once I think, I've seen enough errors, I unsubscribe.

@lyse@lyse.isobeef.org ah, if only you were to finally clean up that code, and make that client widely available
! One can only dream, right? :-)

​ Read More
In-reply-to » Kinda cool tool for bringing together all your timeline based data across socials.

yeah its the same dude.

This project is verrrry alpha. all the configuration is literally in the code.

​ 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 » @abucci / @abucci Any interesting errors pop up in the server logs since the the flaw got fixed (unbounded receieveFile())? đŸ€”

@prologic@twtxt.net I don’t think it’s your code. As you said in one of your commit comments, the internet is a hostile place! That’s partly why I reacted the way I did: all things considered it’s usually better to react quickly and clean up the mess later, then it is to wait and risk further damage. Anyway it sucks @xuu@txt.sour.is got caught up in it. Hopefully it’s all good now.

​ Read More

Regarding complexity budget, slow software, all that:

Very few people do take pride in building simple, elegant, high-quality systems, do they? Why is that? Why are huge shiny things with tons of features more attractive? đŸ€”

I never explicitly thought about this, to be honest. It was only at the back of my head. And I never tried to teach our younger “students” at work: “Hey, it’s a great achievement to build something simple and elegant. That’s something to be proud of!”

Worse, simple software is often described as “boring”. Yes, in a way, it is boring, because your brain doesn’t have to get into overdrive to understand it. But that’s exactly the point. And it’s hard to achieve that! Simple software isn’t just “fewer lines of code”, you have to be pretty clever to solve a problem in a simple and elegant way. So it’s something to be proud of.

Could this be an intuitive, emotional way to get more people on board the “simple software”-train? đŸ€”

​ Read More
In-reply-to » I've been thinking about a new term I've come across whilst reading a book. It's called "Complexity Budget" and I think it has relevant in lots of difficult fields. I specifically think it has a lot of relevant in the Software Industry and organizations in this field. When doing further research on this concept, I was only able find talks on complexity budget in the context of medical care, especially phychiratistic care. In this talk it was describe as, complexity:

@prologic@twtxt.net Hmm, yeah, hmm, I’m not sure. 😅 It all appears very subjective to me. Is 2k lines of code a lot or not?

I mean, I’m all for reducing complexity. 😅 I just have a hard time defining it and arguing about it. What I call “too complex”, others might think of as “just fine”. đŸ€”

​ Read More

@prologic@twtxt.net hey mate, all working well here so far. The login issue isn’t really an issue as far as actually logging in goes, rather if I get my password wrong it gives the response error code in console, the response of which contains the HTML for the wrong password page if you inspect it, but on the frontend itself nothing actually happens which is the confusion. Just stays on the login page as if it was never submitted. Am I alone in having this issue as well?

​ Read More
In-reply-to » Thanks again @movq !! I have figured things out and set up Jenny and Vim completion following your blog post! Cheers!

OK time to put this to the test, I ended up setting my $VISUAL env
{-here-} variable, so that jenny can launch neovim instead of plain old vi like
{-here-} it is instructed in the code. But as you can see, I still get these
{-here-} wired new lines every ~70th character (marked them with {-here-})

​ Read More
In-reply-to » yarn should define its own federation protocol that extends the basic twtxt in ways that twtxt doesn't allow. it's time. and i've got ideas!

@shreyan@twtxt.net What do you mean when you say federation protocol?

I’m not sure we need much else. I would not even bother with encryption since other platforms does that better, and for me twtxt/yarn/timeline is for making things public

​ Read More
In-reply-to » man... day17 has been a struggle for me.. i have managed to implement A* but the solve still takes about 2 minutes for me.. not sure how some are able to get it under 10 seconds.

So, I finally got day 17 to under a second on my machine. (in the test runner it takes 10)

I implemented a Fibonacci Heap to replace the priority queue to great success.

https://git.sour.is/xuu/advent-of-code/src/branch/main/search.go#L168-L268

​ Read More
In-reply-to » @xuu That was one of the horror puzzles where I had to look for help. đŸ„Ž I modelled my solution after this: https://www.youtube.com/watch?v=2pDSooPLLkI (I can’t explain it better than the video anyway.) It takes a second on my machine and that’s with my own hashmap implementation which is probably not the fastest one.

OH MY FREAKING HECK. So.. I made my pather able to run as Dijkstra or A* if the interface includes a heuristic.. when i tried without the heuristic it finished faster :|

So now to figure out why its not working right.

​ Read More
In-reply-to » @xuu That was one of the horror puzzles where I had to look for help. đŸ„Ž I modelled my solution after this: https://www.youtube.com/watch?v=2pDSooPLLkI (I can’t explain it better than the video anyway.) It takes a second on my machine and that’s with my own hashmap implementation which is probably not the fastest one.

i am wondering if maybe i need a better heap like a btree backed one instead of just list sort on Dequeue.

I found a bug where i didnt include an open/closed list that seemed to shave off a little. right now it runs in about 70 seconds on my machine.. it takes over the 300s limit when it runs on the testrunner on the same box.. docker must be restricting resources for it.

I might come back to it after i work through improving my code for day 23. Its similar but looking for the longest path instead of shortest.

​ Read More

man
 day17 has been a struggle for me.. i have managed to implement A* but the solve still takes about 2 minutes for me.. not sure how some are able to get it under 10 seconds.

Solution: https://git.sour.is/xuu/advent-of-code/src/branch/main/day17/main.go
A* PathFind: https://git.sour.is/xuu/advent-of-code/src/branch/main/search.go

some seem to simplify the seen check to only be horizontal/vertical instead of each direction.. but it doesn’t give me the right answer

​ Read More
In-reply-to » @lyse They sure are silly at times. :-) You really have to combine this event with something else, like learning a new language. Otherwise it gets boring real quick.

I have been doing interview prep for next year. The problems have been great to get practice and make it fun when compared to the dry solve this you get on hacker rank or code scene.

That and so many great write-ups to explain the problems.

​ Read More
In-reply-to » But when you do take the time to analyze / reverse-engineer this puzzle, then it’s really cool. Might be my favorite one so far. 😃

@movq@www.uninformativ.de So.. i eventually made it to the end on this one.. was able to reuse code from days 8 and 9!

SSBzdGlsbCBkbyBub3QgdW5kZXJzdGFuZCB3aHkgdXNpbmcgdGhlIHJhdGUgb2YgY2hhbmdlIGlu
IHRoZSBwdXNoZXMgZ2l2ZXMgbWUgdGhlIGFuc3dlci4uIGJ1dCB5ZWFoLi4K

https://git.sour.is/xuu/advent-of-code/pulls/13/files

​ Read More

I’m really bad at competitive programming. 🙄 For today’s #AdventOfCode puzzle, I spent an eternity trying to understand exactly what kind of bG9naWMgY2lyY3VpdAo= the puzzle input describes – I haven’t done that in well over a decade, so I made little progress. I knew right from the start that SSBoYWQgdG8gbG9vayBmb3IgY3ljbGUgbGVuZ3RocyBhbmQgdGhlbiBmaW5kIHRoZSBMQ00K. It just didn’t occur to me to just run my program on cGFydGlhbCBpbnB1dAo= and print those numbers. đŸ„Ž I only did that after over 4 hours (including time to debug my nasty C code) and then, boom, solution 


​ Read More

Today’s Advent of Code puzzle was rather easy (luckily), so I spent the day doing two other things:

  • Explore VGA a bit: How to draw pixels on DOS all by yourself without a library in graphics mode 12h?
  • Explose XMS a bit: How can I use more than 640 kB / 1 MB on DOS?

Both are 
 quite awkward. 😬 For VGA, I’ll stick to using the Borland Graphics Interface for now. Mode 13h is great, all pixels are directly addressable – but it’s only 320x200. Mode 12h (640 x 480 with 16 colors) is pretty horrible to use with all the planes and what not.

As per this spec, I’ve written a small XMS example that uses 32 MB of memory:

https://movq.de/v/9ed329b401/xms.c

It works, but it appears the only way to make use of this memory is to copy data back and forth between conventional memory and extended memory. I don’t know how useful that is going to be. đŸ€” But at least I know how it works now.

Image

​ Read More
In-reply-to » @movq It took a little over a minute on my machine.. i should try to make it multi threaded.. đŸ€”

All brute force.

Its the latest ryzen 7 chipset for laptop/mini form factor.

I am very surprised about the times others are getting. I guess that’s the difference between interpreted and compiled showing.

​ Read More