From b7e9d065a2f275770b7031a0b5d4b7a18c0180af Mon Sep 17 00:00:00 2001 From: polpetta Date: Wed, 19 May 2021 21:47:51 +0000 Subject: [PATCH] Add spellchecker (#5) * Add entries into dictionary * Add spellchecker * Update CI * Fix first article Co-authored-by: Davide Polonio Reviewed-on: https://git.poldebra.me/polpetta/bitdispenser.dev/pulls/5 --- .drone.yml | 4 ++++ content/english/posts/hello-world.md | 28 ++++++++++++++-------------- package.json | 3 ++- tools/dictionary.en.pws | 25 +++++++++++++++++++++++++ tools/spellchecker.sh | 25 +++++++++++++++++++++++++ 5 files changed, 70 insertions(+), 15 deletions(-) create mode 100644 tools/dictionary.en.pws create mode 100755 tools/spellchecker.sh diff --git a/.drone.yml b/.drone.yml index 1ba824e..923641b 100644 --- a/.drone.yml +++ b/.drone.yml @@ -8,6 +8,10 @@ steps: commands: - npm install - npm run lint + - name: spellchecker checks + image: polpetta/spellchecker + commands: + - ./tools/spellchecker.sh en - name: hugo build image: klakegg/hugo:0.82.1-ext-alpine-ci commands: diff --git a/content/english/posts/hello-world.md b/content/english/posts/hello-world.md index bdb65c5..41cf0f0 100644 --- a/content/english/posts/hello-world.md +++ b/content/english/posts/hello-world.md @@ -56,12 +56,12 @@ his dispenser` caption=`Engineer class with a dispenser. Thanks to [Team Fortress wiki](https://wiki.teamfortress.com) for providing the image I shamelessly downloaded from them` >}} -I hope Valve will not sue me for taking that assed as my website favicon. I +I hope Valve will not sue me for taking that asset as my website favicon. I swear I will change it, a day. Pinky promise. ### Hosting -The real problem of hosting a website nowday is not how to build it (as you can +The real problem of hosting a website now day is not how to build it (as you can see) but _where_ you can host it. There are plenty of cloud provides: AWS, Google Cloud, DigitalOcean, Scaleway, etc... every day there is a new one popping up. They all offers the possibility to host your website pretty easily, @@ -84,12 +84,12 @@ while trying to kill the boredom caused by COVID-19 lockdown, I discovered bothered too much to understand what was about. I though "well, it surely is some sort of filesystem". I was somewhat right, but not the way I thought. -IPFS acts like a peer-to-peer network, where nodes hash the content -they want to share to let other nodes grab it. You can grab this content using -your local node or using one of the many available gateways. Nodes can "pin" a -file too, in order to keep it locally and to serve it to other nodes. If a file -gets pinned by different nodes and gains traction it basically becomes -undeletable from the web. +IPFS acts like a peer-to-peer network, where nodes hash the content they want to +share to let other nodes grab it. You can grab this content using your local +node or using one of the many available gateways. Nodes can "pin" a file too, in +order to keep it locally and to serve it to other nodes. If a file gets pinned +by different nodes and gains traction it basically can not be deleted from the +web. #### Choosing the right tools @@ -113,10 +113,10 @@ Finally, in order to achieve full automation with DNS updates, I would have needed to implement and use NameCheap APIs (currently it is the DNS provider I use for most of my websites). "What's the difficulty?" one would ask. [Here is the official documentation](https://www.namecheap.com/support/api/intro/), and -even if the APIs look promising, while studing them my will to live decreased a +even if the APIs look promising, while studying them my will to live decreased a little bit, and so I decided that if I wanted to get up and running with less maintenance as possible, with a good uptime while having the maximum -automatization possible I needed to rely on a dedicated service. Luckily +automation possible I needed to rely on a dedicated service. Luckily [fleek.co](https://fleek.co) was what I was searching for. They currently provide the possibility to buy a domain from their website, giving them all the hassle of updating the new website on IPFS, distributing it, refreshing a very @@ -131,10 +131,10 @@ imagine, provides multiple benefits: to understand why the website does not load/the DNS is not properly updated The only downside to this approach is that Fleek provides limitations on how -much data and bandwith you can host. At the time of writing, you can only host -up to 3GB (enough for this website) and have a 50GB bandwith (that's ok for now) -for the free version. [Upgrading you account](https://fleek.co/pricing/) to one -of the available plans give you extra space and bandwith. +much data and bandwidth you can host. At the time of writing, you can only host +up to 3GB (enough for this website) and have a 50GB bandwidth (that is fine for +now) for the free version. [Upgrading you account](https://fleek.co/pricing/) to +one of the available plans give you extra space and bandwidth. ## Future improvements diff --git a/package.json b/package.json index 258f3dc..4ad5974 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,8 @@ "description": "Personal Hugo website", "main": "none.js", "scripts": { - "lint": "markdownlint-cli2 content/" + "lint": "markdownlint-cli2 content/", + "spellchecker": "bash tools/spellchecker.sh en" }, "repository": { "type": "git", diff --git a/tools/dictionary.en.pws b/tools/dictionary.en.pws new file mode 100644 index 0000000..60c7813 --- /dev/null +++ b/tools/dictionary.en.pws @@ -0,0 +1,25 @@ +personal_ws-1.1 en 0 +engiwithdispenser +Github +fleek +Fleek +Mies +der +Rohe's +favicon +src +png +Pinky +DigitalOcean +Scaleway +uptime +lockdown +filesystem +IPFS +vCPU +CDN +DNS +NameCheap +APIs +fediverse +COVID \ No newline at end of file diff --git a/tools/spellchecker.sh b/tools/spellchecker.sh new file mode 100755 index 0000000..f363866 --- /dev/null +++ b/tools/spellchecker.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +set -e + +reporoot="$(git rev-parse --show-toplevel)" +lang="${1}" +if [ -z "${2}" ] +then + texdir="/content/english" +else + texdir="${2}" +fi +echo "Checking files in ${reporoot}${texdir}" +for i in $(find "${reporoot}${texdir}" -type f -iname "*.md") +do + tmp="$(cat "${i}" | aspell -M -a --lang="${lang}" --encoding=utf-8 --add-extra-dicts="${reporoot}/tools/dictionary.$1.pws" 2>/dev/null | grep -v "*" | grep -v "@" | grep -v "+" | sed '/^\s*$/d')" + if [ "${tmp}" != "" ] + then + echo "******* List of errors detected for ${i} *******" + echo "${tmp}" + exit 1 + else + echo "${i} OK" + fi +done