Thanks Peter! There’s a few obvious improvements (configuration of the message format, a more general way of handling how the incoming request is handled – support GET, etc) but I also like that it’s small, simple, and opinionated, as it evolved from a fairly simple use-case. This is my first use of generics in Go, and I really like how I was able to link the handler functions to the dependency type on the server struct to allow you to inject whatever your handlers need to do their work. It’s a good use of generics there, I think.
I’m working on a CLI tool (in Go) for processing JSON documents of varying structures and finding predefined meta keys that hold “commands”. Right now I’m adding a “:speak” command that tells the tool to generate speech by reading the text at a given source key, generating the speech, and writing the mp3’s path back to the JSON file under a given “destination” key. It’ll be used to generate audio for various language learning components, which each have their own JSON files.
Among other things I’ll be making some physical things for once - just some playing cards for the social game Werewolf, which I’ll be hosting next week… in Esperanto!
I was entertained by configuration entries:
{ "match": "sij", "replace": "ssij" },
{ "match": "sssij", "replace": "ssij" },
For some context - ssij
mean suck
in Polish.
I’m adding some small features to Station, the mini social network for Gemini I launched about 3 months ago. It’s over 220 folks now and already a nice little community (original story: https://lobste.rs/s/wrkijb/i_made_mini_social_network_for_people_hang)
I’ve been hanging out in Barcelona with some Esperanto friends for the last 6 weeks. I caught The Virus 2 days before my flight home, so had to stay long enough to get better (I had pretty bad symptoms) and get a negative PCR result. I finally got home yesterday and it feels so good! Now I need to quarantine for 10 days according to the rules here. In fact, I’m really looking forward to just reading and working on a personal project, and taking advantage of the 10 days to have a nice simple life :)
For the 4-day weekend I’m taking part in an Esperanto conference with 250+ other speakers: https://retoso2021.tejo.org.
Latest reply ever, but I blame 🦞 for only just notifying me about this reply… apologies. I wrote about some of my earlier experiences and what got me hooked on the language here: https://martinrue.com/seek-out-new-experiences and https://martinrue.com/the-equality-of-esperanto, if you’re curious :)
I blogged about my favourite bug during my early years learning to write C code. Years afterwards I even named my company after the experience. https://martinrue.com/zzuy-a-lesson-in-perseverance/
If anyone is looking for some more BASIC nostalgia, here’s a related story from my childhood: https://martinrue.com/give-yourself-more-playtime/
A little menubar app (macOS) to quickly check word pronunciations via Forvo. Really helps me when studying a language and wondering about the rhythm or tone of a new word: https://github.com/martinrue/forvilo
I just finished rebuilding my own blog. It was previously a Jekyll site, but I wanted something that required no tools (at the cost of some duplication) and would happily sit there for the next 5 years without needing my attention. It’s now just boring old HTML5/CSS with a sprinkle of JS, and it feels much better.
OK, this is a random one, but I’ve really gotten into Esperanto (the constructed language) over the last 3 years. This weekend there are 3 separate events (in Iran, France, and London) with everything from games to concerts (yeah – Esperanto has it’s own music and music groups, believe it or not). So, I’ll be internet surfing between those, and spending most of the weekend hanging out in a language that was invented 130 years ago by a crazy Polish doctor :)
Never do this, it is too easy to mis-use, leading to things like deadlocks and spaghetti synchronization. Mutexes should always be unexported fields, accessed only by methods.
Longer discussion here (warning: also Twitter thread).
This is a good counter point. In this contrived example I’m only accessing the mutex inside the struct’s one add
function, but I hadn’t considered that by embedding the mutex it effectively exports it since Lock
and Unlock
are available at the same level as add
itself. Thanks.
I’m a fan of https://usefathom.com. It’s very minimal, but I don’t have many requirements, so it suits my needs pretty well. I like that it’s a single Go binary, which I run on a $5/month Digital Ocean droplet.
Please note that while this may currently work, it is no longer being maintained and is very different from the paid Fathom Analytics product. I built the initial open-source version of Fathom that you are running, but after I left the project moved to a centralized and closed-source model.
BTW, a story of mine: When I was in high school, we had a class to teach us how to type on the keyboard efficiently. The classes consisted of using a training software, and the grades were given mostly by the score we achieved there. We could run the program on other computers in the school as well and do some lessons in the spare time.
While never intentionally learning how to use the keyboard properly, over the years of coding and spending hours on IRC, I learned to type pretty fast, so I always was far ahead. However, some of my friends struggled with this and I was helping them. But this was boring.
So naturally, I went ahead and wrote a simple program to type in the window automatically. During a break, I gathered a group of friends, took them to the computer and intended to demonstrate them this incredible time-and-effort-saving creation of mine. I opened one of the lessons, where we had to type a single sentence as many times as possible, fired up my program, typed the sentence there and pressed the “Start” button. It worked perfect, except… I made a typo.
At around 800 bpm, it wrote the errorneous input all over again in a lesson, where it was particularly important to type as accurately as possible. Few seconds later, the lesson was over, because there were too many mistakes, and it threw me back to the previous lesson. But the expected input in that lesson was completely different, so it kicked me even faster. And it continued doing that for over and over again.
Before I finally managed to kill the program, I lost about two weeks worth of progress. But the program got popular nonetheless as they understood it worked properly, I only entered an invalid input. Later on, an IT teacher asked me to demonstrate it for him. My memory is faint on that part, but I think nothing happened at all. I’m sure he would ban it if he knew how, but he wasn’t very good.
Cool story… I love the irony that you built it to speed up your results but it caused the opposite to happen in the end… that’s probably a metaphor for about 50% of everything I do in my code :)
It would have been great if you made it only type when the user pressed a key, so people could mash the keys as quickly as possible and have 100% correct output come out. Since you were just using it for training, though, your way makes sense too.
Are you me?
Did almost the exact same thing back in elementary/middle school.
Loaded it up onto my purple 64mb JumpDrive that had cost me a small fortune so I could run it on any of the computers.
Same here on Mavis Beacon. Except, the hackers weren’t impressed. So, we changed the challenge to seeing what numbers we could get doing that by hand on the actual keyboard. I can’t remember the number but it was insane.
He’d have known the machine I was logged into wasn’t allowing him to connect, but I suppose he wouldn’t know why. I killed it about 3 times in total, but he never came over to me to check. I assume he simply never tried connecting to me during those times, or if he did, he thought it was just a temporary problem (rather than one of my own doing :)).
OK. I wondered whether he just didn’t see some list of running instances and if you killed yours, he wouldn’t notice at all. :)
I really like the simple approach this project takes! Out of curiosity, have you thought about a way to validate the query via a schema or some kind of IDL?
EDIT: Is it possible to use another format than JSON, like MessagePack for example?
That’s a good suggestion. For now it’s a case of “do the simplest thing that works”, so there are a few improvements that could still be added. Regarding MessagePack, it’d be easy to swap out the handling of the command JSON to use MessagePack, but you’d need to fork for that. I’ve not abstracted that logic to be swapped out. I’ll have a think about that though!
Thank you very much for this information, I will follow your project! :-)
EDIT: GitHub displays indentations with too many spaces, so I suggest to use spaces instead for the examples in the README.md, it would probably be more readable!