aboutsummaryrefslogtreecommitdiff
path: root/content/blog/miscellaneous
diff options
context:
space:
mode:
authorJulien Dessaux2024-04-03 01:00:24 +0200
committerJulien Dessaux2024-04-03 01:00:24 +0200
commit4a32ae22e54ccd3b465b1d3a03892eed82e9a2d2 (patch)
tree562376407f558790fc70e46f690885720ee58556 /content/blog/miscellaneous
parentAdded ods blog article (diff)
downloadwww-4a32ae22e54ccd3b465b1d3a03892eed82e9a2d2.tar.gz
www-4a32ae22e54ccd3b465b1d3a03892eed82e9a2d2.tar.bz2
www-4a32ae22e54ccd3b465b1d3a03892eed82e9a2d2.zip
typos in last article
Diffstat (limited to 'content/blog/miscellaneous')
-rw-r--r--content/blog/miscellaneous/ods.md14
1 files changed, 7 insertions, 7 deletions
diff --git a/content/blog/miscellaneous/ods.md b/content/blog/miscellaneous/ods.md
index e88b6c4..1d2d298 100644
--- a/content/blog/miscellaneous/ods.md
+++ b/content/blog/miscellaneous/ods.md
@@ -12,26 +12,26 @@ After seeing my parents use mobile applications full of ads just to check if a w
## The project
-### The dictionnary
+### The dictionary
-The "Officiel Du Scrabble" (ODS for short) is what the official dictionnary for this game is called. One very sad thing is that this dictionnary is not free! You cannot download it digitally, which seems crazy for a simple list of words. You might use your google-fu and maybe find it on some random github account if you look for it, but I certainly did not.
+The "Officiel Du Scrabble" (ODS for short) is what the official dictionary for this game is called. One very sad thing is that this dictionary is not free! You cannot download it digitally, which seems crazy for a simple list of words. You might use your google-fu and maybe find it on some random GitHub account if you look for it, but I certainly did not.
### The web service
Here is what I have to say about this [80 lines go program](https://git.adyxax.org/adyxax/ods/tree/main.go):
- The first lines are the necessary imports.
- The next ones are dedicated to embedding all the files into a single binary.
-- The compilation of the html template follows, with the definition of a struct type necessary for its rendering.
+- The compilation of the HTML template follows, with the definition of a struct type necessary for its rendering.
- Then come the two http handlers.
- Finally the main function that defines the http routes and starts the server.
-While it does not feel optimal in terms of validation since I am not parsing the users' input, this input is normalized: accents and diacritics are converted to the corresponding ASCII character and spaces are trimed at the beginning and at the end of the input. Then it is a simple matter of comparing strings while iterating over the full list of words.
+While it does not feel optimal in terms of validation since I am not parsing the users' input, this input is normalized: accents and diacritics are converted to the corresponding ASCII character and spaces are trimmed at the beginning and at the end of the input. Then it is a simple matter of comparing strings while iterating over the full list of words.
Building a trie would make the search a lot faster, but the simplest loop takes less than 2ms on my server and therefore is good enough for a service that will barely peak at a few requests per minutes.
### Hosting
-I build a static binary with `CGO_ENABLED=0 go build -ldflags "-s -w -extldflags \"-static\"" .` and since there is no `/usr/local` on nixos I simply copy this static binary to `/srv/ods/ods`. The nixos way would be to write a derivation but I find it too unwieldly for such a simple use case.
+I build a static binary with `CGO_ENABLED=0 go build -ldflags "-s -w -extldflags \"-static\"" .` and since there is no `/usr/local` on nixos I simply copy this static binary to `/srv/ods/ods`. The nixos way would be to write a derivation but I find it too unwieldily for such a simple use case.
Here is the rest of the relevant configuration:
@@ -91,11 +91,11 @@ Here is the rest of the relevant configuration:
}
```
-This defines a nginx virtualhost that proxifies requests to our service, along with a systemd unit that will ensute our service is running.
+This defines a nginx virtual host that proxifies requests to our service, along with a systemd unit that will ensure our service is running.
### DNS
-My DNS records are set via opentofu (terraform) and look like:
+My DNS records are set via OpenTofu (terraform) and look like:
``` hcl
resource "cloudflare_record" "ods-cname-adyxax-org" {