diff options
-rw-r--r-- | Gemfile | 4 | ||||
-rw-r--r-- | Gemfile.lock | 8 | ||||
-rw-r--r-- | TODOs.org | 5 | ||||
-rw-r--r-- | _config.yml | 5 | ||||
-rw-r--r-- | _layouts/default.html | 2 | ||||
-rw-r--r-- | _pastebins/inconsistent-hash-of-buildgomodule.md | 26 | ||||
-rw-r--r-- | _pastebins/nix-exps.md | 3 | ||||
-rw-r--r-- | _pastebins/nix-show-derivation.md | 3 | ||||
-rw-r--r-- | _pastebins/raku-tuple-type-annotation.md | 4 | ||||
-rw-r--r-- | _posts/2018-07-17-rodando-guix-on-nixos.md | 8 | ||||
-rw-r--r-- | _posts/2018-07-17-running-guix-on-nixos.md | 37 | ||||
-rw-r--r-- | _posts/2018-08-01-verifying-npm-ci-reproducibility.md | 104 | ||||
-rw-r--r-- | _posts/2018-12-21-using-youtube-dl-to-manage-youtube-subscriptions.md | 100 | ||||
-rw-r--r-- | _posts/2019-06-02-stateless-os.md | 54 | ||||
-rw-r--r-- | about.md | 8 | ||||
-rw-r--r-- | gemset.nix | 33 | ||||
-rw-r--r-- | sobre.md | 18 |
17 files changed, 178 insertions, 244 deletions
@@ -1,7 +1,3 @@ source "https://rubygems.org" gem "jekyll" - -group :jekyll_plugins do - gem 'jekyll-commonmark' -end diff --git a/Gemfile.lock b/Gemfile.lock index ec534ca..58faf53 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -4,8 +4,6 @@ GEM addressable (2.7.0) public_suffix (>= 2.0.2, < 5.0) colorator (1.1.0) - commonmarker (0.21.0) - ruby-enum (~> 0.5) concurrent-ruby (1.1.5) em-websocket (0.5.1) eventmachine (>= 0.12.9) @@ -29,9 +27,6 @@ GEM pathutil (~> 0.9) rouge (>= 1.7, < 4) safe_yaml (~> 1.0) - jekyll-commonmark (1.3.1) - commonmarker (~> 0.14) - jekyll (>= 3.7, < 5.0) jekyll-sass-converter (1.5.2) sass (~> 3.4) jekyll-watch (2.2.1) @@ -49,8 +44,6 @@ GEM rb-inotify (0.10.1) ffi (~> 1.0) rouge (3.13.0) - ruby-enum (0.7.2) - i18n safe_yaml (1.0.5) sass (3.7.4) sass-listen (~> 4.0.0) @@ -63,7 +56,6 @@ PLATFORMS DEPENDENCIES jekyll - jekyll-commonmark BUNDLED WITH 1.17.3 @@ -1,5 +1,4 @@ * Tasks ** Spelling -** Indent XML and HTML -** Drafts in feed -** Fix markdown of posts and pastebins +** Assert line length +** Line number diff --git a/_config.yml b/_config.yml index 9f6cca1..8eabae1 100644 --- a/_config.yml +++ b/_config.yml @@ -5,8 +5,6 @@ author: name: EuAndreh email: eu@euandre.org -markdown: CommonMark - exclude: - Gemfile - Gemfile.lock @@ -29,6 +27,9 @@ t: about: en: "About" pt: "Sobre" + about_url: + en: '/about.html' + pt: '/sobre.html' home: en: "EuAndreh's blog" pt: "Blog do EuAndreh" diff --git a/_layouts/default.html b/_layouts/default.html index c33b960..109d408 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -48,7 +48,7 @@ {% endif %} </ul> - <a href="/about.html">{{ site.t.about[page.lang] }}</a> + <a href="{{ site.t.about_url[page.lang] }}">{{ site.t.about[page.lang] }}</a> <a href="{{ site.t.feed_url[page.lang] }}"> <img class="simple-icon" src="/images/atom.svg" alt="{{ site.t.alt.blog_feed[page.lang] }}" /> </a> diff --git a/_pastebins/inconsistent-hash-of-buildgomodule.md b/_pastebins/inconsistent-hash-of-buildgomodule.md index 87663c5..a15033d 100644 --- a/_pastebins/inconsistent-hash-of-buildgomodule.md +++ b/_pastebins/inconsistent-hash-of-buildgomodule.md @@ -2,19 +2,17 @@ title: Inconsistent hash of buildGoModule date: 2019-06-08 layout: pastebin +lang: en --- [FIXED](https://discourse.nixos.org/t/inconsistent-hash-of-buildgomodule/3127/2). -The [commit that made this -visible](https://git.sr.ht/~euandreh/vps/commit/6ba76140238b5e3c7009c201f9f80ac86063f438). +The [commit that made this visible](https://git.sr.ht/~euandreh/vps/commit/6ba76140238b5e3c7009c201f9f80ac86063f438). -Offending derivation: -===================== +# Offending derivation: -[Full source code on -sr.ht](https://git.sr.ht/~euandreh/vps/tree/6ba76140238b5e3c7009c201f9f80ac86063f438/default.nix#L3-15): +[Full source code on sr.ht](https://git.sr.ht/~euandreh/vps/tree/6ba76140238b5e3c7009c201f9f80ac86063f438/default.nix#L3-15): -``` {.nix .numberLines startFrom=""} +```nix terraform-godaddy = pkgs.buildGoModule rec { name = "terraform-godaddy-${version}"; version = "1.6.4"; @@ -30,10 +28,9 @@ terraform-godaddy = pkgs.buildGoModule rec { }; ``` -Local build: -============ +# Local build: -``` {.shell .numberLines startFrom=""} +```shell $ nix-build -A terraform-godaddy these derivations will be built: /nix/store/3hs274i9qdsg3hsgp05j7i5cqxsvpcqx-terraform-godaddy-1.6.4-go-modules.drv @@ -181,15 +178,14 @@ cannot build derivation '/nix/store/y5961vv6y9c0ps2sbd8xfnpqvk0q7qhq-terraform-g error: build of '/nix/store/y5961vv6y9c0ps2sbd8xfnpqvk0q7qhq-terraform-godaddy-1.6.4.drv' failed ``` -Build [on CI](https://builds.sr.ht/~euandreh/job/67836#task-setup-0): -===================================================================== +# Build [on CI](https://builds.sr.ht/~euandreh/job/67836#task-setup-0): The `setup.sh` script contains a call to `nix-shell` which in turns build the same `terraform-godaddy` derivation: -``` {.shell .numberLines startFrom=""} -+ cd vps/ -+ ./scripts/ci/setup.sh +```.shell +$ cd vps/ +$ ./scripts/ci/setup.sh warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring these derivations will be built: /nix/store/as9r3n55czsdiq82iacs0hq12alxb2m0-remove-references-to.drv diff --git a/_pastebins/nix-exps.md b/_pastebins/nix-exps.md index d2ad658..d0ee26b 100644 --- a/_pastebins/nix-exps.md +++ b/_pastebins/nix-exps.md @@ -2,9 +2,10 @@ title: Nix Stuff date: 2018-07-25 layout: pastebin +lang: en --- -``` {.nix .numberLines startFrom=""} +```nix let pkgsOriginal = import <nixpkgs> {}; pkgsSrc = pkgsOriginal.fetchzip { diff --git a/_pastebins/nix-show-derivation.md b/_pastebins/nix-show-derivation.md index d60d443..90ec80e 100644 --- a/_pastebins/nix-show-derivation.md +++ b/_pastebins/nix-show-derivation.md @@ -2,9 +2,10 @@ title: nix show-derivation sample output date: 2018-07-25 layout: pastebin +lang: en --- -``` {.nix .numberLines startFrom=""} +```nix $ nix show-derivation /nix/store/zzz9cl2ly0mb2njr7vwa5528fxmn29m8-combofont-0.2.drv { "/nix/store/zzz9cl2ly0mb2njr7vwa5528fxmn29m8-combofont-0.2.drv": { diff --git a/_pastebins/raku-tuple-type-annotation.md b/_pastebins/raku-tuple-type-annotation.md index cdd387e..303cf8d 100644 --- a/_pastebins/raku-tuple-type-annotation.md +++ b/_pastebins/raku-tuple-type-annotation.md @@ -4,7 +4,7 @@ date: 2019-12-29 layout: pastebin --- -``` {.raku .numberLines startFrom=""} +```raku # Single Str return value: this works sub f1(Str $in --> Str) { $in; @@ -24,7 +24,7 @@ sub f2(Str $in --> (Str, Str)) { Error log is: -``` {.text .numberLines startFrom=""} +``` ===SORRY!=== Error while compiling /path/to/my/file Malformed return value ``` diff --git a/_posts/2018-07-17-rodando-guix-on-nixos.md b/_posts/2018-07-17-rodando-guix-on-nixos.md deleted file mode 100644 index b449541..0000000 --- a/_posts/2018-07-17-rodando-guix-on-nixos.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -title: Rodando Guix no NixOS -date: 2018-07-17 -layout: post -lang: pt -ref: running-guix-on-nixos ---- -Eu queria rodar Guix numa máquina com NixOS instalado. diff --git a/_posts/2018-07-17-running-guix-on-nixos.md b/_posts/2018-07-17-running-guix-on-nixos.md index c0d4611..c12a417 100644 --- a/_posts/2018-07-17-running-guix-on-nixos.md +++ b/_posts/2018-07-17-running-guix-on-nixos.md @@ -7,15 +7,13 @@ ref: running-guix-on-nixos --- I wanted to run Guix on a NixOS machine. Even though the Guix manual explains how to do -it [step by -step](https://www.gnu.org/software/guix/manual/en/html_node/Binary-Installation.html#Binary-Installation), +it [step by step](https://www.gnu.org/software/guix/manual/en/html_node/Binary-Installation.html#Binary-Installation), I needed a few extra ones to make it work properly. -I couldn\'t just install GuixSD because my wireless network card -doesn\'t have any free/libre drivers (yet). +I couldn't just install GuixSD because my wireless network card +doesn't have any free/libre drivers (yet). -Creating `guixbuilder` users ----------------------------- +## Creating `guixbuilder` users Guix requires you to create non-root users that will be used to perform the builds in the isolated environments. @@ -25,7 +23,7 @@ The already provides you with a ready to run (as root) command for creating the build users: -``` {.bash .numberLines startFrom=""} +```bash groupadd --system guixbuild for i in `seq -w 1 10`; do @@ -38,10 +36,10 @@ done However, In my personal NixOS I have disabled [`users.mutableUsers`](https://nixos.org/nixos/manual/index.html#sec-user-management), -which means that even if I run the above command it means that they\'ll +which means that even if I run the above command it means that they'll be removed once I rebuild my OS: -``` {.shell .numberLines startFrom=""} +```shell $ sudo nixos-rebuild switch (...) removing user ‘guixbuilder7’ @@ -60,7 +58,7 @@ removing user ‘guixbuilder5’ Instead of enabling `users.mutableUsers` I could add the Guix users by adding them to my system configuration: -``` {.nix .numberLines startFrom=""} +```nix { config, pkgs, ...}: { @@ -106,13 +104,12 @@ adding them to my system configuration: Here I used `fold` and the `//` operator to merge all of the configuration sets into a single `extraUsers` value. -Creating the `systemd` service ------------------------------- +## Creating the `systemd` service One other thing missing was the `systemd` service. -First I couldn\'t just copy the `.service` file to `/etc` since in NixOS -that folder isn\'t writable. But also I wanted the service to be better +First I couldn't just copy the `.service` file to `/etc` since in NixOS +that folder isn't writable. But also I wanted the service to be better integrated with the OS. That was a little easier than creating the users, all I had to do was @@ -120,7 +117,7 @@ translate the provided [`guix-daemon.service.in`](https://git.savannah.gnu.org/cgit/guix.git/tree/etc/guix-daemon.service.in?id=00c86a888488b16ce30634d3a3a9d871ed6734a2) configuration to an equivalent Nix expression -``` {.ini .numberLines startFrom=""} +```ini # This is a "service unit file" for the systemd init system to launch # 'guix-daemon'. Drop it in /etc/systemd/system or similar to have # 'guix-daemon' automatically started. @@ -146,7 +143,7 @@ WantedBy=multi-user.target This sample `systemd` configuration file became: -``` {.nix .numberLines startFrom=""} +```nix guix-daemon = { enable = true; description = "Build daemon for GNU Guix"; @@ -165,7 +162,7 @@ guix-daemon = { There you go! After running `sudo nixos-rebuild switch` I could get Guix up and running: -``` {.bash .numberLines startFrom=""} +```bash $ guix package -i hello The following package will be installed: hello 2.10 /gnu/store/bihfrh609gkxb9dp7n96wlpigiv3krfy-hello-2.10 @@ -186,11 +183,9 @@ Hello, world! Some improvements to this approach are: -1. looking into [NixOS - modules](https://nixos.org/nixos/manual/index.html#sec-writing-modules) +1. looking into [NixOS modules](https://nixos.org/nixos/manual/index.html#sec-writing-modules) and trying to bundle everything together into a single logical unit; -2. [build Guix from - source](https://www.gnu.org/software/guix/manual/en/html_node/Requirements.html#Requirements) +2. [build Guix from source](https://www.gnu.org/software/guix/manual/en/html_node/Requirements.html#Requirements) and share the Nix store and daemon with Guix. Happy Guix/Nix hacking! diff --git a/_posts/2018-08-01-verifying-npm-ci-reproducibility.md b/_posts/2018-08-01-verifying-npm-ci-reproducibility.md index dcfdd75..f1fd1dd 100644 --- a/_posts/2018-08-01-verifying-npm-ci-reproducibility.md +++ b/_posts/2018-08-01-verifying-npm-ci-reproducibility.md @@ -6,33 +6,29 @@ lang: en ref: veryfing-npm-ci-reproducibility updated_at: 2019-05-22 --- -When -[npm\@5](https://blog.npmjs.org/post/161081169345/v500) came bringing +When [npm@5](https://blog.npmjs.org/post/161081169345/v500) came bringing [package-locks](https://docs.npmjs.com/files/package-locks) with it, I was confused about the benefits it provided, since running `npm install` more than once could resolve all the dependencies again and yield yet -another fresh `package-lock.json` file. The message saying \"you should -add this file to version control\" left me hesitant on what to do[^1]. - -However the [addition of -`npm ci`](https://blog.npmjs.org/post/171556855892/introducing-npm-ci-for-faster-more-reliable) -filled this gap: it\'s a stricter variation of `npm install` which -guarantees that \"[subsequent installs are able to generate identical -trees](https://docs.npmjs.com/files/package-lock.json)\". But are they -really identical? I could see that I didn\'t have the same problems of -different installation outputs, but I didn\'t know for **sure** if it +another fresh `package-lock.json` file. The message saying "you should +add this file to version control" left me hesitant on what to do[^1]. + +However the [addition of `npm ci`](https://blog.npmjs.org/post/171556855892/introducing-npm-ci-for-faster-more-reliable) +filled this gap: it's a stricter variation of `npm install` which +guarantees that "[subsequent installs are able to generate identical trees](https://docs.npmjs.com/files/package-lock.json)". But are they +really identical? I could see that I didn't have the same problems of +different installation outputs, but I didn't know for **sure** if it was really identical. -Computing the hash of a directory\'s content --------------------------------------------- +## Computing the hash of a directory's content I quickly searched for a way to check for the hash signature of an -entire directory tree, but I couldn\'t find one. I\'ve made a poor -man\'s [Merkle tree](https://en.wikipedia.org/wiki/Merkle_tree) +entire directory tree, but I couldn't find one. I've made a poor +man's [Merkle tree](https://en.wikipedia.org/wiki/Merkle_tree) implementation using `sha256sum` and a few piped commands at the terminal: -``` {.bash .numberLines startFrom=""} +```bash merkle-tree () { dirname="${1-.}" pushd "$dirname" @@ -47,25 +43,25 @@ merkle-tree () { Going through it line by line: -- \#1 we define a Bash function called `merkle-tree`; -- \#2 it accepts a single argument: the directory to compute the - merkle tree from. If nothing is given, it runs on the current - directory (`.`); -- \#3 we go to the directory, so we don\'t get different prefixes in - `find`\'s output (like `../a/b`); -- \#4 we get all files from the directory tree. Since we\'re using - `sha256sum` to compute the hash of the file contents, we need to - filter out folders from it; -- \#5 we need to sort the output, since different file systems and - `find` implementations may return files in different orders; -- \#6 we use `xargs` to compute the hash of each file individually - through `sha256sum`. Since a file may contain spaces we need to - escape it with quotes; -- \#7 we compute the hash of the combined hashes. Since `sha256sum` - output is formatted like `<hash> <filename>`, it produces a - different final hash if a file ever changes name without changing - it\'s content; -- \#8 we get the final hash output, excluding the `<filename>` (which +- #1 we define a Bash function called `merkle-tree`; +- #2 it accepts a single argument: the directory to compute the + merkle tree from. If nothing is given, it runs on the current + directory (`.`); +- #3 we go to the directory, so we don't get different prefixes in + `find`'s output (like `../a/b`); +- #4 we get all files from the directory tree. Since we're using + `sha256sum` to compute the hash of the file contents, we need to + filter out folders from it; +- #5 we need to sort the output, since different file systems and + `find` implementations may return files in different orders; +- #6 we use `xargs` to compute the hash of each file individually + through `sha256sum`. Since a file may contain spaces we need to + escape it with quotes; +- #7 we compute the hash of the combined hashes. Since `sha256sum` + output is formatted like `<hash> <filename>`, it produces a + different final hash if a file ever changes name without changing + it's content; +- #8 we get the final hash output, excluding the `<filename>` (which is `-` in this case, aka `stdin`). ### Positive points: @@ -77,13 +73,13 @@ Going through it line by line: ### Limitations: 1. it ignores empty folders from the hash computation; -2. the implementation\'s only goal is to represent using a digest +2. the implementation's only goal is to represent using a digest whether the content of a given directory is the same or not. Leaf presence checking is obviously missing from it. ### Testing locally with sample data -``` {.bash .numberLines startFrom=""} +```bash mkdir /tmp/merkle-tree-test/ cd /tmp/merkle-tree-test/ mkdir -p a/b/ a/c/ d/ @@ -104,15 +100,14 @@ It seems to work for this simple test case. You can try copying and pasting it to verify the hash signatures. -Using `merkle-tree` to check the output of `npm ci` ---------------------------------------------------- +## Using `merkle-tree` to check the output of `npm ci` -*I\'ve done all of the following using Node.js v8.11.3 and npm\@6.1.0.* +*I've done all of the following using Node.js v8.11.3 and npm@6.1.0.* -In this test case I\'ll take the main repo of +In this test case I'll take the main repo of [Lerna](https://lernajs.io/)[^2]: -``` {.bash .numberLines startFrom=""} +```bash cd /tmp/ git clone https://github.com/lerna/lerna.git cd lerna/ @@ -128,29 +123,24 @@ merkle-tree node_modules/ # outputs 11e218c4ac32fac8a9607a8da644fe870a25c9982116 Good job `npm ci` :) -\#6 and \#9 take some time to run (21 seconds in my machine), but this -specific use case isn\'t performance sensitive. The slowest step is +#6 and #9 take some time to run (21 seconds in my machine), but this +specific use case isn't performance sensitive. The slowest step is computing the hash of each individual file. -Conclusion ----------- +## Conclusion -`npm ci` really \"generates identical trees\". +`npm ci` really "generates identical trees". -I\'m not aware of any other existing solution for verifying the hash -signature of a directory. If you know any I\'d [like to -know](mailto:eu@euandre.org). +I'm not aware of any other existing solution for verifying the hash +signature of a directory. If you know any I'd [like to know](mailto:eu@euandre.org). -*Edit* ------- +## *Edit* 2019/05/22: Fix spelling. -[^1]: The - [documentation](https://docs.npmjs.com/cli/install#description) +[^1]: The [documentation](https://docs.npmjs.com/cli/install#description) claims `npm install` is driven by the existing `package-lock.json`, - but that\' actually [a little bit - tricky](https://github.com/npm/npm/issues/17979#issuecomment-332701215). + but that's actually [a little bit tricky](https://github.com/npm/npm/issues/17979#issuecomment-332701215). [^2]: Finding a big known repo that actually committed the `package-lock.json` file was harder than I expected. diff --git a/_posts/2018-12-21-using-youtube-dl-to-manage-youtube-subscriptions.md b/_posts/2018-12-21-using-youtube-dl-to-manage-youtube-subscriptions.md index b58aee9..0501ff4 100644 --- a/_posts/2018-12-21-using-youtube-dl-to-manage-youtube-subscriptions.md +++ b/_posts/2018-12-21-using-youtube-dl-to-manage-youtube-subscriptions.md @@ -5,18 +5,17 @@ layout: post lang: en ref: using-youtube-dl-to-manage-youtube-subscriptions --- -I\'ve recently read the +I've recently read the [announcement](https://www.reddit.com/r/DataHoarder/comments/9sg8q5/i_built_a_selfhosted_youtube_subscription_manager/) of a very nice [self-hosted YouTube subscription -manager](https://github.com/chibicitiberiu/ytsm). I haven\'t used -YouTube\'s built-in subscriptions for a while now, and haven\'t missed +manager](https://github.com/chibicitiberiu/ytsm). I haven't used +YouTube's built-in subscriptions for a while now, and haven't missed it at all. When I saw the announcement, I considered writing about the -solution I\'ve built on top of [youtube-dl](https://youtube-dl.org/). +solution I've built on top of [youtube-dl](https://youtube-dl.org/). -Background: the problem with YouTube ------------------------------------- +## Background: the problem with YouTube -In many ways, I agree with [André Staltz\'s view on data ownership and +In many ways, I agree with [André Staltz's view on data ownership and privacy](https://staltz.com/what-happens-when-you-block-internet-giants.html): > I started with the basic premise that "I want to be in control of my @@ -34,22 +33,20 @@ privacy](https://staltz.com/what-happens-when-you-block-internet-giants.html): > Tor bandwidth for these purposes. I'm still scratching my head with > this issue. -Even though I don\'t use most alternative services he mentions, I do +Even though I don't use most alternative services he mentions, I do watch videos from YouTube. But I also feel uncomfortable logging in to YouTube with a Google account, watching videos, creating playlists and similar things. -Using the mobile app is worse: you can\'t even block ads in there. -You\'re in less control on what you share with YouTube and Google. +Using the mobile app is worse: you can't even block ads in there. +You're in less control on what you share with YouTube and Google. -youtube-dl ----------- +## youtube-dl youtube-dl is a command-line tool for downloading videos, from YouTube -and [many other -sites](https://rg3.github.io/youtube-dl/supportedsites.html): +and [many other sites](https://rg3.github.io/youtube-dl/supportedsites.html): -``` {.shell} +```shell $ youtube-dl https://www.youtube.com/watch?v=rnMYZnY3uLA [youtube] rnMYZnY3uLA: Downloading webpage [youtube] rnMYZnY3uLA: Downloading video info webpage @@ -66,14 +63,14 @@ also has some interesting flags that we can use: which videos were already downloaded; - `--prefer-free-formats`: prefer free video formats, like `webm`, `ogv` and Matroska `mkv`; -- `--playlist-end`: how many videos to download from a \"playlist\" (a +- `--playlist-end`: how many videos to download from a "playlist" (a channel, a user or an actual playlist); - `--write-description`: write the video description to a `.description` file, useful for accessing links and extra content. Putting it all together: -``` {.shell} +```shell $ youtube-dl "https://www.youtube.com/channel/UClu474HMt895mVxZdlIHXEA" \ --download-archive ~/Nextcloud/cache/youtube-dl-seen.conf \ --prefer-free-formats \ @@ -84,7 +81,7 @@ $ youtube-dl "https://www.youtube.com/channel/UClu474HMt895mVxZdlIHXEA" \ This will download the latest 20 videos from the selected channel, and write down the video IDs in the `youtube-dl-seen.conf` file. Running it -immediately after one more time won\'t have any effect. +immediately after one more time won't have any effect. If the channel posts one more video, running the same command again will download only the last video, since the other 19 were already @@ -93,7 +90,7 @@ downloaded. With this basic setup you have a minimal subscription system at work, and you can create some functions to help you manage that: -``` {.shell} +```shell #!/bin/sh export DEFAULT_PLAYLIST_END=15 @@ -130,7 +127,7 @@ export -f download_playlist With these functions, you now can have a subscription fetching script to download the latest videos from your favorite channels: -``` {.shell} +```shell #!/bin/sh download_user ClojureTV 15 @@ -139,31 +136,30 @@ download_playlist "PLqG7fA3EaMRPzL5jzd83tWcjCUH9ZUsbX" 15 ``` Now, whenever you want to watch the latest videos, just run the above -script and you\'ll get all of them in your local machine. +script and you'll get all of them in your local machine. -Tradeoffs ---------- +## Tradeoffs -### I\'ve made it for myself, with my use case in mind +### I've made it for myself, with my use case in mind 1. Offline My internet speed it somewhat reasonable[^1], but it is really - unstable. Either at work or at home, it\'s not uncommon to loose - internet access for 2 minutes 3\~5 times every day, and stay + unstable. Either at work or at home, it's not uncommon to loose + internet access for 2 minutes 3~5 times every day, and stay completely offline for a couple of hours once every week. Working through the hassle of keeping a playlist on disk has payed off many, many times. Sometimes I even not notice when the - connection drops for some minutes, because I\'m watching a video and + connection drops for some minutes, because I'm watching a video and working on some document, all on my local computer. - There\'s also no quality adjustment for YouTube\'s web player, I - always pick the higher quality and it doesn\'t change during the + There's also no quality adjustment for YouTube's web player, I + always pick the higher quality and it doesn't change during the video. For some types of content, like a podcast with some tiny - visual resources, this doesn\'t change much. For other types of + visual resources, this doesn't change much. For other types of content, like a keynote presentation with text written on the - slides, watching on 144p isn\'t really an option. + slides, watching on 144p isn't really an option. If the internet connection drops during the video download, youtube-dl will resume from where it stopped. @@ -171,14 +167,14 @@ Tradeoffs This is an offline first benefit that I really like, and works well for me. -2. Sync the \"seen\" file +2. Sync the "seen" file I already have a running instance of Nextcloud, so just dumping the `youtube-dl-seen.conf` file inside Nextcloud was a no-brainer. You could try putting it in a dedicated git repository, and wrap the script with an autocommit after every run. If you ever had a merge - conflict, you\'d simply accept all changes and then run: + conflict, you'd simply accept all changes and then run: ``` {.shell} $ uniq youtube-dl-seen.conf > youtube-dl-seen.conf @@ -186,22 +182,22 @@ Tradeoffs to tidy up the file. -3. Doesn\'t work on mobile +3. Doesn't work on mobile My primary device that I use everyday is my laptop, not my phone. It works well for me this way. - Also, it\'s harder to add ad-blockers to mobile phones, and most - mobile software still depends on Google\'s and Apple\'s blessing. + Also, it's harder to add ad-blockers to mobile phones, and most + mobile software still depends on Google's and Apple's blessing. If you wish, you can sync the videos to the SD card periodically, - but that\'s a bit of extra manual work. + but that's a bit of extra manual work. ### The Good 1. Better privacy - We don\'t even have to configure the ad-blocker to keep ads and + We don't even have to configure the ad-blocker to keep ads and trackers away! YouTube still has your IP address, so using a VPN is always a good @@ -210,10 +206,10 @@ Tradeoffs 2. No need to self-host - There\'s no host that needs maintenance. Everything runs locally. + There's no host that needs maintenance. Everything runs locally. As long as you keep youtube-dl itself up to date and sync your - \"seen\" file, there\'s little extra work to do. + "seen" file, there's little extra work to do. 3. Track your subscriptions with git @@ -226,26 +222,25 @@ Tradeoffs 1. Maximum playlist size is your disk size This is a good thing for getting a realistic view on your actual - \"watch later\" list. However I\'ve run out of disk space many + "watch later" list. However I've run out of disk space many times, and now I need to be more aware of how much is left. ### The Ugly We can only avoid all the bad parts of YouTube with youtube-dl as long as YouTube keeps the videos public and programmatically accessible. If -YouTube ever blocks that we\'d loose the ability to consume content this +YouTube ever blocks that we'd loose the ability to consume content this way, but also loose confidence on considering YouTube a healthy repository of videos on the internet. -Going beyond ------------- +## Going beyond -Since you\'re running everything locally, here are some possibilities to +Since you're running everything locally, here are some possibilities to be explored: ### A playlist that is too long for being downloaded all at once -You can wrap the `download_playlist` function (let\'s call the wrapper +You can wrap the `download_playlist` function (let's call the wrapper `inc_download`) and instead of passing it a fixed number to the `--playlist-end` parameter, you can store the `$n` in a folder (something like `$HOME/.yt-db/$PLAYLIST_ID`) and increment it by `$step` @@ -258,24 +253,21 @@ without filling your disk with gigabytes of content all at once. The `download_playlist` function could be aware of the specific machine that it is running on and apply specific policies depending on the -machine: always download everything; only download videos that aren\'t +machine: always download everything; only download videos that aren't present anywhere else; etc. -Conclusion ----------- +## Conclusion youtube-dl is a great tool to keep at hand. It covers a really large range of video websites and works robustly. -Feel free to copy and modify this code, and [send -me](mailto:eu@euandre.org) suggestions of improvements or related +Feel free to copy and modify this code, and [send me](mailto:eu@euandre.org) suggestions of improvements or related content. -*Edit* ------- +## *Edit* 2019/05/22: Fix spelling. [^1]: Considering how expensive it is and the many ways it could be better, but also how much it has improved over the last years, I say - it\'s reasonable. + it's reasonable. diff --git a/_posts/2019-06-02-stateless-os.md b/_posts/2019-06-02-stateless-os.md index 486a0c2..2f15c17 100644 --- a/_posts/2019-06-02-stateless-os.md +++ b/_posts/2019-06-02-stateless-os.md @@ -17,20 +17,20 @@ install and configure my whole OS using apt-get. When I found a GNU/Linux distribution that was built on top of the idea of declaratively specifying the whole OS I was automatically convinced[^3]. -I was impressed. Even though I\'ve been experiencing the benefits of Nix +I was impressed. Even though I've been experiencing the benefits of Nix isolation daily, I always felt skeptical that something would be missing, because the devil is always on the details. But the result was much better than expected! There were only 2 missing configurations: -1. tap-to-click on the touchpad wasn\'t enabled by default; -2. the default theme from the gnome-terminal is \"Black on white\" - instead of \"White on black\". +1. tap-to-click on the touchpad wasn't enabled by default; +2. the default theme from the gnome-terminal is "Black on white" + instead of "White on black". -That\'s all. +That's all. -I haven\'t checked if I can configure those in NixOS GNOME module, but I +I haven't checked if I can configure those in NixOS GNOME module, but I guess both are scriptable and could be set in a fictional `setup.sh` run. @@ -59,7 +59,7 @@ investing on it is worth it (both time-wise and happiness-wise). ### Emacs -Right now I\'m using the [Spacemacs](http://spacemacs.org/), which is a +Right now I'm using the [Spacemacs](http://spacemacs.org/), which is a community package curation and configuration on top of [Emacs](https://www.gnu.org/software/emacs/). @@ -67,11 +67,11 @@ Spacemacs does support the notion of [layers](http://spacemacs.org/doc/LAYERS.html), which you can declaratively specify and let Spacemacs do the rest. -However this solution isn\'t nearly as robust as Nix: being purely +However this solution isn't nearly as robust as Nix: being purely functional, Nix does describe everything required to build a derivation, and knows how to do so. Spacemacs it closer to more traditional package managers: even though the layers list is declarative, the installation -is still very much imperative. I\'ve had trouble with Spacemacs not +is still very much imperative. I've had trouble with Spacemacs not behaving the same on different computers, both with identical configurations, only brought to convergence back again after a `git clean -fdx` inside `~/.emacs.d/`. @@ -80,20 +80,19 @@ The ideal solution would be managing Emacs packages with Nix itself. After a quick search I did found that [there is support for Emacs packages in Nix](https://nixos.org/nixos/manual/index.html#module-services-emacs-adding-packages). -So far I was only aware of [Guix support for Emacs -packages](https://www.gnu.org/software/guix/manual/en/html_node/Application-Setup.html#Emacs-Packages). +So far I was only aware of [Guix support for Emacs packages](https://www.gnu.org/software/guix/manual/en/html_node/Application-Setup.html#Emacs-Packages). -This isn\'t a trivial change because Spacemacs does include extra -curation and configuration on top of Emacs packages. I\'m not sure the +This isn't a trivial change because Spacemacs does include extra +curation and configuration on top of Emacs packages. I'm not sure the best way to improve this right now. ### myrepos -I\'m using [myrepos](https://myrepos.branchable.com/) to manage all my +I'm using [myrepos](https://myrepos.branchable.com/) to manage all my git repositories, and the general rule I apply is to add any repository -specific configuration in myrepos\' `checkout` phase: +specific configuration in myrepos' `checkout` phase: -``` {.shell} +```shell # sample ~/.mrconfig file snippet [dev/guix/guix] checkout = @@ -118,20 +117,19 @@ all](https://git.sr.ht/~euandreh/dotfiles/tree/316939aa215181b1d22b69e94241eef75 I wonder if something like [GNU Stow](https://www.gnu.org/software/stow/) can help me simplify this. -Conclusion ----------- +## Conclusion -I\'m really satisfied with NixOS, and I intend to keep using it. If what -I\'ve said interests you, maybe try tinkering with the [Nix package +I'm really satisfied with NixOS, and I intend to keep using it. If what +I've said interests you, maybe try tinkering with the [Nix package manager](https://nixos.org/nix/) (not the whole NixOS) on your current distribution (it can live alongside any other package manager). If you have experience with declarative Emacs package managements, GNU -Stow or any similar tool, etc., [I\'d like some -tips](mailto:eu@euandre.org). If you don\'t have any experience at all, -[I\'d still love to hear from you](mailto:eu@euandre.org). +Stow or any similar tool, etc., [I'd like some +tips](mailto:eu@euandre.org). If you don't have any experience at all, +[I'd still love to hear from you](mailto:eu@euandre.org). -[^1]: \"Last week\" as of the start of this writing, so around the end +[^1]: "Last week" as of the start of this writing, so around the end of May 2019. [^2]: I was using a 32GB RAM, i7 and 250GB SSD Samsung laptop. The @@ -141,7 +139,7 @@ tips](mailto:eu@euandre.org). If you don\'t have any experience at all, space. [^3]: The declarative configuration aspect is something that I now - completely take for granted, and wouldn\'t consider using something - which isn\'t declarative. A good metric to show this is me realising - that I can\'t pinpoint the moment when I decided to switch to NixOS. - It\'s like I had a distant past when this wasn\'t true. + completely take for granted, and wouldn't consider using something + which isn't declarative. A good metric to show this is me realising + that I can't pinpoint the moment when I decided to switch to NixOS. + It's like I had a distant past when this wasn't true. @@ -4,7 +4,7 @@ title: About lang: en ref: about --- -Hi, I\'m EuAndreh. I write software and occasionally music. You can find +Hi, I'm EuAndreh. I write software and occasionally music. You can find my contact information in the footer of this page, or mail my [public inbox](mailto:~euandreh/public-inbox@lists.sr.ht). @@ -13,8 +13,7 @@ more related work. Below you can find some interesting projects of mine. -Software projects ------------------ +## Software projects ### [cool-read-macros](https://euandre.org/cool-read-macros/) @@ -22,7 +21,6 @@ Software projects [cl-intbytes](https://euandre.org/cl-intbytes) as a side-effect. -Other things ------------- +## Other things [Pastebin listing](./pastebins.html). @@ -20,17 +20,6 @@ }; version = "1.1.0"; }; - commonmarker = { - dependencies = ["ruby-enum"]; - groups = ["default" "jekyll_plugins"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; - sha256 = "0vwpkmwfr8lx8b6cfvwh56f1ygyf2da5ah37mxbdr9mxmfwig5fr"; - type = "gem"; - }; - version = "0.21.0"; - }; concurrent-ruby = { groups = ["default"]; platforms = []; @@ -114,17 +103,6 @@ }; version = "3.8.5"; }; - jekyll-commonmark = { - dependencies = ["commonmarker" "jekyll"]; - groups = ["jekyll_plugins"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; - sha256 = "15kr36k56l4fh8yp7qswn9m91v7sa5kr2vq9w40li16z4n4akk57"; - type = "gem"; - }; - version = "1.3.1"; - }; jekyll-sass-converter = { dependencies = ["sass"]; groups = ["default"]; @@ -240,17 +218,6 @@ }; version = "3.13.0"; }; - ruby-enum = { - dependencies = ["i18n"]; - groups = ["default" "jekyll_plugins"]; - platforms = []; - source = { - remotes = ["https://rubygems.org"]; - sha256 = "0h62avini866kxpjzqxlqnajma3yvj0y25l6hn9h2mv5pp6fcrhx"; - type = "gem"; - }; - version = "0.7.2"; - }; safe_yaml = { groups = ["default"]; platforms = []; @@ -4,4 +4,20 @@ title: Sobre lang: pt ref: about --- -Oi, eu sou EuAndreh. +Oi, eu sou EuAndreh. Eu escrevo software, e música ocasionalmente. Você encontra dados para me contatar no rodapé dessa página, ou pode mandar também uma mensagem para minha [caixa de entrada públic](mailto:~euandreh/public-inbox@lists.sr.ht). + +Esse é o meu site pessoal onde eu escrevo artigos, publico software e outros trabalhos relacionados. + +Abaixo você encontra alguns projetos interessantes meus. + +## Projetos de software + +### [cool-read-macros](https://euandre.org/cool-read-macros/) + +### [cl-BSON](https://euandre.org/cl-bson/) + +[cl-intbytes](https://euandre.org/cl-intbytes) como consequência. + +## Outros + +[Lista de pastebins](./pastebins.html). |