From 067767e3339a80f8503aa0bab7a37e5152fb86f6 Mon Sep 17 00:00:00 2001 From: Gabriel Arazas Date: Tue, 7 Mar 2023 00:35:19 +0800 Subject: [PATCH] Reformat codebase --- assets/css/rouge.scss | 2 +- assets/scss/extend.scss | 55 +++++--- .../assets/modified-coredns-service.nix | 17 +-- .../assets/modified-gitea-service.nix | 37 +++--- data/blogs.json | 124 +++++++++--------- flake.nix | 34 ++--- .../asciidoctor-foodogsquared-extensions.rb | 1 + .../extension.rb | 16 +-- 8 files changed, 157 insertions(+), 129 deletions(-) diff --git a/assets/css/rouge.scss b/assets/css/rouge.scss index 98fb02e..24b8caf 100644 --- a/assets/css/rouge.scss +++ b/assets/css/rouge.scss @@ -11,7 +11,7 @@ } .hll { - background-color: var(--base02); + background: var(--base02); } // Comment diff --git a/assets/scss/extend.scss b/assets/scss/extend.scss index e4319cc..a398cb9 100644 --- a/assets/scss/extend.scss +++ b/assets/scss/extend.scss @@ -3,7 +3,7 @@ $tooltip-size: 5em; $line-height: 1.45; :root { - --accented-border-style: var(--foreground) solid .1vw; + --accented-border-style: var(--foreground) solid 0.1vw; --body-family: "Source Serif Pro", "IBM Plex Serif", "Noto Serif", serif; --header-family: "Source Sans Pro", "IBM Plex Sans", "Noto Sans", sans-serif; @@ -11,7 +11,9 @@ $line-height: 1.45; } // Base styles. -a:hover { color: var(--base0B); } +a:hover { + color: var(--base0B); +} hr { border-color: var(--foreground); @@ -57,7 +59,8 @@ article.post { width: var(--size); fill: var(--base0C); position: relative; - animation: rainbow 3s infinite, pulse 2s alternate infinite, bounce 0.6s ease-in-out alternate infinite; + animation: rainbow 3s infinite, pulse 2s alternate infinite, + bounce 0.6s ease-in-out alternate infinite; } } @@ -65,16 +68,22 @@ article.post { $baseSize: 3em; $baseRotation: 20deg; from { - transform: rotate($baseRotation) translateX($baseSize) translateY(-#{$baseSize / 5}); + transform: rotate($baseRotation) translateX($baseSize) + translateY(-#{$baseSize / 5}); } to { - transform: rotate(-$baseRotation) translateX(-$baseSize) translateY(-#{$baseSize / 5}); + transform: rotate(-$baseRotation) translateX(-$baseSize) + translateY(-#{$baseSize / 5}); } } @keyframes pulse { - from { width: #{$tooltip-size / 2}; } - to { width: #{$tooltip-size}; } + from { + width: #{$tooltip-size / 2}; + } + to { + width: #{$tooltip-size}; + } } @keyframes rainbow { @@ -96,7 +105,8 @@ article.post { font-size: 0.8em; padding: 0.5em; position: absolute; - transform: translateY(var(--translate-y, -#{round($tooltip-size / 2)})) scale(var(--scale)); + transform: translateY(var(--translate-y, -#{round($tooltip-size / 2)})) + scale(var(--scale)); transform-origin: bottom center; width: max-content; max-width: 100%; @@ -157,7 +167,8 @@ sup.footnote { margin: 1rem; } -[class$="block"], :is(.admonitionblock) { +[class$="block"], +:is(.admonitionblock) { margin: 1rem 0; .title > code { @@ -193,7 +204,9 @@ p.tableblock { font-size: 0.9em; padding: 0.5em; - code { background: unset; } + code { + background: unset; + } } > .content pre { @@ -234,6 +247,11 @@ p.tableblock { .content > pre { max-height: 100vh; + border: unset; + } + + .title { + display: none; } > .listingblock__btn-row { @@ -241,8 +259,8 @@ p.tableblock { } &::backdrop { - --color1: var(--base09); - --color2: var(--base08); + --color1: var(--base08); + --color2: var(--base0C); --threshold1: 9px; --threshold2: 24px; background: repeating-linear-gradient( @@ -250,7 +268,7 @@ p.tableblock { var(--color1) 0px, var(--color1) var(--threshold1), var(--color2) var(--threshold1), - var(--color2) var(--threshold2), + var(--color2) var(--threshold2) ); } } @@ -262,7 +280,10 @@ p.tableblock { margin: unset; tbody { - tr + tr, tr:first-child { border-top: unset; } + tr + tr, + tr:first-child { + border-top: unset; + } } } @@ -320,8 +341,10 @@ p { } // This setup will use asciidoctor-rouge. -.rouge.highlight, code[data-lang] { - &::selection, ::selection { +.rouge.highlight, +code[data-lang] { + &::selection, + ::selection { background: var(--selection-color); color: unset; } diff --git a/content/posts/2023-02-26-my-experience-managing-a-cloud-hosted-server-with-nixos/assets/modified-coredns-service.nix b/content/posts/2023-02-26-my-experience-managing-a-cloud-hosted-server-with-nixos/assets/modified-coredns-service.nix index 155b6af..3aefc5c 100644 --- a/content/posts/2023-02-26-my-experience-managing-a-cloud-hosted-server-with-nixos/assets/modified-coredns-service.nix +++ b/content/posts/2023-02-26-my-experience-managing-a-cloud-hosted-server-with-nixos/assets/modified-coredns-service.nix @@ -34,13 +34,14 @@ in ${replaceSecretBin} '#mailboxSecurityKey#' '${secretsPath "dns/${domain}/mailbox-security-key"}' '${domainZoneFile'}' ${replaceSecretBin} '#mailboxSecurityKeyRecord#' '${secretsPath "dns/${domain}/mailbox-security-key-record"}' '${domainZoneFile'}' ''; - serviceConfig.LoadCredential = let - certDirectory = config.security.acme.certs."${dnsDomainName}".directory; - in - [ - "cert.pem:${certDirectory}/cert.pem" - "key.pem:${certDirectory}/key.pem" - "fullchain.pem:${certDirectory}/fullchain.pem" - ]; + serviceConfig.LoadCredential = + let + certDirectory = config.security.acme.certs."${dnsDomainName}".directory; + in + [ + "cert.pem:${certDirectory}/cert.pem" + "key.pem:${certDirectory}/key.pem" + "fullchain.pem:${certDirectory}/fullchain.pem" + ]; }; } diff --git a/content/posts/2023-02-26-my-experience-managing-a-cloud-hosted-server-with-nixos/assets/modified-gitea-service.nix b/content/posts/2023-02-26-my-experience-managing-a-cloud-hosted-server-with-nixos/assets/modified-gitea-service.nix index bb1960b..cbe917c 100644 --- a/content/posts/2023-02-26-my-experience-managing-a-cloud-hosted-server-with-nixos/assets/modified-gitea-service.nix +++ b/content/posts/2023-02-26-my-experience-managing-a-cloud-hosted-server-with-nixos/assets/modified-gitea-service.nix @@ -7,25 +7,26 @@ in systemd.services.gitea = { # Gitea service module will have to set up certain things first which is # why we have to go first. - preStart = let - psqlBin = "${lib.getBin config.services.postgresql.package}/bin/psql"; - giteaBin = "${lib.getBin config.services.gitea.package}/bin/gitea"; - giteaAdminUsername = lib.escapeShellArg "foodogsquared"; + preStart = + let + psqlBin = "${lib.getBin config.services.postgresql.package}/bin/psql"; + giteaBin = "${lib.getBin config.services.gitea.package}/bin/gitea"; + giteaAdminUsername = lib.escapeShellArg "foodogsquared"; in - lib.mkMerge [ - (lib.mkBefore '' - # Setting up the appropriate schema for PostgreSQL secure schema usage. - ${psqlBin} -tAc "SELECT 1 FROM information_schema.schemata WHERE schema_name='${giteaDatabaseUser}';" \ - grep -q 1 || ${psqlBin} -tAc "CREATE SCHEMA IF NOT EXISTS AUTHORIZATION ${giteaDatabaseUser};" - '') + lib.mkMerge [ + (lib.mkBefore '' + # Setting up the appropriate schema for PostgreSQL secure schema usage. + ${psqlBin} -tAc "SELECT 1 FROM information_schema.schemata WHERE schema_name='${giteaDatabaseUser}';" \ + grep -q 1 || ${psqlBin} -tAc "CREATE SCHEMA IF NOT EXISTS AUTHORIZATION ${giteaDatabaseUser};" + '') - (lib.mkAfter '' - # Setting up the administrator account automated. - ${giteaBin} admin user list --admin | grep -q ${giteaAdminUsername} \ - || ${giteaBin} admin user create \ - --username ${giteaAdminUsername} --email foodogsquared@${config.networking.domain} \ - --random-password --random-password-length 76 --admin - '') - ]; + (lib.mkAfter '' + # Setting up the administrator account automated. + ${giteaBin} admin user list --admin | grep -q ${giteaAdminUsername} \ + || ${giteaBin} admin user create \ + --username ${giteaAdminUsername} --email foodogsquared@${config.networking.domain} \ + --random-password --random-password-length 76 --admin + '') + ]; }; } diff --git a/data/blogs.json b/data/blogs.json index 6b05728..4f6023e 100644 --- a/data/blogs.json +++ b/data/blogs.json @@ -1,64 +1,64 @@ [ - "http://distill.pub/rss.xml", - "http://malloc47.com/rss.xml", - "https://alex-hhh.github.io/feeds/all.rss.xml", - "https://bernsteinbear.com/feed.xml", - "https://blog.mozilla.org/en/feed/", - "https://blog.replit.com/feed.xml", - "https://blog.thunderbird.net/feed/", - "https://blog.yoshuawuyts.com/rss.xml", - "https://boingboing.net/feed", - "https://bootlin.com/feed/", - "https://console.substack.com/feed", - "https://drewdevault.com/feed.xml", - "https://emersion.fr/blog/rss.xml", - "https://engineering.fb.com/feed/", - "https://fasterthanli.me/index.xml", - "https://fedoramagazine.org/feed/", - "https://gamozolabs.github.io/feed.xml", - "https://guix.gnu.org/feeds/blog.atom", - "https://hackaday.com/feed/", - "https://inkscape.org/news/feed/", - "https://jvns.ca/atom.xml", - "https://krita.org/en/feed/", - "https://librearts.org/index.xml", - "https://lwn.net/headlines/newrss", - "https://ma.ttias.be/cronweekly/index.xml", - "https://matrix.org/blog/feed", - "https://monthly-reports.archlinux.page/index.xml", - "https://nim-lang.org/feed.xml", - "https://nixos.org/blog/announcements-rss.xml", - "https://nlnet.nl/feed.atom", - "https://nyxt.atlas.engineer/feed", - "https://opensource.com/feed", - "https://planet.gnome.org/atom.xml", - "https://planet.kde.org/atom.xml", - "https://protesilaos.com/codelog.xml", - "https://reproducible-builds.org/blog/index.rss", - "https://rss.moddb.com/games/0-ad/articles/feed/rss.xml", - "https://sachachua.com/blog/feed/", - "https://sfconservancy.org/feeds/news/", - "https://spacestation14.io/index.xml", - "https://static.fsf.org/fsforg/rss/news.xml", - "https://this-week-in-neovim.org/rss", - "https://this-week-in-rust.org/atom.xml", - "https://tvl.fyi/feed.atom", - "https://undeadly.org/cgi?action=rss", - "https://usebottles.com/feed", - "https://veloren.net/rss.xml", - "https://web.dev/feed.xml", - "https://webzine.puffy.cafe/atom.xml", - "https://wingolog.org/feed/atom", - "https://www.autodidacts.io/rss", - "https://www.bay12games.com/dwarves/dev_now.rss", - "https://www.bay12games.com/dwarves/dev_release.rss", - "https://www.bekk.christmas/rss.xml", - "https://www.blendersecrets.org/secrets?format=rss", - "https://www.collabora.com/feed", - "https://www.copetti.org/index.xml", - "https://www.gimp.org/feeds/atom.xml", - "https://www.inkandswitch.com/index.xml", - "https://www.latex-project.org/feed.xml", - "https://www.reddit.com/r/oilshell/.rss", - "https://www.redhat.com/sysadmin/rss.xml" + "http://distill.pub/rss.xml", + "http://malloc47.com/rss.xml", + "https://alex-hhh.github.io/feeds/all.rss.xml", + "https://bernsteinbear.com/feed.xml", + "https://blog.mozilla.org/en/feed/", + "https://blog.replit.com/feed.xml", + "https://blog.thunderbird.net/feed/", + "https://blog.yoshuawuyts.com/rss.xml", + "https://boingboing.net/feed", + "https://bootlin.com/feed/", + "https://console.substack.com/feed", + "https://drewdevault.com/feed.xml", + "https://emersion.fr/blog/rss.xml", + "https://engineering.fb.com/feed/", + "https://fasterthanli.me/index.xml", + "https://fedoramagazine.org/feed/", + "https://gamozolabs.github.io/feed.xml", + "https://guix.gnu.org/feeds/blog.atom", + "https://hackaday.com/feed/", + "https://inkscape.org/news/feed/", + "https://jvns.ca/atom.xml", + "https://krita.org/en/feed/", + "https://librearts.org/index.xml", + "https://lwn.net/headlines/newrss", + "https://ma.ttias.be/cronweekly/index.xml", + "https://matrix.org/blog/feed", + "https://monthly-reports.archlinux.page/index.xml", + "https://nim-lang.org/feed.xml", + "https://nixos.org/blog/announcements-rss.xml", + "https://nlnet.nl/feed.atom", + "https://nyxt.atlas.engineer/feed", + "https://opensource.com/feed", + "https://planet.gnome.org/atom.xml", + "https://planet.kde.org/atom.xml", + "https://protesilaos.com/codelog.xml", + "https://reproducible-builds.org/blog/index.rss", + "https://rss.moddb.com/games/0-ad/articles/feed/rss.xml", + "https://sachachua.com/blog/feed/", + "https://sfconservancy.org/feeds/news/", + "https://spacestation14.io/index.xml", + "https://static.fsf.org/fsforg/rss/news.xml", + "https://this-week-in-neovim.org/rss", + "https://this-week-in-rust.org/atom.xml", + "https://tvl.fyi/feed.atom", + "https://undeadly.org/cgi?action=rss", + "https://usebottles.com/feed", + "https://veloren.net/rss.xml", + "https://web.dev/feed.xml", + "https://webzine.puffy.cafe/atom.xml", + "https://wingolog.org/feed/atom", + "https://www.autodidacts.io/rss", + "https://www.bay12games.com/dwarves/dev_now.rss", + "https://www.bay12games.com/dwarves/dev_release.rss", + "https://www.bekk.christmas/rss.xml", + "https://www.blendersecrets.org/secrets?format=rss", + "https://www.collabora.com/feed", + "https://www.copetti.org/index.xml", + "https://www.gimp.org/feeds/atom.xml", + "https://www.inkandswitch.com/index.xml", + "https://www.latex-project.org/feed.xml", + "https://www.reddit.com/r/oilshell/.rss", + "https://www.redhat.com/sysadmin/rss.xml" ] diff --git a/flake.nix b/flake.nix index 4b40510..b5ef8b6 100644 --- a/flake.nix +++ b/flake.nix @@ -8,22 +8,24 @@ }; outputs = inputs@{ self, nixpkgs, ... }: - let - systems = inputs.flake-utils.lib.defaultSystems; - overlays = [ inputs.ruby-nix.overlays.ruby ]; - in inputs.flake-utils.lib.eachSystem systems (system: let - pkgs = import nixpkgs { - inherit system; - overlays = overlays ++ [ - (final: prev: { - ruby-nix = inputs.ruby-nix.lib prev; - }) - ]; - }; - in { - devShells.default = import ./shell.nix { inherit pkgs; }; + systems = inputs.flake-utils.lib.defaultSystems; + overlays = [ inputs.ruby-nix.overlays.ruby ]; + in + inputs.flake-utils.lib.eachSystem systems (system: + let + pkgs = import nixpkgs { + inherit system; + overlays = overlays ++ [ + (final: prev: { + ruby-nix = inputs.ruby-nix.lib prev; + }) + ]; + }; + in + { + devShells.default = import ./shell.nix { inherit pkgs; }; - formatter = pkgs.treefmt; - }); + formatter = pkgs.treefmt; + }); } diff --git a/gems/lib/asciidoctor-foodogsquared-extensions.rb b/gems/lib/asciidoctor-foodogsquared-extensions.rb index d2a571d..5957c58 100644 --- a/gems/lib/asciidoctor-foodogsquared-extensions.rb +++ b/gems/lib/asciidoctor-foodogsquared-extensions.rb @@ -1,2 +1,3 @@ # frozen_string_literal: true + require 'asciidoctor/foodogsquared-extensions' diff --git a/gems/lib/asciidoctor/github-raw-content-include-processor/extension.rb b/gems/lib/asciidoctor/github-raw-content-include-processor/extension.rb index 32af086..c29ba61 100644 --- a/gems/lib/asciidoctor/github-raw-content-include-processor/extension.rb +++ b/gems/lib/asciidoctor/github-raw-content-include-processor/extension.rb @@ -46,14 +46,14 @@ class GitHubRawIncludeProcessor < Asciidoctor::Extensions::IncludeProcessor # If the response is an array, it is likely to be a directory. In this # usecase, we'll just list them. content = if response.kind_of? Array - warning = %(given path '#{path}' from GitHub repo '#{repo}' is a directory) - warn_or_raise doc, warning - warning - elsif response.kind_of? Object - if response['content'] && response['encoding'] == 'base64' - Base64.decode64 response['content'] - end - end + warning = %(given path '#{path}' from GitHub repo '#{repo}' is a directory) + warn_or_raise doc, warning + warning + elsif response.kind_of? Object + if response['content'] && response['encoding'] == 'base64' + Base64.decode64 response['content'] + end + end reader.push_include content, target, target, 1, attrs end