From a3f8e661ad54cfec14ca671ea671e728ffc9bb91 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Sun, 7 Mar 2021 16:23:59 -0800 Subject: initial site with hugo Start my website from scratch once more, using hugo to generate it. For now the layout is pretty simple: - an index page that will list future notes - notes should be created under the "content" directory The theme is custom and I'll try to keep this simple. --- users/fcuny/notes/.gitignore | 1 + users/fcuny/notes/archetypes/default.md | 5 +++ users/fcuny/notes/config.toml | 35 +++++++++++++++++++ users/fcuny/notes/layouts/_default/baseof.html | 11 ++++++ users/fcuny/notes/layouts/_default/list.html | 10 ++++++ users/fcuny/notes/layouts/_default/single.html | 11 ++++++ users/fcuny/notes/layouts/index.atom.xml | 22 ++++++++++++ users/fcuny/notes/layouts/index.html | 22 ++++++++++++ users/fcuny/notes/layouts/partials/head.html | 15 ++++++++ users/fcuny/notes/static/CNAME | 1 + users/fcuny/notes/static/css/custom.css | 47 ++++++++++++++++++++++++++ 11 files changed, 180 insertions(+) create mode 100644 users/fcuny/notes/.gitignore create mode 100644 users/fcuny/notes/archetypes/default.md create mode 100644 users/fcuny/notes/config.toml create mode 100644 users/fcuny/notes/layouts/_default/baseof.html create mode 100644 users/fcuny/notes/layouts/_default/list.html create mode 100644 users/fcuny/notes/layouts/_default/single.html create mode 100644 users/fcuny/notes/layouts/index.atom.xml create mode 100644 users/fcuny/notes/layouts/index.html create mode 100644 users/fcuny/notes/layouts/partials/head.html create mode 100644 users/fcuny/notes/static/CNAME create mode 100644 users/fcuny/notes/static/css/custom.css diff --git a/users/fcuny/notes/.gitignore b/users/fcuny/notes/.gitignore new file mode 100644 index 0000000..6e68499 --- /dev/null +++ b/users/fcuny/notes/.gitignore @@ -0,0 +1 @@ +/docs/ diff --git a/users/fcuny/notes/archetypes/default.md b/users/fcuny/notes/archetypes/default.md new file mode 100644 index 0000000..7ce2f1a --- /dev/null +++ b/users/fcuny/notes/archetypes/default.md @@ -0,0 +1,5 @@ +--- +title: "{{ replace .Name "-" " " | title }}" +date: {{ .Date }} +--- + diff --git a/users/fcuny/notes/config.toml b/users/fcuny/notes/config.toml new file mode 100644 index 0000000..44080ae --- /dev/null +++ b/users/fcuny/notes/config.toml @@ -0,0 +1,35 @@ +baseURL = "http://fcuny.net/" +languageCode = "en-us" +title = "Franck Cuny's Website" +publishDir = "docs" + +[params] + homeText = "A collection of articles" + +[permalinks] + articles = "/:section/:slug/" + +[markup] + [markup.highlight] + anchorLineNos = false + codeFences = true + guessSyntax = false + hl_Lines = "" + lineAnchors = "" + lineNoStart = 1 + lineNos = false + lineNumbersInTable = true + noClasses = true + style = "emacs" + tabWidth = 2 + +[mediaTypes."application/atom"] +suffixes = ["xml"] + +[outputFormats.Atom] +mediaType = "application/atom" +baseName = "feed" +isPlainText = false + +[outputs] +home = [ "HTML", "Atom" ] diff --git a/users/fcuny/notes/layouts/_default/baseof.html b/users/fcuny/notes/layouts/_default/baseof.html new file mode 100644 index 0000000..d9ca51a --- /dev/null +++ b/users/fcuny/notes/layouts/_default/baseof.html @@ -0,0 +1,11 @@ + + + {{ partial "head.html" . }} + +
+
+ {{ block "main" . }}{{ end }} +
+
+ + diff --git a/users/fcuny/notes/layouts/_default/list.html b/users/fcuny/notes/layouts/_default/list.html new file mode 100644 index 0000000..3423cb6 --- /dev/null +++ b/users/fcuny/notes/layouts/_default/list.html @@ -0,0 +1,10 @@ +{{ define "main" }} + +

{{ .Title }}

+{{ range .Pages.ByPublishDate.Reverse }} +

+ {{ .Title }} +

+{{ end }} + +{{ end }} diff --git a/users/fcuny/notes/layouts/_default/single.html b/users/fcuny/notes/layouts/_default/single.html new file mode 100644 index 0000000..a8c1dc7 --- /dev/null +++ b/users/fcuny/notes/layouts/_default/single.html @@ -0,0 +1,11 @@ +{{ define "main" }} + +

← Back to Franck's homepage

+ +

{{ .Title }}

+ +

{{ .Date.Format "January 2021" }}

+ +{{ .Content }} + +{{ end }} diff --git a/users/fcuny/notes/layouts/index.atom.xml b/users/fcuny/notes/layouts/index.atom.xml new file mode 100644 index 0000000..531e77c --- /dev/null +++ b/users/fcuny/notes/layouts/index.atom.xml @@ -0,0 +1,22 @@ + + Franck Cuny Website + + + {{ .Permalink }}{{ with .Site.Author.name }} + + {{.}}{{ with $.Site.Author.email }} + {{.}}{{end}} + {{end}} + Hugo -- gohugo.io{{ range where (first 10 (where .Site.Pages "Section" "posts")) "Params.hidden" "ne" "true" }} + + {{ `<![CDATA[` | safeHTML }}{{ .Title }}]]> + + {{ .Permalink }}{{ with .Site.Params.Author }} + + {{.}} + {{end}} + {{- $fmt := "2006-01-02T15:04:05-07:00" }} + {{ .Date.Format $fmt | safeHTML }} + {{ ` + {{ end }} + diff --git a/users/fcuny/notes/layouts/index.html b/users/fcuny/notes/layouts/index.html new file mode 100644 index 0000000..5f49f24 --- /dev/null +++ b/users/fcuny/notes/layouts/index.html @@ -0,0 +1,22 @@ +{{ define "main" }} + +
+

Franck Cuny

+ + + +

I'm currently working as a Site Reliability Engineer at Twitter, on the Compute team.

+ +

Notes

+ {{ $section := "notes" }} + + +{{ end }} diff --git a/users/fcuny/notes/layouts/partials/head.html b/users/fcuny/notes/layouts/partials/head.html new file mode 100644 index 0000000..9301a82 --- /dev/null +++ b/users/fcuny/notes/layouts/partials/head.html @@ -0,0 +1,15 @@ + + + + + + + {{ $css := "/css/custom.css" }} + + + + + + + {{ .Title }} + diff --git a/users/fcuny/notes/static/CNAME b/users/fcuny/notes/static/CNAME new file mode 100644 index 0000000..7398ba2 --- /dev/null +++ b/users/fcuny/notes/static/CNAME @@ -0,0 +1 @@ +fcuny.net \ No newline at end of file diff --git a/users/fcuny/notes/static/css/custom.css b/users/fcuny/notes/static/css/custom.css new file mode 100644 index 0000000..45f9732 --- /dev/null +++ b/users/fcuny/notes/static/css/custom.css @@ -0,0 +1,47 @@ +@import url('https://fonts.googleapis.com/css?family=Roboto+Slab:400,700'); +@import url('https://fonts.googleapis.com/css?family=Roboto+Mono:400'); + +*, *:before, *:after { box-sizing: border-box; } + +body { + background-color: #ffffea; + line-height: 1.6rem; + font-size: 18px; + font-family: "Roboto Slab", serif; + color: #000; + padding: 2rem; +} + +.main { + margin: auto; + max-width: 50rem; +} + +a { + text-decoration: none; + color: #00add8; +} + +p { color: #1a1a19; } + +h1 { + line-height: normal; +} + +h2 { + margin-top: 2rem; + line-height: 1.4em; +} + +span.published, span.updated { + display: block; + font-style: oblique; +} + +pre { + padding: 1rem 2rem; + margin: 0; + font-size: 16px; + font-family: "Roboto Mono", Monaco, "Lucida Console", monospace; + overflow: scroll; +} -- cgit 1.4.1 From bfed0ff6924ff45109b026f082a6f23fbe7bac2f Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Sun, 7 Mar 2021 16:47:23 -0800 Subject: add action to publish to GH pages Add a workflow configuration to publish to GitHub pages. This is using the standard configuration from https://gohugo.io/hosting-and-deployment/hosting-on-github/ --- users/fcuny/notes/.github/workflows/gh-pages.yml | 30 ++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 users/fcuny/notes/.github/workflows/gh-pages.yml diff --git a/users/fcuny/notes/.github/workflows/gh-pages.yml b/users/fcuny/notes/.github/workflows/gh-pages.yml new file mode 100644 index 0000000..70e9ca8 --- /dev/null +++ b/users/fcuny/notes/.github/workflows/gh-pages.yml @@ -0,0 +1,30 @@ +name: github pages + +on: + push: + branches: + - main # Set a branch to deploy + +jobs: + deploy: + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + with: + submodules: true # Fetch Hugo themes (true OR recursive) + fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod + + - name: Setup Hugo + uses: peaceiris/actions-hugo@v2 + with: + hugo-version: 'latest' + # extended: true + + - name: Build + run: hugo --minify + + - name: Deploy + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./docs -- cgit 1.4.1 From 7dbca0955261d48a6ebc23058153d1b36bdeaaff Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Tue, 6 Apr 2021 12:28:27 -0700 Subject: layout: clean up empty space --- users/fcuny/notes/layouts/partials/head.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/users/fcuny/notes/layouts/partials/head.html b/users/fcuny/notes/layouts/partials/head.html index 9301a82..f41eb04 100644 --- a/users/fcuny/notes/layouts/partials/head.html +++ b/users/fcuny/notes/layouts/partials/head.html @@ -7,7 +7,7 @@ {{ $css := "/css/custom.css" }} - + -- cgit 1.4.1 From 25eb1dca2cf86e5cbf45c66ce497c790577ef3ed Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Tue, 6 Apr 2021 12:28:53 -0700 Subject: layout: fix format for the date --- users/fcuny/notes/layouts/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/users/fcuny/notes/layouts/index.html b/users/fcuny/notes/layouts/index.html index 5f49f24..450444b 100644 --- a/users/fcuny/notes/layouts/index.html +++ b/users/fcuny/notes/layouts/index.html @@ -15,7 +15,7 @@ {{ $section := "notes" }} -- cgit 1.4.1 From 5e6b43d51cebf4d938d14d963326efb73da36312 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Tue, 6 Apr 2021 12:29:45 -0700 Subject: css: change the default font --- users/fcuny/notes/static/css/custom.css | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/users/fcuny/notes/static/css/custom.css b/users/fcuny/notes/static/css/custom.css index 45f9732..c84a013 100644 --- a/users/fcuny/notes/static/css/custom.css +++ b/users/fcuny/notes/static/css/custom.css @@ -1,13 +1,13 @@ -@import url('https://fonts.googleapis.com/css?family=Roboto+Slab:400,700'); +@import url('https://fonts.googleapis.com/css2?family=Roboto'); @import url('https://fonts.googleapis.com/css?family=Roboto+Mono:400'); *, *:before, *:after { box-sizing: border-box; } body { - background-color: #ffffea; - line-height: 1.6rem; - font-size: 18px; - font-family: "Roboto Slab", serif; + background-color: #ffffff; + line-height: 1.5rem; + font-size: 16px; + font-family: "Roboto", Arial, sans-serif; color: #000; padding: 2rem; } -- cgit 1.4.1 From a53be2f4e1bb79867b50bf5f8cd4158dcc15fe95 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Tue, 6 Apr 2021 12:30:59 -0700 Subject: css: set background color for code block Indent properly the CSS for the `pre` tag. --- users/fcuny/notes/static/css/custom.css | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/users/fcuny/notes/static/css/custom.css b/users/fcuny/notes/static/css/custom.css index c84a013..b3c3e2f 100644 --- a/users/fcuny/notes/static/css/custom.css +++ b/users/fcuny/notes/static/css/custom.css @@ -38,10 +38,14 @@ span.published, span.updated { font-style: oblique; } +code { + background-color: #eeeeee; +} + pre { - padding: 1rem 2rem; - margin: 0; - font-size: 16px; - font-family: "Roboto Mono", Monaco, "Lucida Console", monospace; - overflow: scroll; + padding: 1rem 2rem; + margin: 0; + font-size: 16px; + font-family: "Roboto Mono", Monaco, "Lucida Console", monospace; + overflow: scroll; } -- cgit 1.4.1 From 70da9328d7bd48d5c698a623bc9189b2f25ad3b2 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Tue, 6 Apr 2021 12:31:33 -0700 Subject: css: update style for links and headers Indent properly the CSS --- users/fcuny/notes/static/css/custom.css | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/users/fcuny/notes/static/css/custom.css b/users/fcuny/notes/static/css/custom.css index b3c3e2f..b0ec570 100644 --- a/users/fcuny/notes/static/css/custom.css +++ b/users/fcuny/notes/static/css/custom.css @@ -18,8 +18,9 @@ body { } a { - text-decoration: none; - color: #00add8; + text-decoration: underline; + text-underline-offset:.3rem; + color: #007d9c; } p { color: #1a1a19; } @@ -29,8 +30,11 @@ h1 { } h2 { - margin-top: 2rem; - line-height: 1.4em; + margin-top: 2rem; + line-height: 1.4em; + border-bottom-color: #000000; + border-bottom-style: solid; + border-bottom-width: 0.8px; } span.published, span.updated { -- cgit 1.4.1 From 11e25707f013a4251ab83a52ed0f3b008764a1ae Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Tue, 6 Apr 2021 12:32:43 -0700 Subject: layout: add date and tags to single pages We want to show the tags and the published/updated date for the articles. Add to the CSS the classes for these new elements. --- users/fcuny/notes/layouts/_default/single.html | 27 +++++++++++++++++++++++++- users/fcuny/notes/static/css/custom.css | 16 +++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/users/fcuny/notes/layouts/_default/single.html b/users/fcuny/notes/layouts/_default/single.html index a8c1dc7..0ab5e35 100644 --- a/users/fcuny/notes/layouts/_default/single.html +++ b/users/fcuny/notes/layouts/_default/single.html @@ -4,7 +4,32 @@

{{ .Title }}

-

{{ .Date.Format "January 2021" }}

+
+ {{- $pub := .Date.Format "2006-01-02" -}} + {{- $mod := "" -}} + {{- if (not .GitInfo) }} + {{- $mod = .Lastmod.Format "2006-01-02" -}} + {{ else }} + {{- $mod = .Page.GitInfo.CommitDate.Format "2006-01-02" -}} + {{ end -}} + {{ if eq $pub $mod }} +
published {{ $pub }}
+ {{ else }} +
published {{ $pub }}, last modified {{ $mod }}
+ {{ end }} + {{ if .Params.tags }} +
+ {{ if eq (len .Params.tags) 1 }} + in tag + {{ else }} + in tags + {{ end }} + {{ range $idx, $tag := .Params.tags }} + {{ $tag }} + {{ end }} +
+ {{ end }} +
{{ .Content }} diff --git a/users/fcuny/notes/static/css/custom.css b/users/fcuny/notes/static/css/custom.css index b0ec570..9d4faf1 100644 --- a/users/fcuny/notes/static/css/custom.css +++ b/users/fcuny/notes/static/css/custom.css @@ -53,3 +53,19 @@ pre { font-family: "Roboto Mono", Monaco, "Lucida Console", monospace; overflow: scroll; } + +.tags { + background-color: #eeeeee; + border-radius:8px; + padding:0 .5rem; + font-size: 90%; +} + +.meta_tags a:link, +.meta_tags a:visited { + text-decoration: none; +} + +.meta_date { + font-style: italic; +} -- cgit 1.4.1 From 81f002c3615784ff38fc957c14b993f08fb134fe Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Tue, 6 Apr 2021 12:33:39 -0700 Subject: taxonomy: add pages for tags We want to have pages that list all the articles related to a given tag. Update the configuration to add support for tags and the permalink structure. --- users/fcuny/notes/config.toml | 32 +++++++++--------------- users/fcuny/notes/layouts/partials/postlist.html | 30 ++++++++++++++++++++++ users/fcuny/notes/layouts/taxonomy/tag.html | 6 +++++ 3 files changed, 48 insertions(+), 20 deletions(-) create mode 100644 users/fcuny/notes/layouts/partials/postlist.html create mode 100644 users/fcuny/notes/layouts/taxonomy/tag.html diff --git a/users/fcuny/notes/config.toml b/users/fcuny/notes/config.toml index 44080ae..23df087 100644 --- a/users/fcuny/notes/config.toml +++ b/users/fcuny/notes/config.toml @@ -2,34 +2,26 @@ baseURL = "http://fcuny.net/" languageCode = "en-us" title = "Franck Cuny's Website" publishDir = "docs" +enableGitInfo = true +markup = "org" [params] - homeText = "A collection of articles" + homeText = "A collection of notes" + +[taxonomies] + tag = "tags" [permalinks] articles = "/:section/:slug/" - -[markup] - [markup.highlight] - anchorLineNos = false - codeFences = true - guessSyntax = false - hl_Lines = "" - lineAnchors = "" - lineNoStart = 1 - lineNos = false - lineNumbersInTable = true - noClasses = true - style = "emacs" - tabWidth = 2 + tags = "/tags/:slug/" [mediaTypes."application/atom"] -suffixes = ["xml"] + suffixes = ["xml"] [outputFormats.Atom] -mediaType = "application/atom" -baseName = "feed" -isPlainText = false + mediaType = "application/atom" + baseName = "feed" + isPlainText = false [outputs] -home = [ "HTML", "Atom" ] + home = [ "HTML", "Atom" ] diff --git a/users/fcuny/notes/layouts/partials/postlist.html b/users/fcuny/notes/layouts/partials/postlist.html new file mode 100644 index 0000000..3695d82 --- /dev/null +++ b/users/fcuny/notes/layouts/partials/postlist.html @@ -0,0 +1,30 @@ +

← Back to Franck's homepage

+ +{{ range .GroupByDate "2006-Jan" }} +

{{ .Key }}

+
    + {{ range .Pages.ByDate }} +
  • +
    +

    {{ .Title }}

    + {{ if .Params.tags }} +
    + Tags: + {{ range $idx, $tag := .Params.tags }} + {{ $tag }} + {{ end }} +
    + {{ else }} +
    + {{ end }} +
    +
    +

    + {{ .Summary }} + Read more → +

    +
    +
  • + {{ end }} +
+{{ end }} diff --git a/users/fcuny/notes/layouts/taxonomy/tag.html b/users/fcuny/notes/layouts/taxonomy/tag.html new file mode 100644 index 0000000..2b7d98a --- /dev/null +++ b/users/fcuny/notes/layouts/taxonomy/tag.html @@ -0,0 +1,6 @@ +{{ define "main" }} + + {{ $pgs := where .Data.Pages "Params.hidden" "ne" "true" }} + {{ partial "postlist" $pgs }} + +{{ end }} -- cgit 1.4.1 From f0ccb67369766618a46c58184884da8d11ce813e Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Sun, 11 Apr 2021 11:51:48 -0700 Subject: css: change font to roboto slab --- users/fcuny/notes/static/css/custom.css | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/users/fcuny/notes/static/css/custom.css b/users/fcuny/notes/static/css/custom.css index 9d4faf1..b1a1957 100644 --- a/users/fcuny/notes/static/css/custom.css +++ b/users/fcuny/notes/static/css/custom.css @@ -1,13 +1,13 @@ -@import url('https://fonts.googleapis.com/css2?family=Roboto'); -@import url('https://fonts.googleapis.com/css?family=Roboto+Mono:400'); + @import url('https://fonts.googleapis.com/css2?family=Roboto+Slab&display=swap'); +@import url('https://fonts.googleapis.com/css2?family=Source+Code+Pro&display=swap'); *, *:before, *:after { box-sizing: border-box; } body { background-color: #ffffff; line-height: 1.5rem; - font-size: 16px; - font-family: "Roboto", Arial, sans-serif; + font-size: 18px; + font-family: "Roboto Slab", serif; color: #000; padding: 2rem; } @@ -50,7 +50,7 @@ pre { padding: 1rem 2rem; margin: 0; font-size: 16px; - font-family: "Roboto Mono", Monaco, "Lucida Console", monospace; + font-family: 'Source Code Pro', monospace; overflow: scroll; } -- cgit 1.4.1 From d684e97b9bd1ab2b52ce59cfbd93e46f1b60b50e Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Sun, 11 Apr 2021 11:52:42 -0700 Subject: blog: google doc failure --- .../notes/content/notes/google-doc-failure.org | 56 ++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 users/fcuny/notes/content/notes/google-doc-failure.org diff --git a/users/fcuny/notes/content/notes/google-doc-failure.org b/users/fcuny/notes/content/notes/google-doc-failure.org new file mode 100644 index 0000000..b4d449d --- /dev/null +++ b/users/fcuny/notes/content/notes/google-doc-failure.org @@ -0,0 +1,56 @@ +#+TITLE: Google Doc Failures +#+TAGS[]: documentation process +#+DATE: <2021-04-11 Sun> + +In most use cases, Google Doc is an effective tool to create "write once, read never" documents. + +* Convenience +Google Doc (GDoc from now on) is the most common way of writing and sharing documents at my current job. It's very easy to start a new document, even more since we can now point our browser to https://doc.new and start typing right away. + +Like most of my co-workers, I use it frequently during the day. Some of these documents are draft for some communication that I want others to review before I share with a broader audience; it can be a [[https://en.wikipedia.org/wiki/Request_for_Comments][Request For Comments]] for a project; meeting notes for others to read; information that I need to capture during an incident or a debugging session; interviews notes; etc. + +I would not be surprised if the teams I work closely with generate 50 new documents each week. +* ETOOMANYTABS +I have a tendency of having hundreds of open tabs in my browser during the week. A majority of these tabs are GDocs, and I think this is one of the true failure of the product. Why do I have so many tabs ? There's mainly two reasons. + +The first reason is a problem with Chrome's UX itself: it happily let me open the same URL as many times as I want in as many tabs, instead of sending me to the already opened tab if the document is loaded. It's not uncommon that I find the same document opened in 5 different tabs. + +The second reason, and it's the most important one, I know that if I need to read or comment on a doc and I close the tab, I'll likely never find that document again, or will completely forget about it. +* Discoverability +In 'the old days', you'd start a new document in Word or LibreOffice, and as you hit "save" for the first time, you've two decisions to make: how am I going to name that file, and where am I going to save it on disk. + +With GDoc these questions don't have to be answered, you don't have to name the file, and it does not matter where it lives. I've likely hundreds of docs named 'untitled' in my "drive". I also don't have to think about where they will live, because they are saved automatically for me. I'm sure there's hundreds of studies that show that these two simple steps are actually complex for many users and creates useless friction (in which folder do I store it; should I organize the docuemnts by team, years, projects; do I name it with the date and the current project; etc.). + +GDoc being a Google product, it seems pretty obvious that they would come up with a better solution: let's not organize in a strict hierarchy these files, and let's instead search for them. + +Unfortunately, GDoc's search is really poor (and I'm being kind). By default most of us start by looking for some words we know are in the doc, maybe even in the title. But when working on a multiple projects that are related to the same technology, you suddenly get hundreds of documents matching your query. It's unclear how the returned set is ordered (by date ? by author ? by some scoring that is invisible to me ?). + +You can also search by owners, but here is another annoying bit: I think about owner as author, so I usually type =author:foo= before realizing it does not work. And that implies you already know who's the owner of the document. In the case of TDDs (Technical Design Document), I might know which team is behind it, but rarely who's the actual author. + +I could search for the title, but I rarely remember or know the name of the document I'm looking for. I could also be looking by keywords, but when working on a project with tens of related documents, you have to open all the returned docs to see which one is the correct one. + +And then what about new members joining your the team ? They don't know which docs exist, who wrote them, and how they are named. They end up searching and hoping that something good will be returned. +* Workflows +More and more we create workflows around these documents: some of the docs are TDDs that are going through reviews; others are decision documents that require input from multiple teams and are pending approval; others are road map documents that also go through some review process. + +As a result we create templates for all kind of documents, with usually something like "draft → reviews → approved/rejected" at the top. We expect the owner of the doc to mark in bold what's the status of the doc to help the reader understand in what state the document is. It's difficult to keep track of open actions and comments. Yes, there's a way to get a list of all of them, but it's not in an obvious place. + +As a result, some engineers in my team built an external dashboard with swim lanes which captures the state of a document. We add new document with their URLs, add who are the reviewers, and we move the doc between the lanes. Now we have to operate a service and a database to keep track of the status of documents in GDoc. +* Alternatives +When it comes to technical document, I find that [[https://caitiem.com/2020/03/29/design-docs-markdown-and-git/][approach]] much more interesting. Some open source projects have adopted a similar workflow ([[https://github.com/kubernetes/enhancements/tree/master/keps][Kubernetes]], [[https://github.com/golang/proposal][Go]]). + +A new document starts its life as a text file (using what ever markup language your team/company prefers). The document is submitted for review, and the people who need to be consulted are added as reviewers. They can now comment on the document, the author can address them, mark them as resolved. It's clear in which state the document is: it's either in review, committed, or rejected. With this approach you also end up with a clear history, as time moves on you can amend the document by submitting a change, and the change goes through the same process. + +New comers will find the document in the repository, and if they want to see the conversation they can open the review associated with the original change. They can also see how the document evolved over time. It's also easy to publish these documents on an internal website, using a static site generator for example. + +One of the thing that I think are critical, is that all of that is done using the tools the engineers are already using for their day to day job: a text editor, a version control system, a code review tool. + +There's obviously challenges with this approach too: ++ *it's more heavy handed*: not every one likes to write in a text editor using a markup language. It can requires some time to learn or get used to the syntax ++ *it's harder to integrate schema / visuals*: but having them checked in in the repository also improves the discoverability + +It's also true that no all documents suffer the same challenges for discoverability: ++ meeting notes are usually linked to meeting invites (however if you were not part of the meeting, you end up with the same challenges to discover them) ++ drafts for communications are usually not relevant once the communication has been sent ++ interview notes are usually transferred to some tools for HR when the feedback is submitted + -- cgit 1.4.1 From 97b666e026fd8047217944bbee1df850ed7ee7e4 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Sun, 11 Apr 2021 11:54:55 -0700 Subject: css: remove extra white space --- users/fcuny/notes/static/css/custom.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/users/fcuny/notes/static/css/custom.css b/users/fcuny/notes/static/css/custom.css index b1a1957..505f66d 100644 --- a/users/fcuny/notes/static/css/custom.css +++ b/users/fcuny/notes/static/css/custom.css @@ -1,4 +1,4 @@ - @import url('https://fonts.googleapis.com/css2?family=Roboto+Slab&display=swap'); +@import url('https://fonts.googleapis.com/css2?family=Roboto+Slab&display=swap'); @import url('https://fonts.googleapis.com/css2?family=Source+Code+Pro&display=swap'); *, *:before, *:after { box-sizing: border-box; } -- cgit 1.4.1 From 114bf5c20e5bbd74da74fa3478c7a7947dc26caf Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Sun, 11 Apr 2021 15:44:29 -0700 Subject: css: switch to sans-serif; add tables; other tweaks --- users/fcuny/notes/static/css/custom.css | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/users/fcuny/notes/static/css/custom.css b/users/fcuny/notes/static/css/custom.css index 505f66d..7592e8e 100644 --- a/users/fcuny/notes/static/css/custom.css +++ b/users/fcuny/notes/static/css/custom.css @@ -6,15 +6,15 @@ body { background-color: #ffffff; line-height: 1.5rem; - font-size: 18px; - font-family: "Roboto Slab", serif; + font-size: 16px; + font-family: "Roboto Slab", sans-serif; color: #000; padding: 2rem; } .main { margin: auto; - max-width: 50rem; + max-width: 60rem; } a { @@ -42,7 +42,7 @@ span.published, span.updated { font-style: oblique; } -code { +code.verbatim { background-color: #eeeeee; } @@ -51,7 +51,7 @@ pre { margin: 0; font-size: 16px; font-family: 'Source Code Pro', monospace; - overflow: scroll; + /* overflow: scroll; */ } .tags { @@ -69,3 +69,26 @@ pre { .meta_date { font-style: italic; } + +table { + border: 1px solid black; + width: 100%; + border-spacing: 15px; + border-collapse: collapse; + letter-spacing: 1px; + font-family: 'Source Code Pro', monospace; + font-size: 16px; + text-align: left; +} + +thead { + background-color: #E0EBF5; + font-weight: bold; +} + +blockquote { + background-color: #fffff0; + border-radius: 5px; + padding-left: 5px; + font-style: italic; +} -- cgit 1.4.1 From 27f7870ba6f4da7fdf861a948a9508cba011e83b Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Sun, 11 Apr 2021 15:44:14 -0700 Subject: toml: re-configure markup --- users/fcuny/notes/config.toml | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/users/fcuny/notes/config.toml b/users/fcuny/notes/config.toml index 23df087..31f75af 100644 --- a/users/fcuny/notes/config.toml +++ b/users/fcuny/notes/config.toml @@ -3,7 +3,6 @@ languageCode = "en-us" title = "Franck Cuny's Website" publishDir = "docs" enableGitInfo = true -markup = "org" [params] homeText = "A collection of notes" @@ -15,6 +14,24 @@ markup = "org" articles = "/:section/:slug/" tags = "/tags/:slug/" +[markup] + [markup.tableOfContents] + startLevel = 1 + endLevel = 3 + ordered = true + [markup.highlight] + anchorLineNos = false + codeFences = false + guessSyntax = false + hl_Lines = "" + lineAnchors = "" + lineNoStart = 1 + lineNos = false + lineNumbersInTable = false + noClasses = true + style = "emacs" + tabWidth = 4 + [mediaTypes."application/atom"] suffixes = ["xml"] -- cgit 1.4.1 From 86c8d29cec41f663d1a4abd155e8b7a13ad0c533 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Thu, 22 Apr 2021 12:44:27 -0700 Subject: layout: add a navbar I want to differentiate blog's entries from more general notes. For this, we create two menu entries, and add a navbar at the top. The nav bar let us select between the two kind of articles: blogs or notes. For now we have a single blog entry, and no notes. The page to list entries is simplified: we use the same layout for all lists (tags, notes, blogs). The CSS is updated to support the new nav bar. --- users/fcuny/notes/config.toml | 18 ++++++- .../notes/content/blog/google-doc-failure.org | 56 ++++++++++++++++++++++ .../notes/content/notes/google-doc-failure.org | 56 ---------------------- users/fcuny/notes/layouts/_default/baseof.html | 1 + users/fcuny/notes/layouts/_default/list.html | 8 +--- users/fcuny/notes/layouts/_default/single.html | 2 - users/fcuny/notes/layouts/index.html | 8 ---- users/fcuny/notes/layouts/partials/header.html | 15 ++++++ users/fcuny/notes/layouts/partials/postlist.html | 20 +------- users/fcuny/notes/static/css/custom.css | 41 +++++++++++++++- 10 files changed, 131 insertions(+), 94 deletions(-) create mode 100644 users/fcuny/notes/content/blog/google-doc-failure.org delete mode 100644 users/fcuny/notes/content/notes/google-doc-failure.org create mode 100644 users/fcuny/notes/layouts/partials/header.html diff --git a/users/fcuny/notes/config.toml b/users/fcuny/notes/config.toml index 31f75af..6100ba5 100644 --- a/users/fcuny/notes/config.toml +++ b/users/fcuny/notes/config.toml @@ -1,6 +1,6 @@ baseURL = "http://fcuny.net/" languageCode = "en-us" -title = "Franck Cuny's Website" +title = "Franck's rambling" publishDir = "docs" enableGitInfo = true @@ -11,9 +11,23 @@ enableGitInfo = true tag = "tags" [permalinks] - articles = "/:section/:slug/" + blog = "/blog/:slug/" + notes = "/notes/:slug/" tags = "/tags/:slug/" +[menu] + [[menu.main]] + identifier = "articles" + name = "blog" + title = "articles" + url = "/blog/" + + [[menu.main]] + identifier = "notes" + name = "notes" + title = "notes" + url = "/notes/" + [markup] [markup.tableOfContents] startLevel = 1 diff --git a/users/fcuny/notes/content/blog/google-doc-failure.org b/users/fcuny/notes/content/blog/google-doc-failure.org new file mode 100644 index 0000000..b4d449d --- /dev/null +++ b/users/fcuny/notes/content/blog/google-doc-failure.org @@ -0,0 +1,56 @@ +#+TITLE: Google Doc Failures +#+TAGS[]: documentation process +#+DATE: <2021-04-11 Sun> + +In most use cases, Google Doc is an effective tool to create "write once, read never" documents. + +* Convenience +Google Doc (GDoc from now on) is the most common way of writing and sharing documents at my current job. It's very easy to start a new document, even more since we can now point our browser to https://doc.new and start typing right away. + +Like most of my co-workers, I use it frequently during the day. Some of these documents are draft for some communication that I want others to review before I share with a broader audience; it can be a [[https://en.wikipedia.org/wiki/Request_for_Comments][Request For Comments]] for a project; meeting notes for others to read; information that I need to capture during an incident or a debugging session; interviews notes; etc. + +I would not be surprised if the teams I work closely with generate 50 new documents each week. +* ETOOMANYTABS +I have a tendency of having hundreds of open tabs in my browser during the week. A majority of these tabs are GDocs, and I think this is one of the true failure of the product. Why do I have so many tabs ? There's mainly two reasons. + +The first reason is a problem with Chrome's UX itself: it happily let me open the same URL as many times as I want in as many tabs, instead of sending me to the already opened tab if the document is loaded. It's not uncommon that I find the same document opened in 5 different tabs. + +The second reason, and it's the most important one, I know that if I need to read or comment on a doc and I close the tab, I'll likely never find that document again, or will completely forget about it. +* Discoverability +In 'the old days', you'd start a new document in Word or LibreOffice, and as you hit "save" for the first time, you've two decisions to make: how am I going to name that file, and where am I going to save it on disk. + +With GDoc these questions don't have to be answered, you don't have to name the file, and it does not matter where it lives. I've likely hundreds of docs named 'untitled' in my "drive". I also don't have to think about where they will live, because they are saved automatically for me. I'm sure there's hundreds of studies that show that these two simple steps are actually complex for many users and creates useless friction (in which folder do I store it; should I organize the docuemnts by team, years, projects; do I name it with the date and the current project; etc.). + +GDoc being a Google product, it seems pretty obvious that they would come up with a better solution: let's not organize in a strict hierarchy these files, and let's instead search for them. + +Unfortunately, GDoc's search is really poor (and I'm being kind). By default most of us start by looking for some words we know are in the doc, maybe even in the title. But when working on a multiple projects that are related to the same technology, you suddenly get hundreds of documents matching your query. It's unclear how the returned set is ordered (by date ? by author ? by some scoring that is invisible to me ?). + +You can also search by owners, but here is another annoying bit: I think about owner as author, so I usually type =author:foo= before realizing it does not work. And that implies you already know who's the owner of the document. In the case of TDDs (Technical Design Document), I might know which team is behind it, but rarely who's the actual author. + +I could search for the title, but I rarely remember or know the name of the document I'm looking for. I could also be looking by keywords, but when working on a project with tens of related documents, you have to open all the returned docs to see which one is the correct one. + +And then what about new members joining your the team ? They don't know which docs exist, who wrote them, and how they are named. They end up searching and hoping that something good will be returned. +* Workflows +More and more we create workflows around these documents: some of the docs are TDDs that are going through reviews; others are decision documents that require input from multiple teams and are pending approval; others are road map documents that also go through some review process. + +As a result we create templates for all kind of documents, with usually something like "draft → reviews → approved/rejected" at the top. We expect the owner of the doc to mark in bold what's the status of the doc to help the reader understand in what state the document is. It's difficult to keep track of open actions and comments. Yes, there's a way to get a list of all of them, but it's not in an obvious place. + +As a result, some engineers in my team built an external dashboard with swim lanes which captures the state of a document. We add new document with their URLs, add who are the reviewers, and we move the doc between the lanes. Now we have to operate a service and a database to keep track of the status of documents in GDoc. +* Alternatives +When it comes to technical document, I find that [[https://caitiem.com/2020/03/29/design-docs-markdown-and-git/][approach]] much more interesting. Some open source projects have adopted a similar workflow ([[https://github.com/kubernetes/enhancements/tree/master/keps][Kubernetes]], [[https://github.com/golang/proposal][Go]]). + +A new document starts its life as a text file (using what ever markup language your team/company prefers). The document is submitted for review, and the people who need to be consulted are added as reviewers. They can now comment on the document, the author can address them, mark them as resolved. It's clear in which state the document is: it's either in review, committed, or rejected. With this approach you also end up with a clear history, as time moves on you can amend the document by submitting a change, and the change goes through the same process. + +New comers will find the document in the repository, and if they want to see the conversation they can open the review associated with the original change. They can also see how the document evolved over time. It's also easy to publish these documents on an internal website, using a static site generator for example. + +One of the thing that I think are critical, is that all of that is done using the tools the engineers are already using for their day to day job: a text editor, a version control system, a code review tool. + +There's obviously challenges with this approach too: ++ *it's more heavy handed*: not every one likes to write in a text editor using a markup language. It can requires some time to learn or get used to the syntax ++ *it's harder to integrate schema / visuals*: but having them checked in in the repository also improves the discoverability + +It's also true that no all documents suffer the same challenges for discoverability: ++ meeting notes are usually linked to meeting invites (however if you were not part of the meeting, you end up with the same challenges to discover them) ++ drafts for communications are usually not relevant once the communication has been sent ++ interview notes are usually transferred to some tools for HR when the feedback is submitted + diff --git a/users/fcuny/notes/content/notes/google-doc-failure.org b/users/fcuny/notes/content/notes/google-doc-failure.org deleted file mode 100644 index b4d449d..0000000 --- a/users/fcuny/notes/content/notes/google-doc-failure.org +++ /dev/null @@ -1,56 +0,0 @@ -#+TITLE: Google Doc Failures -#+TAGS[]: documentation process -#+DATE: <2021-04-11 Sun> - -In most use cases, Google Doc is an effective tool to create "write once, read never" documents. - -* Convenience -Google Doc (GDoc from now on) is the most common way of writing and sharing documents at my current job. It's very easy to start a new document, even more since we can now point our browser to https://doc.new and start typing right away. - -Like most of my co-workers, I use it frequently during the day. Some of these documents are draft for some communication that I want others to review before I share with a broader audience; it can be a [[https://en.wikipedia.org/wiki/Request_for_Comments][Request For Comments]] for a project; meeting notes for others to read; information that I need to capture during an incident or a debugging session; interviews notes; etc. - -I would not be surprised if the teams I work closely with generate 50 new documents each week. -* ETOOMANYTABS -I have a tendency of having hundreds of open tabs in my browser during the week. A majority of these tabs are GDocs, and I think this is one of the true failure of the product. Why do I have so many tabs ? There's mainly two reasons. - -The first reason is a problem with Chrome's UX itself: it happily let me open the same URL as many times as I want in as many tabs, instead of sending me to the already opened tab if the document is loaded. It's not uncommon that I find the same document opened in 5 different tabs. - -The second reason, and it's the most important one, I know that if I need to read or comment on a doc and I close the tab, I'll likely never find that document again, or will completely forget about it. -* Discoverability -In 'the old days', you'd start a new document in Word or LibreOffice, and as you hit "save" for the first time, you've two decisions to make: how am I going to name that file, and where am I going to save it on disk. - -With GDoc these questions don't have to be answered, you don't have to name the file, and it does not matter where it lives. I've likely hundreds of docs named 'untitled' in my "drive". I also don't have to think about where they will live, because they are saved automatically for me. I'm sure there's hundreds of studies that show that these two simple steps are actually complex for many users and creates useless friction (in which folder do I store it; should I organize the docuemnts by team, years, projects; do I name it with the date and the current project; etc.). - -GDoc being a Google product, it seems pretty obvious that they would come up with a better solution: let's not organize in a strict hierarchy these files, and let's instead search for them. - -Unfortunately, GDoc's search is really poor (and I'm being kind). By default most of us start by looking for some words we know are in the doc, maybe even in the title. But when working on a multiple projects that are related to the same technology, you suddenly get hundreds of documents matching your query. It's unclear how the returned set is ordered (by date ? by author ? by some scoring that is invisible to me ?). - -You can also search by owners, but here is another annoying bit: I think about owner as author, so I usually type =author:foo= before realizing it does not work. And that implies you already know who's the owner of the document. In the case of TDDs (Technical Design Document), I might know which team is behind it, but rarely who's the actual author. - -I could search for the title, but I rarely remember or know the name of the document I'm looking for. I could also be looking by keywords, but when working on a project with tens of related documents, you have to open all the returned docs to see which one is the correct one. - -And then what about new members joining your the team ? They don't know which docs exist, who wrote them, and how they are named. They end up searching and hoping that something good will be returned. -* Workflows -More and more we create workflows around these documents: some of the docs are TDDs that are going through reviews; others are decision documents that require input from multiple teams and are pending approval; others are road map documents that also go through some review process. - -As a result we create templates for all kind of documents, with usually something like "draft → reviews → approved/rejected" at the top. We expect the owner of the doc to mark in bold what's the status of the doc to help the reader understand in what state the document is. It's difficult to keep track of open actions and comments. Yes, there's a way to get a list of all of them, but it's not in an obvious place. - -As a result, some engineers in my team built an external dashboard with swim lanes which captures the state of a document. We add new document with their URLs, add who are the reviewers, and we move the doc between the lanes. Now we have to operate a service and a database to keep track of the status of documents in GDoc. -* Alternatives -When it comes to technical document, I find that [[https://caitiem.com/2020/03/29/design-docs-markdown-and-git/][approach]] much more interesting. Some open source projects have adopted a similar workflow ([[https://github.com/kubernetes/enhancements/tree/master/keps][Kubernetes]], [[https://github.com/golang/proposal][Go]]). - -A new document starts its life as a text file (using what ever markup language your team/company prefers). The document is submitted for review, and the people who need to be consulted are added as reviewers. They can now comment on the document, the author can address them, mark them as resolved. It's clear in which state the document is: it's either in review, committed, or rejected. With this approach you also end up with a clear history, as time moves on you can amend the document by submitting a change, and the change goes through the same process. - -New comers will find the document in the repository, and if they want to see the conversation they can open the review associated with the original change. They can also see how the document evolved over time. It's also easy to publish these documents on an internal website, using a static site generator for example. - -One of the thing that I think are critical, is that all of that is done using the tools the engineers are already using for their day to day job: a text editor, a version control system, a code review tool. - -There's obviously challenges with this approach too: -+ *it's more heavy handed*: not every one likes to write in a text editor using a markup language. It can requires some time to learn or get used to the syntax -+ *it's harder to integrate schema / visuals*: but having them checked in in the repository also improves the discoverability - -It's also true that no all documents suffer the same challenges for discoverability: -+ meeting notes are usually linked to meeting invites (however if you were not part of the meeting, you end up with the same challenges to discover them) -+ drafts for communications are usually not relevant once the communication has been sent -+ interview notes are usually transferred to some tools for HR when the feedback is submitted - diff --git a/users/fcuny/notes/layouts/_default/baseof.html b/users/fcuny/notes/layouts/_default/baseof.html index d9ca51a..3fd7011 100644 --- a/users/fcuny/notes/layouts/_default/baseof.html +++ b/users/fcuny/notes/layouts/_default/baseof.html @@ -3,6 +3,7 @@ {{ partial "head.html" . }}
+ {{- partial "header.html" . -}}
{{ block "main" . }}{{ end }}
diff --git a/users/fcuny/notes/layouts/_default/list.html b/users/fcuny/notes/layouts/_default/list.html index 3423cb6..2b7d98a 100644 --- a/users/fcuny/notes/layouts/_default/list.html +++ b/users/fcuny/notes/layouts/_default/list.html @@ -1,10 +1,6 @@ {{ define "main" }} -

{{ .Title }}

-{{ range .Pages.ByPublishDate.Reverse }} -

- {{ .Title }} -

-{{ end }} + {{ $pgs := where .Data.Pages "Params.hidden" "ne" "true" }} + {{ partial "postlist" $pgs }} {{ end }} diff --git a/users/fcuny/notes/layouts/_default/single.html b/users/fcuny/notes/layouts/_default/single.html index 0ab5e35..356f344 100644 --- a/users/fcuny/notes/layouts/_default/single.html +++ b/users/fcuny/notes/layouts/_default/single.html @@ -1,7 +1,5 @@ {{ define "main" }} -

← Back to Franck's homepage

-

{{ .Title }}

diff --git a/users/fcuny/notes/layouts/index.html b/users/fcuny/notes/layouts/index.html index 450444b..f7581ff 100644 --- a/users/fcuny/notes/layouts/index.html +++ b/users/fcuny/notes/layouts/index.html @@ -11,12 +11,4 @@

I'm currently working as a Site Reliability Engineer at Twitter, on the Compute team.

-

Notes

- {{ $section := "notes" }} - - {{ end }} diff --git a/users/fcuny/notes/layouts/partials/header.html b/users/fcuny/notes/layouts/partials/header.html new file mode 100644 index 0000000..f918823 --- /dev/null +++ b/users/fcuny/notes/layouts/partials/header.html @@ -0,0 +1,15 @@ +
+ +
diff --git a/users/fcuny/notes/layouts/partials/postlist.html b/users/fcuny/notes/layouts/partials/postlist.html index 3695d82..28fd9b2 100644 --- a/users/fcuny/notes/layouts/partials/postlist.html +++ b/users/fcuny/notes/layouts/partials/postlist.html @@ -1,28 +1,10 @@ -

← Back to Franck's homepage

- -{{ range .GroupByDate "2006-Jan" }} +{{ range .GroupByDate "2006" }}

{{ .Key }}

    {{ range .Pages.ByDate }}
  • {{ .Title }}

    - {{ if .Params.tags }} -
    - Tags: - {{ range $idx, $tag := .Params.tags }} - {{ $tag }} - {{ end }} -
    - {{ else }} -
    - {{ end }} -
    -
    -

    - {{ .Summary }} - Read more → -

  • {{ end }} diff --git a/users/fcuny/notes/static/css/custom.css b/users/fcuny/notes/static/css/custom.css index 7592e8e..f363bee 100644 --- a/users/fcuny/notes/static/css/custom.css +++ b/users/fcuny/notes/static/css/custom.css @@ -38,7 +38,7 @@ h2 { } span.published, span.updated { - display: block; + display: center; font-style: oblique; } @@ -92,3 +92,42 @@ blockquote { padding-left: 5px; font-style: italic; } + +nav { + display: flex; + flex: 2 0px; + justify-content: flex-end; + padding-left: 1em; + margin: 0 auto; + line-height: 0.2rem; +} + +nav ul { + display: flex; + list-style-type: none; + margin: 0 +} + +nav a { + padding: 1em; + display: inline-block; + color: black; + font-family: sans-serif; + text-decoration: none; + transition: all 75ms ease-in; +} + +nav a:hover { + color: #fff; + background-color: #007d9c; +} + +nav a.menu-active:hover { + color: #fff; + background-color: #007d9c; +} + +nav a.menu-active { + color: #007d9c; +} + -- cgit 1.4.1 From 01251ea564dca630aa89ab264eff08a3373c7b4e Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Thu, 22 Apr 2021 17:20:21 -0700 Subject: blog: containerd to firecracker --- .../content/notes/containerd-to-firecracker.org | 567 +++++++++++++++++++++ 1 file changed, 567 insertions(+) create mode 100644 users/fcuny/notes/content/notes/containerd-to-firecracker.org diff --git a/users/fcuny/notes/content/notes/containerd-to-firecracker.org b/users/fcuny/notes/content/notes/containerd-to-firecracker.org new file mode 100644 index 0000000..bce21d8 --- /dev/null +++ b/users/fcuny/notes/content/notes/containerd-to-firecracker.org @@ -0,0 +1,567 @@ +#+TITLE: containerd to firecracker +#+DATE: <2021-05-15 Sat> +#+TAGS[]: linux, firecracker, containerd + +fly.io had an [[https://fly.io/blog/docker-without-docker/][interesting article]] about how they use docker images to create VMs for =firecracker=. + +They describe the process as follow: + +1. Pull a container from a registry +2. Create a loop device to store the container's filesystem on +3. Unpack the container into the mounted loop device +4. Create a second block device and inject init, kernel, configuration and other stuff +5. Attach persistent volumes (if any) +6. Create a TAP device and configure it +7. Hand it off to Firecracker and boot that thing + +That's pretty detailed, and I'm curious how difficult it is to implement this. I've been meaning to look into Firecracker for a while and into containers'd API, so this is a perfect opportunity to get started. + +* #1 Pull a container from a registry with =containerd= +=containerd= has a pretty [[https://pkg.go.dev/github.com/containerd/containerd][detailed documentation]]. From the main page we can see the following example to create a client. +#+begin_src go +import ( + "github.com/containerd/containerd" + "github.com/containerd/containerd/cio" +) + + +func main() { + client, err := containerd.New("/run/containerd/containerd.sock") + defer client.Close() +} +#+end_src + +And pulling an image is also pretty straightforward: +#+begin_src go +image, err := client.Pull(context, "docker.io/library/redis:latest") +#+end_src + +The =Pull= method returns an [[https://pkg.go.dev/github.com/containerd/containerd@v1.4.4/images#Image][=Image=]] and there's a few methods associated with it. + +As =containerd= has namespaces, it's possible to specify the namespace we want to use when working with the API: +#+begin_src go +ctx := namespaces.WithNamespace(context.Background(), "c2vm") +image, err := client.Pull(ctx, "docker.io/library/redis:latest") +#+end_src + +The image will now be stored in the =c2vm= namespace. We can verify this with: +#+begin_src sh +; sudo ctr -n c2vm images ls -q +docker.io/library/redis:latest +#+end_src + +* #2 Create a loop device to store the container's filesystem on +This is going to be pretty straightforward. To create a loop device we need to: +1. pre-allocate space to a file +2. convert that file to some format +3. mount it to some destination + +There's two commons ways to pre-allocate space to a file: =dd= and =fallocate= (there's likely way more ways to do this). I'll go with =fallocate= for this example. + +First, to be safe, we create a temporary file, and use =renameio= to handle the renaming (I recommend reading the doc of the module). + +#+begin_src go +f, err := renameio.TempFile("", rawFile) +if err != nil { + return err +} +defer f.Cleanup() +#+end_src + +Now to do the pre-allocation (we're making an assumption here that 2GB is enough, we can likely check what's the size of the container before doing this): +#+begin_src go +command := exec.Command("fallocate", "-l", "2G", f.Name()) +if err := command.Run(); err != nil { + return fmt.Errorf("fallocate error: %s", err) +} +#+end_src + +We can now convert that file to ext4: +#+begin_src go +command = exec.Command("mkfs.ext4", "-F", f.Name()) +if err := command.Run(); err != nil { + return fmt.Errorf("mkfs.ext4 error: %s", err) +} +#+end_src + +Now we can rename safely the temporary file to the proper file we want: +#+begin_src go +f.CloseAtomicallyReplace() +#+end_src + +And to mount that file +#+begin_src go +command = exec.Command("mount", "-o", "loop", rawFile, mntDir) +if err := command.Run(); err != nil { + return fmt.Errorf("mount error: %s", err) +} +#+end_src +* #3 Unpack the container into the mounted loop device +Extracting the container using =containerd= is pretty simple. Here's the function that I use: +#+begin_src go +func extract(ctx context.Context, client *containerd.Client, image containerd.Image, mntDir string) error { + manifest, err := images.Manifest(ctx, client.ContentStore(), image.Target(), platform) + if err != nil { + log.Fatalf("failed to get the manifest: %v\n", err) + } + + for _, desc := range manifest.Layers { + log.Printf("extracting layer %s\n", desc.Digest.String()) + layer, err := client.ContentStore().ReaderAt(ctx, desc) + if err != nil { + return err + } + if err := archive.Untar(content.NewReader(layer), mntDir, &archive.TarOptions{NoLchown: true}); err != nil { + return err + } + } + + return nil +} +#+end_src + +Calling =images.Manifest= returns the [[https://github.com/opencontainers/image-spec/blob/master/manifest.md][manifest]] from the image. What we care here are the list of layers. Here I'm making a number of assumptions regarding their type (we should be checking the media type first). We read the layers and extract them to the mounted path. +* #4 Create a second block device and inject other stuff +Here I'm going to deviate a bit. I will not create a second loop device, and I will not inject a kernel. In their article, they provided a link to a snapshot of their =init= process (https://github.com/superfly/init-snapshot). In order to keep this simple, our init is going to be a shell script composed of the content of the entry point of the container. We're also going to add a few extra files to container (=/etc/hosts= and =/etc/resolv.conf=). + +Finally, since we've pre-allocated 2GB for that container, and we likely don't need that much, we're also going to resize the image. +** Add init +Let's refer to the [[https://github.com/opencontainers/image-spec/blob/master/config.md][specification for the config]]. The elements that are of interest to me are: +- =Env=, which is array of strings. They contain the environment variables that likely we need to run the program +- =Cmd=, which is also an array of strings. If there's no entry point provided, this is what is used. + +At this point, for this experiment, I'm going to ignore exposed ports, working directory, and the user. + +First we need to read the config from the container. This is easily done: +#+begin_src go +config, err := images.Config(ctx, client.ContentStore(), image.Target(), platform) +if err != nil { + return err +} +#+end_src + +This needs to be read and decoded: +#+begin_src go +configBlob, err := content.ReadBlob(ctx, client.ContentStore(), config) +var imageSpec ocispec.Image +json.Unmarshal(configBlob, &imageSpec) +#+end_src + +=init= is the first process started by Linux during boot. On a regular Linux desktop you likely have a symbolic link from =/usr/bin/init= to =/usr/lib/systemd/systemd=, since most distributions have switched to =systemd=. For my use case however, I want to run a single process, and I want it to be the one from the container. For this we can create a simple shell script inside the container (the location does not matter for now) with the environment variables and the command. + +Naively, this can be done like this: +#+begin_src go +initPath := filepath.Join(mntDir, "init.sh") +f, err := renameio.TempFile("", initPath) +if err != nil { + return err +} +defer f.Cleanup() + +writer := bufio.NewWriter(f) +fmt.Fprintf(writer, "#!/bin/sh\n") +for _, env := range initEnvs { + fmt.Fprintf(writer, "export %s\n", env) +} +fmt.Fprintf(writer, "%s\n", initCmd) +writer.Flush() + +f.CloseAtomicallyReplace() + +mode := int(0755) +os.Chmod(initPath, os.FileMode(mode)) +#+end_src + +We're once again creating a temporary file with =renamio=, and we're writing our shell scripts, one line at a time. We only need to make sure this executable. +** extra files +Once we have our init file, I also want to add a few extra files: =/etc/hosts= and =/etc/resolv.conf=. This files are not always present, since they can be injected by other systems. I also want to make sure that DNS resolutions are done using my own DNS server. +** resize the image +We've pre-allocated 2GB for the image, and it's likely we don't need as much space. We can do this by running =e2fsck= and =resize2fs= once we're done manipulating the image. + +Within a function, we can do the following: +#+begin_src go +command := exec.Command("/usr/bin/e2fsck", "-p", "-f", rawFile) +if err := command.Run(); err != nil { + return fmt.Errorf("e2fsck error: %s", err) +} + +command = exec.Command("resize2fs", "-M", rawFile) +if err := command.Run(); err != nil { + return fmt.Errorf("resize2fs error: %s", err) +} +#+end_src + +I'm using =docker.io/library/redis:latest= for my test, and I end up with the following size for the image: +#+begin_src bash +-rw------- 1 root root 216M Apr 22 14:50 /tmp/fcuny.img +#+end_src +** Kernel +We're going to need a kernel to run that VM. In my case I've decided to go with version 5.8, and build a custom kernel. If you are not familiar with the process, the firecracker team has [[https://github.com/firecracker-microvm/firecracker/blob/main/docs/rootfs-and-kernel-setup.md#creating-a-kernel-image][documented how to do this]]. In my case all I had to do was: +#+begin_src sh +git clone https://github.com/torvalds/linux.git linux.git +cd linux.git +git checkout v5.8 +curl -o .config -s https://github.com/firecracker-microvm/firecracker/blob/main/resources/microvm-kernel-x86_64.config +make menuconfig +make vmlinux -j8 +#+end_src + +Note that they also have a pretty [[https://github.com/firecracker-microvm/firecracker/blob/main/docs/prod-host-setup.md][good documentation for production]]. +* #5 Attach persistent volumes (if any) +I'm going to skip that step for now. +* #6 Create a TAP device and configure it +We're going to need a network for that VM (otherwise it might be a bit boring). +There's a few solutions that we can take: +1. create the TAP device +2. delegate all that work to a [[https://github.com/containernetworking/cni][CNI]] + +I've decided to use the CNI approach [[https://github.com/firecracker-microvm/firecracker-go-sdk#cni][documented in the Go's SDK]]. For this to work we need to install the =tc-redirect-tap= CNI plugin (available at https://github.com/awslabs/tc-redirect-tap). + +Based on that documentation, I'll start with the following configuration in =etc/cni/conf.d/50-c2vm.conflist=: +#+begin_src json +{ + "name": "c2vm", + "cniVersion": "0.4.0", + "plugins": [ + { + "type": "bridge", + "bridge": "c2vm-br", + "isDefaultGateway": true, + "forceAddress": false, + "ipMasq": true, + "hairpinMode": true, + "mtu": 1500, + "ipam": { + "type": "host-local", + "subnet": "192.168.128.0/24", + "resolvConf": "/etc/resolv.conf" + } + }, + { + "type": "firewall" + }, + { + "type": "tc-redirect-tap" + } + ] +} +#+end_src +* #7 Hand it off to Firecracker and boot that thing +Now that we have all the components, we need to boot that VM. Since I've been working with Go so far, I'll also use the [[https://github.com/firecracker-microvm/firecracker-go-sdk][Go SDK]] to manage and start the VM. + +For this we need the firecracker binary, which we can [[https://github.com/firecracker-microvm/firecracker/releases][find on GitHub]]. + +The first thing is to configure the list of devices. In our case we will have a single device, the boot drive that we've created in the previous step. +#+begin_src go +devices := make([]models.Drive, 1) +devices[0] = models.Drive{ + DriveID: firecracker.String("1"), + PathOnHost: &rawImage, + IsRootDevice: firecracker.Bool(true), + IsReadOnly: firecracker.Bool(false), +} +#+end_src + +The next step is to configure the VM: +#+begin_src go +fcCfg := firecracker.Config{ + LogLevel: "debug", + SocketPath: firecrackerSock, + KernelImagePath: linuxKernel, + KernelArgs: "console=ttyS0 reboot=k panic=1 pci=off init=/init.sh random.trust_cpu=on", + Drives: devices, + MachineCfg: models.MachineConfiguration{ + VcpuCount: firecracker.Int64(1), + CPUTemplate: models.CPUTemplate("C3"), + HtEnabled: firecracker.Bool(true), + MemSizeMib: firecracker.Int64(512), + }, + NetworkInterfaces: []firecracker.NetworkInterface{ + { + CNIConfiguration: &firecracker.CNIConfiguration{ + NetworkName: "c2vm", + IfName: "eth0", + }, + }, + }, +} +#+end_src + +Finally we can create the command to start and run the VM: +#+begin_src go +command := firecracker.VMCommandBuilder{}. + WithBin(firecrackerBinary). + WithSocketPath(fcCfg.SocketPath). + WithStdin(os.Stdin). + WithStdout(os.Stdout). + WithStderr(os.Stderr). + Build(ctx) +machineOpts = append(machineOpts, firecracker.WithProcessRunner(command)) +m, err := firecracker.NewMachine(vmmCtx, fcCfg, machineOpts...) +if err != nil { + panic(err) +} + +if err := m.Start(vmmCtx); err != nil { + panic(err) +} +defer m.StopVMM() + +if err := m.Wait(vmmCtx); err != nil { + panic(err) +} +#+end_src + +The end result: +#+begin_src +; sudo ./c2vm -container docker.io/library/redis:latest -firecracker-binary ./hack/firecracker/firecracker-v0.24.3-x86_64 -linux-kernel ./hack/linux/my-linux.bin -out /tmp/redis.img +2021/05/15 14:12:59 pulled docker.io/library/redis:latest (38690247 bytes) +2021/05/15 14:13:00 mounted /tmp/redis.img on /tmp/c2vm026771514 +2021/05/15 14:13:00 extracting layer sha256:69692152171afee1fd341febc390747cfca2ff302f2881d8b394e786af605696 +2021/05/15 14:13:00 extracting layer sha256:a4a46f2fd7e06fab84b4e78eb2d1b6d007351017f9b18dbeeef1a9e7cf194e00 +2021/05/15 14:13:00 extracting layer sha256:bcdf6fddc3bdaab696860eb0f4846895c53a3192c9d7bf8d2275770ea8073532 +2021/05/15 14:13:01 extracting layer sha256:b7e9b50900cc06838c44e0fc5cbebe5c0b3e7f70c02f32dd754e1aa6326ed566 +2021/05/15 14:13:01 extracting layer sha256:5f3030c50d85a9d2f70adb610b19b63290c6227c825639b227ddc586f86d1c76 +2021/05/15 14:13:01 extracting layer sha256:63dae8e0776cdbd63909fbd9c047c1615a01cb21b73efa87ae2feed680d3ffa1 +2021/05/15 14:13:01 init script created +2021/05/15 14:13:01 umount /tmp/c2vm026771514 +INFO[0003] Called startVMM(), setting up a VMM on firecracker.sock +INFO[0003] VMM logging disabled. +INFO[0003] VMM metrics disabled. +INFO[0003] refreshMachineConfiguration: [GET /machine-config][200] getMachineConfigurationOK &{CPUTemplate:C3 HtEnabled:0xc0004e6753 MemSizeMib:0xc0004e6748 VcpuCount:0xc0004e6740} +INFO[0003] PutGuestBootSource: [PUT /boot-source][204] putGuestBootSourceNoContent +INFO[0003] Attaching drive /tmp/redis.img, slot 1, root true. +INFO[0003] Attached drive /tmp/redis.img: [PUT /drives/{drive_id}][204] putGuestDriveByIdNoContent +INFO[0003] Attaching NIC tap0 (hwaddr 9e:72:c7:04:6b:80) at index 1 +INFO[0003] startInstance successful: [PUT /actions][204] createSyncActionNoContent +[ 0.000000] Linux version 5.8.0 (fcuny@nas) (gcc (Debian 8.3.0-6) 8.3.0, GNU ld (GNU Binutils for Debian) 2.31.1) #1 SMP Mon Apr 12 20:07:40 PDT 2021 +[ 0.000000] Command line: i8042.dumbkbd ip=192.168.128.9::192.168.128.1:255.255.255.0:::off::: console=ttyS0 reboot=k panic=1 acpi=off pci=off i8042.noaux i8042.nomux i8042.nopnp init=/init.sh random.trust_cpu=on root=/dev/vda rw virtio_mmio.device=4K@0xd0000000:5 virtio_mmio.device=4K@0xd0001000:6 +[ 0.000000] x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point registers' +[ 0.000000] x86/fpu: Supporting XSAVE feature 0x002: 'SSE registers' +[ 0.000000] x86/fpu: Supporting XSAVE feature 0x004: 'AVX registers' +[ 0.000000] x86/fpu: xstate_offset[2]: 576, xstate_sizes[2]: 256 +[ 0.000000] x86/fpu: Enabled xstate features 0x7, context size is 832 bytes, using 'standard' format. +[ 0.000000] BIOS-provided physical RAM map: +[ 0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable +[ 0.000000] BIOS-e820: [mem 0x0000000000100000-0x000000001fffffff] usable +[ 0.000000] NX (Execute Disable) protection: active +[ 0.000000] DMI not present or invalid. +[ 0.000000] Hypervisor detected: KVM +[ 0.000000] kvm-clock: Using msrs 4b564d01 and 4b564d00 +[ 0.000000] kvm-clock: cpu 0, msr 2401001, primary cpu clock +[ 0.000000] kvm-clock: using sched offset of 11918596 cycles +[ 0.000005] clocksource: kvm-clock: mask: 0xffffffffffffffff max_cycles: 0x1cd42e4dffb, max_idle_ns: 881590591483 ns +[ 0.000011] tsc: Detected 1190.400 MHz processor +[ 0.000108] last_pfn = 0x20000 max_arch_pfn = 0x400000000 +[ 0.000151] Disabled +[ 0.000156] x86/PAT: MTRRs disabled, skipping PAT initialization too. +[ 0.000166] CPU MTRRs all blank - virtualized system. +[ 0.000170] x86/PAT: Configuration [0-7]: WB WT UC- UC WB WT UC- UC +[ 0.000201] found SMP MP-table at [mem 0x0009fc00-0x0009fc0f] +[ 0.000257] check: Scanning 1 areas for low memory corruption +[ 0.000364] No NUMA configuration found +[ 0.000365] Faking a node at [mem 0x0000000000000000-0x000000001fffffff] +[ 0.000370] NODE_DATA(0) allocated [mem 0x1ffde000-0x1fffffff] +[ 0.000490] Zone ranges: +[ 0.000493] DMA [mem 0x0000000000001000-0x0000000000ffffff] +[ 0.000494] DMA32 [mem 0x0000000001000000-0x000000001fffffff] +[ 0.000495] Normal empty +[ 0.000497] Movable zone start for each node +[ 0.000500] Early memory node ranges +[ 0.000501] node 0: [mem 0x0000000000001000-0x000000000009efff] +[ 0.000502] node 0: [mem 0x0000000000100000-0x000000001fffffff] +[ 0.000510] Zeroed struct page in unavailable ranges: 98 pages +[ 0.000511] Initmem setup node 0 [mem 0x0000000000001000-0x000000001fffffff] +[ 0.004990] Intel MultiProcessor Specification v1.4 +[ 0.004995] MPTABLE: OEM ID: FC +[ 0.004995] MPTABLE: Product ID: 000000000000 +[ 0.004996] MPTABLE: APIC at: 0xFEE00000 +[ 0.005007] Processor #0 (Bootup-CPU) +[ 0.005039] IOAPIC[0]: apic_id 2, version 17, address 0xfec00000, GSI 0-23 +[ 0.005041] Processors: 1 +[ 0.005042] TSC deadline timer available +[ 0.005044] smpboot: Allowing 1 CPUs, 0 hotplug CPUs +[ 0.005060] KVM setup pv remote TLB flush +[ 0.005072] KVM setup pv sched yield +[ 0.005078] PM: hibernation: Registered nosave memory: [mem 0x00000000-0x00000fff] +[ 0.005079] PM: hibernation: Registered nosave memory: [mem 0x0009f000-0x000fffff] +[ 0.005081] [mem 0x20000000-0xffffffff] available for PCI devices +[ 0.005082] Booting paravirtualized kernel on KVM +[ 0.005084] clocksource: refined-jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645519600211568 ns +[ 0.005087] setup_percpu: NR_CPUS:128 nr_cpumask_bits:128 nr_cpu_ids:1 nr_node_ids:1 +[ 0.006381] percpu: Embedded 44 pages/cpu s143360 r8192 d28672 u2097152 +[ 0.006404] KVM setup async PF for cpu 0 +[ 0.006410] kvm-stealtime: cpu 0, msr 1f422080 +[ 0.006420] Built 1 zonelists, mobility grouping on. Total pages: 128905 +[ 0.006420] Policy zone: DMA32 +[ 0.006422] Kernel command line: i8042.dumbkbd ip=192.168.128.9::192.168.128.1:255.255.255.0:::off::: console=ttyS0 reboot=k panic=1 acpi=off pci=off i8042.noaux i8042.nomux i8042.nopnp init=/init.sh random.trust_cpu=on root=/dev/vda rw virtio_mmio.device=4K@0xd0000000:5 virtio_mmio.device=4K@0xd0001000:6 +[ 0.006858] Dentry cache hash table entries: 65536 (order: 7, 524288 bytes, linear) +[ 0.007003] Inode-cache hash table entries: 32768 (order: 6, 262144 bytes, linear) +[ 0.007047] mem auto-init: stack:off, heap alloc:off, heap free:off +[ 0.007947] Memory: 491940K/523896K available (10243K kernel code, 629K rwdata, 1860K rodata, 1408K init, 6048K bss, 31956K reserved, 0K cma-reserved) +[ 0.007980] random: get_random_u64 called from __kmem_cache_create+0x3d/0x540 with crng_init=0 +[ 0.008053] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1 +[ 0.008146] rcu: Hierarchical RCU implementation. +[ 0.008147] rcu: RCU restricting CPUs from NR_CPUS=128 to nr_cpu_ids=1. +[ 0.008151] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies. +[ 0.008152] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=1 +[ 0.008170] NR_IRQS: 4352, nr_irqs: 48, preallocated irqs: 16 +[ 0.008373] random: crng done (trusting CPU's manufacturer) +[ 0.008430] Console: colour dummy device 80x25 +[ 0.052276] printk: console [ttyS0] enabled +[ 0.052685] APIC: Switch to symmetric I/O mode setup +[ 0.053288] x2apic enabled +[ 0.053705] Switched APIC routing to physical x2apic. +[ 0.054213] KVM setup pv IPIs +[ 0.055559] clocksource: tsc-early: mask: 0xffffffffffffffff max_cycles: 0x1128af0325d, max_idle_ns: 440795261011 ns +[ 0.056516] Calibrating delay loop (skipped) preset value.. 2380.80 BogoMIPS (lpj=4761600) +[ 0.057259] pid_max: default: 32768 minimum: 301 +[ 0.057726] LSM: Security Framework initializing +[ 0.058176] SELinux: Initializing. +[ 0.058556] Mount-cache hash table entries: 1024 (order: 1, 8192 bytes, linear) +[ 0.059221] Mountpoint-cache hash table entries: 1024 (order: 1, 8192 bytes, linear) +[ 0.060382] x86/cpu: User Mode Instruction Prevention (UMIP) activated +[ 0.060510] Last level iTLB entries: 4KB 0, 2MB 0, 4MB 0 +[ 0.060510] Last level dTLB entries: 4KB 0, 2MB 0, 4MB 0, 1GB 0 +[ 0.060510] Spectre V1 : Mitigation: usercopy/swapgs barriers and __user pointer sanitization +[ 0.060510] Spectre V2 : Mitigation: Enhanced IBRS +[ 0.060510] Spectre V2 : Spectre v2 / SpectreRSB mitigation: Filling RSB on context switch +[ 0.060510] Spectre V2 : mitigation: Enabling conditional Indirect Branch Prediction Barrier +[ 0.060510] Speculative Store Bypass: Mitigation: Speculative Store Bypass disabled via prctl and seccomp +[ 0.060510] Freeing SMP alternatives memory: 32K +[ 0.060510] smpboot: CPU0: Intel(R) Xeon(R) Processor @ 1.20GHz (family: 0x6, model: 0x3e, stepping: 0x4) +[ 0.060510] Performance Events: unsupported p6 CPU model 62 no PMU driver, software events only. +[ 0.060510] rcu: Hierarchical SRCU implementation. +[ 0.060510] smp: Bringing up secondary CPUs ... +[ 0.060510] smp: Brought up 1 node, 1 CPU +[ 0.060510] smpboot: Max logical packages: 1 +[ 0.060523] smpboot: Total of 1 processors activated (2380.80 BogoMIPS) +[ 0.061338] devtmpfs: initialized +[ 0.061710] x86/mm: Memory block size: 128MB +[ 0.062341] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns +[ 0.063245] futex hash table entries: 256 (order: 2, 16384 bytes, linear) +[ 0.063946] thermal_sys: Registered thermal governor 'fair_share' +[ 0.063946] thermal_sys: Registered thermal governor 'step_wise' +[ 0.064522] thermal_sys: Registered thermal governor 'user_space' +[ 0.065313] NET: Registered protocol family 16 +[ 0.066398] DMA: preallocated 128 KiB GFP_KERNEL pool for atomic allocations +[ 0.067057] DMA: preallocated 128 KiB GFP_KERNEL|GFP_DMA pool for atomic allocations +[ 0.067778] DMA: preallocated 128 KiB GFP_KERNEL|GFP_DMA32 pool for atomic allocations +[ 0.068506] audit: initializing netlink subsys (disabled) +[ 0.068708] cpuidle: using governor ladder +[ 0.069097] cpuidle: using governor menu +[ 0.070636] audit: type=2000 audit(1621113181.800:1): state=initialized audit_enabled=0 res=1 +[ 0.076346] HugeTLB registered 2.00 MiB page size, pre-allocated 0 pages +[ 0.077007] ACPI: Interpreter disabled. +[ 0.077445] SCSI subsystem initialized +[ 0.077812] pps_core: LinuxPPS API ver. 1 registered +[ 0.078277] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti +[ 0.079206] PTP clock support registered +[ 0.079741] NetLabel: Initializing +[ 0.080111] NetLabel: domain hash size = 128 +[ 0.080529] NetLabel: protocols = UNLABELED CIPSOv4 CALIPSO +[ 0.081113] NetLabel: unlabeled traffic allowed by default +[ 0.082072] clocksource: Switched to clocksource kvm-clock +[ 0.082715] VFS: Disk quotas dquot_6.6.0 +[ 0.083123] VFS: Dquot-cache hash table entries: 512 (order 0, 4096 bytes) +[ 0.083855] pnp: PnP ACPI: disabled +[ 0.084510] NET: Registered protocol family 2 +[ 0.084718] tcp_listen_portaddr_hash hash table entries: 256 (order: 0, 4096 bytes, linear) +[ 0.085602] TCP established hash table entries: 4096 (order: 3, 32768 bytes, linear) +[ 0.086365] TCP bind hash table entries: 4096 (order: 4, 65536 bytes, linear) +[ 0.087025] TCP: Hash tables configured (established 4096 bind 4096) +[ 0.087749] UDP hash table entries: 256 (order: 1, 8192 bytes, linear) +[ 0.088481] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes, linear) +[ 0.089261] NET: Registered protocol family 1 +[ 0.090395] virtio-mmio: Registering device virtio-mmio.0 at 0xd0000000-0xd0000fff, IRQ 5. +[ 0.091388] virtio-mmio: Registering device virtio-mmio.1 at 0xd0001000-0xd0001fff, IRQ 6. +[ 0.092222] clocksource: tsc: mask: 0xffffffffffffffff max_cycles: 0x1128af0325d, max_idle_ns: 440795261011 ns +[ 0.093322] clocksource: Switched to clocksource tsc +[ 0.093824] platform rtc_cmos: registered platform RTC device (no PNP device found) +[ 0.094618] check: Scanning for low memory corruption every 60 seconds +[ 0.095394] Initialise system trusted keyrings +[ 0.095836] Key type blacklist registered +[ 0.096427] workingset: timestamp_bits=36 max_order=17 bucket_order=0 +[ 0.097849] squashfs: version 4.0 (2009/01/31) Phillip Lougher +[ 0.107488] Key type asymmetric registered +[ 0.107905] Asymmetric key parser 'x509' registered +[ 0.108409] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252) +[ 0.109435] Serial: 8250/16550 driver, 1 ports, IRQ sharing disabled +[ 0.110116] serial8250: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A +[ 0.111877] loop: module loaded +[ 0.112426] virtio_blk virtio0: [vda] 441152 512-byte logical blocks (226 MB/215 MiB) +[ 0.113229] vda: detected capacity change from 0 to 225869824 +[ 0.114143] Loading iSCSI transport class v2.0-870. +[ 0.114753] iscsi: registered transport (tcp) +[ 0.115162] tun: Universal TUN/TAP device driver, 1.6 +[ 0.115955] i8042: PNP detection disabled +[ 0.116498] serio: i8042 KBD port at 0x60,0x64 irq 1 +[ 0.117089] input: AT Raw Set 2 keyboard as /devices/platform/i8042/serio0/input/input0 +[ 0.117932] intel_pstate: CPU model not supported +[ 0.118448] hid: raw HID events driver (C) Jiri Kosina +[ 0.119090] Initializing XFRM netlink socket +[ 0.119555] NET: Registered protocol family 10 +[ 0.120285] Segment Routing with IPv6 +[ 0.120812] NET: Registered protocol family 17 +[ 0.121350] Bridge firewalling registered +[ 0.122026] NET: Registered protocol family 40 +[ 0.122515] IPI shorthand broadcast: enabled +[ 0.122961] sched_clock: Marking stable (72512224, 48198862)->(137683636, -16972550) +[ 0.123796] registered taskstats version 1 +[ 0.124203] Loading compiled-in X.509 certificates +[ 0.125355] Loaded X.509 cert 'Build time autogenerated kernel key: 6203e6adc37b712d3b220a26b38f3d31311d5966' +[ 0.126355] Key type ._fscrypt registered +[ 0.126736] Key type .fscrypt registered +[ 0.127109] Key type fscrypt-provisioning registered +[ 0.127657] Key type encrypted registered +[ 0.144629] IP-Config: Complete: +[ 0.144968] device=eth0, hwaddr=9e:72:c7:04:6b:80, ipaddr=192.168.128.9, mask=255.255.255.0, gw=192.168.128.1 +[ 0.146044] host=192.168.128.9, domain=, nis-domain=(none) +[ 0.146604] bootserver=255.255.255.255, rootserver=255.255.255.255, rootpath= +[ 0.148347] EXT4-fs (vda): mounted filesystem with ordered data mode. Opts: (null) +[ 0.149098] VFS: Mounted root (ext4 filesystem) on device 254:0. +[ 0.149761] devtmpfs: mounted +[ 0.150340] Freeing unused decrypted memory: 2040K +[ 0.151148] Freeing unused kernel image (initmem) memory: 1408K +[ 0.156621] Write protecting the kernel read-only data: 14336k +[ 0.158657] Freeing unused kernel image (text/rodata gap) memory: 2044K +[ 0.159490] Freeing unused kernel image (rodata/data gap) memory: 188K +[ 0.160150] Run /init.sh as init process +462:C 15 May 2021 21:13:01.903 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo +462:C 15 May 2021 21:13:01.904 # Redis version=6.2.3, bits=64, commit=00000000, modified=0, pid=462, just started +462:C 15 May 2021 21:13:01.905 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf +462:M 15 May 2021 21:13:01.907 * Increased maximum number of open files to 10032 (it was originally set to 1024). +462:M 15 May 2021 21:13:01.909 * monotonic clock: POSIX clock_gettime + _._ + _.-``__ ''-._ + _.-`` `. `_. ''-._ Redis 6.2.3 (00000000/0) 64 bit + .-`` .-```. ```\/ _.,_ ''-._ + ( ' , .-` | `, ) Running in standalone mode + |`-._`-...-` __...-.``-._|'` _.-'| Port: 6379 + | `-._ `._ / _.-' | PID: 462 + `-._ `-._ `-./ _.-' _.-' + |`-._`-._ `-.__.-' _.-'_.-'| + | `-._`-._ _.-'_.-' | https://redis.io + `-._ `-._`-.__.-'_.-' _.-' + |`-._`-._ `-.__.-' _.-'_.-'| + | `-._`-._ _.-'_.-' | + `-._ `-._`-.__.-'_.-' _.-' + `-._ `-.__.-' _.-' + `-._ _.-' + `-.__.-' + +462:M 15 May 2021 21:13:01.922 # Server initialized +462:M 15 May 2021 21:13:01.923 * Ready to accept connections +#+end_src + +We can do a quick test with the following: +#+begin_src sh +; sudo docker run -it --rm redis redis-cli -h 192.168.128.9 +192.168.128.9:6379> get foo +(nil) +192.168.128.9:6379> set foo 1 +OK +192.168.128.9:6379> get foo +"1" +192.168.128.9:6379> +#+end_src -- cgit 1.4.1 From b905cb7ed382d48faa9ddaac362f7be42f2a4aaf Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Tue, 18 May 2021 19:44:16 -0700 Subject: css: add a scroll bar if the content overflows --- users/fcuny/notes/static/css/custom.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/users/fcuny/notes/static/css/custom.css b/users/fcuny/notes/static/css/custom.css index f363bee..18c9c41 100644 --- a/users/fcuny/notes/static/css/custom.css +++ b/users/fcuny/notes/static/css/custom.css @@ -51,7 +51,7 @@ pre { margin: 0; font-size: 16px; font-family: 'Source Code Pro', monospace; - /* overflow: scroll; */ + overflow-x: auto; } .tags { -- cgit 1.4.1 From 3eee13b803a586e2943d246da545b8e9a7c0bdc5 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Wed, 19 May 2021 19:09:38 -0700 Subject: blog: update to containerd article Fix boot options --- users/fcuny/notes/content/notes/containerd-to-firecracker.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/users/fcuny/notes/content/notes/containerd-to-firecracker.org b/users/fcuny/notes/content/notes/containerd-to-firecracker.org index bce21d8..fd41b1d 100644 --- a/users/fcuny/notes/content/notes/containerd-to-firecracker.org +++ b/users/fcuny/notes/content/notes/containerd-to-firecracker.org @@ -268,7 +268,7 @@ fcCfg := firecracker.Config{ LogLevel: "debug", SocketPath: firecrackerSock, KernelImagePath: linuxKernel, - KernelArgs: "console=ttyS0 reboot=k panic=1 pci=off init=/init.sh random.trust_cpu=on", + KernelArgs: "console=ttyS0 reboot=k panic=1 acpi=off pci=off i8042.noaux i8042.nomux i8042.nopnp i8042.dumbkbd init=/init.sh random.trust_cpu=on", Drives: devices, MachineCfg: models.MachineConfiguration{ VcpuCount: firecracker.Int64(1), -- cgit 1.4.1 From b2295d7610d5471e5ba78fffac98199c3e631c3e Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Sun, 20 Jun 2021 13:12:56 -0700 Subject: fly: add configuration for fly.io --- users/fcuny/notes/fly.toml | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 users/fcuny/notes/fly.toml diff --git a/users/fcuny/notes/fly.toml b/users/fcuny/notes/fly.toml new file mode 100644 index 0000000..46468c1 --- /dev/null +++ b/users/fcuny/notes/fly.toml @@ -0,0 +1,40 @@ +# fly.toml file generated for fcunynet on 2021-06-20T10:01:50-07:00 + +app = "fcunynet" + +kill_signal = "SIGINT" +kill_timeout = 5 + +[build] + builtin = "hugo-static" + +[env] + +[experimental] + allowed_public_ports = [] + auto_rollback = true + +[[services]] + http_checks = [] + internal_port = 8080 + protocol = "tcp" + script_checks = [] + + [services.concurrency] + hard_limit = 25 + soft_limit = 20 + type = "connections" + + [[services.ports]] + handlers = ["http"] + port = 80 + + [[services.ports]] + handlers = ["tls", "http"] + port = 443 + + [[services.tcp_checks]] + grace_period = "1s" + interval = "15s" + restart_limit = 6 + timeout = "2s" -- cgit 1.4.1 From 1f2a49d1bf86f530600136d8b98b158b9d33051b Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Sun, 20 Jun 2021 13:13:18 -0700 Subject: hugo: don't enable git info The docker image used by fly.io to deploy a static website with hugo does not come with git, which prevents us to use the option `enableGitInfo`. This is not critical for now, so let's disable it so we can deploy. --- users/fcuny/notes/config.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/users/fcuny/notes/config.toml b/users/fcuny/notes/config.toml index 6100ba5..532ff03 100644 --- a/users/fcuny/notes/config.toml +++ b/users/fcuny/notes/config.toml @@ -2,7 +2,7 @@ baseURL = "http://fcuny.net/" languageCode = "en-us" title = "Franck's rambling" publishDir = "docs" -enableGitInfo = true +enableGitInfo = false [params] homeText = "A collection of notes" -- cgit 1.4.1 From a64655117936d3d527a4edd0f944f1fa5ee177e5 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Sun, 20 Jun 2021 13:14:12 -0700 Subject: github: deploy to fly.io instead of GH pages --- users/fcuny/notes/.github/workflows/gh-pages.yml | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/users/fcuny/notes/.github/workflows/gh-pages.yml b/users/fcuny/notes/.github/workflows/gh-pages.yml index 70e9ca8..bf3398a 100644 --- a/users/fcuny/notes/.github/workflows/gh-pages.yml +++ b/users/fcuny/notes/.github/workflows/gh-pages.yml @@ -7,24 +7,12 @@ on: jobs: deploy: - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - with: - submodules: true # Fetch Hugo themes (true OR recursive) - fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod - - name: Setup Hugo - uses: peaceiris/actions-hugo@v2 - with: - hugo-version: 'latest' - # extended: true - - - name: Build - run: hugo --minify - - - name: Deploy - uses: peaceiris/actions-gh-pages@v3 + uses: superfly/flyctl-actions@master + env: + FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./docs + args: "deploy" -- cgit 1.4.1 From c5636a88ad86126db35bdedde1819e07563f75df Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Mon, 19 Jul 2021 18:58:53 -0700 Subject: hugo: TLS by default --- users/fcuny/notes/config.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/users/fcuny/notes/config.toml b/users/fcuny/notes/config.toml index 532ff03..b3a150a 100644 --- a/users/fcuny/notes/config.toml +++ b/users/fcuny/notes/config.toml @@ -1,4 +1,4 @@ -baseURL = "http://fcuny.net/" +baseURL = "https://fcuny.net/" languageCode = "en-us" title = "Franck's rambling" publishDir = "docs" -- cgit 1.4.1 From 43a4a17882f0a4aa4bc75fca78387e52df01a602 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Thu, 5 Aug 2021 11:29:27 -0700 Subject: build: add Dockerfile The Dockerfile used by fly is relying on an older version of hugo ([1]). We can use a newer version and provide our own setup, and configure with the flags we want (e.g. promote to HTTS automatically). [1] https://github.com/superfly/flyctl/blob/3eb204909fbecd5fd2b1ba4517cdbce2abd9f74a/internal/build/imgsrc/builtins/defaultbuiltins.go#L89 --- users/fcuny/notes/Dockerfile | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 users/fcuny/notes/Dockerfile diff --git a/users/fcuny/notes/Dockerfile b/users/fcuny/notes/Dockerfile new file mode 100644 index 0000000..5e2b55a --- /dev/null +++ b/users/fcuny/notes/Dockerfile @@ -0,0 +1,7 @@ +FROM klakegg/hugo:0.83.1-ext-alpine-onbuild AS hugo + +FROM pierrezemb/gostatic + +COPY --from=hugo /target /srv/http/ + +CMD ["-port", "8080" , "-https-promote"] -- cgit 1.4.1 From 96cf0f396e470011df2c8c102d37f925ee75b83a Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Thu, 5 Aug 2021 11:42:21 -0700 Subject: build: add a Makefile Add a Makefile to take care of most common operations (build, deploy, etc). --- users/fcuny/notes/Makefile | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 users/fcuny/notes/Makefile diff --git a/users/fcuny/notes/Makefile b/users/fcuny/notes/Makefile new file mode 100644 index 0000000..0276958 --- /dev/null +++ b/users/fcuny/notes/Makefile @@ -0,0 +1,29 @@ +DOCKER := DOCKER_BUILDKIT=1 docker +DOCKER_BUILD_ARGS := +DOCKER_IMAGE := fcuny/fcuny.net +DOCKER_IMAGE_REF := $(shell git rev-parse HEAD) +DOCKERFILE := Dockerfile +PROJECT_DIR := $(realpath $(CURDIR)) + +.PHONY: server deploy docker-build docker-run + +server: + @echo "Running hugo server ..." + hugo server + +deploy: + @echo "Deploying to fly ..." + flyctl deploy \ + --build-arg IMAGE_REF=$(DOCKER_IMAGE_REF) + +docker-build: + @echo "Building Docker image ..." + $(DOCKER) build $(DOCKER_BUILD_ARGS) \ + --tag "${DOCKER_IMAGE}:${DOCKER_IMAGE_REF}" \ + --build-arg IMAGE_REF=$(DOCKER_IMAGE_REF) \ + --file "$(DOCKERFILE)" \ + "$(PROJECT_DIR)" + +docker-run: docker-build + @echo "Running Docker image ..." + $(DOCKER) run -ti --rm -p 8080:8080 $(DOCKER_IMAGE) -- cgit 1.4.1 From 032168ac56f0a88e409e094411cac00a9da6c4ef Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Thu, 5 Aug 2021 11:42:49 -0700 Subject: hugo: enable git information again Now that we're using a more recent version of the Docker image for hugo that comes with git, we can enable again git information. --- users/fcuny/notes/config.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/users/fcuny/notes/config.toml b/users/fcuny/notes/config.toml index b3a150a..d600506 100644 --- a/users/fcuny/notes/config.toml +++ b/users/fcuny/notes/config.toml @@ -2,7 +2,7 @@ baseURL = "https://fcuny.net/" languageCode = "en-us" title = "Franck's rambling" publishDir = "docs" -enableGitInfo = false +enableGitInfo = true [params] homeText = "A collection of notes" -- cgit 1.4.1 From cf2733ce2dbd2bc8217a2a12f3237b293d50140e Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Thu, 5 Aug 2021 11:52:50 -0700 Subject: blog: add humans.txt See humanstxt.org for more information. --- users/fcuny/notes/layouts/partials/head.html | 1 + users/fcuny/notes/static/humans.txt | 10 ++++++++++ 2 files changed, 11 insertions(+) create mode 100644 users/fcuny/notes/static/humans.txt diff --git a/users/fcuny/notes/layouts/partials/head.html b/users/fcuny/notes/layouts/partials/head.html index f41eb04..39ef8aa 100644 --- a/users/fcuny/notes/layouts/partials/head.html +++ b/users/fcuny/notes/layouts/partials/head.html @@ -7,6 +7,7 @@ {{ $css := "/css/custom.css" }} + diff --git a/users/fcuny/notes/static/humans.txt b/users/fcuny/notes/static/humans.txt new file mode 100644 index 0000000..d2c9d47 --- /dev/null +++ b/users/fcuny/notes/static/humans.txt @@ -0,0 +1,10 @@ +/* TEAM */ +Author: Franck Cuny +Contact: franck [at] fcuny.net +Twitter: @franckcuny +Location: Berkeley, CA + +/* SITE */ +CA: Let's Encrypt +Host: Fly.io +Serving: Linux, Go -- cgit 1.4.1 From d2c6009601af43f8502fc10902540e1e9b3ba428 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Thu, 5 Aug 2021 11:55:40 -0700 Subject: blog: add SSH public keys --- users/fcuny/notes/layouts/index.html | 1 + users/fcuny/notes/static/ssh.pub.sig | 1 + 2 files changed, 2 insertions(+) create mode 100644 users/fcuny/notes/static/ssh.pub.sig diff --git a/users/fcuny/notes/layouts/index.html b/users/fcuny/notes/layouts/index.html index f7581ff..100a77f 100644 --- a/users/fcuny/notes/layouts/index.html +++ b/users/fcuny/notes/layouts/index.html @@ -7,6 +7,7 @@
  • Email: franck@fcuny.net
  • GitHub: @fcuny
  • Twitter: @franckcuny
  • +
  • Keys: SSH public keys

I'm currently working as a Site Reliability Engineer at Twitter, on the Compute team.

diff --git a/users/fcuny/notes/static/ssh.pub.sig b/users/fcuny/notes/static/ssh.pub.sig new file mode 100644 index 0000000..808d3ad --- /dev/null +++ b/users/fcuny/notes/static/ssh.pub.sig @@ -0,0 +1 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC1rWKrdSHxlAZnRv1F5jUsHgXSNmr1KzllWEn+JqA7p3zxmSEPBbfIUGxSzkFIQrSbKizJLdH6hGA8DcIm+e+ldQ2RYOdiYBxIkPm+aHB6dw7QGNbnSSdkr9gKThy65j0YOOcmuDExjqxfq6O/8AVstmPH36sUXEIks5F/+WiF+5ehzoJVFqClB1di6w1lml86d0ShrUacgM/ieFPe1vKrzW8ZOM+LaUoGWBTLla1y6UkIqnb7OinmgPu6QAzF6GA7tYJMoHkyV7Axzc2j1/VxVIrUrfY4b0k8lGAzi2GfByq+fXEHzePbaqi8Cy8Trn9eN/ls1WBMUQfSChQi3tM2Vx2BuiOpx/QkXsdgqwe7bTCijcQS7GoREL1qd8tR9sWWd4WMPUiC9kmzvyja5F39xHPgm0A5MtYY7GvQaUPbtBc6g8YuFLLnkqFVEKHSLFiGYP5jIDNvMd5rSSsBUrepCIzWdpprwnKxAjebw5Cyl5p/0MY2zppQRW7AZXehQa7Bv+OClbutEjBa+ioeUxBhezu2rB61XSenTbbUVB5DncD8ceD5AbL9aFz/Bcw6q0kAOGmR1G1MOLgxVHlqcnI5x0E1K2WMKWgQb+1BMek1p5+l3xWNDF4URhLqLupnP5CMrK9ifBOe/76zqyMVrA/mc6tNC58KHhME1IynC1zaLw== franck@fcuny.net -- cgit 1.4.1 From defacba9d2a79616a9173f0abb88f4f2d5626e0b Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Thu, 5 Aug 2021 12:00:07 -0700 Subject: blog: update description --- users/fcuny/notes/layouts/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/users/fcuny/notes/layouts/index.html b/users/fcuny/notes/layouts/index.html index 100a77f..1b63249 100644 --- a/users/fcuny/notes/layouts/index.html +++ b/users/fcuny/notes/layouts/index.html @@ -10,6 +10,6 @@
  • Keys: SSH public keys
  • -

    I'm currently working as a Site Reliability Engineer at Twitter, on the Compute team.

    +

    I'm currently working as an Engineer at Twitter, on the Compute team.

    {{ end }} -- cgit 1.4.1 From 9d0b3a718545c035ac359ddb8a2f2668c477e59d Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Thu, 5 Aug 2021 12:53:13 -0700 Subject: css: bigger font and highlight colors Increase the font size and change some of the colors used for highlighting code. --- users/fcuny/notes/layouts/partials/head.html | 2 ++ users/fcuny/notes/static/css/custom.css | 22 ++++++++++++++++------ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/users/fcuny/notes/layouts/partials/head.html b/users/fcuny/notes/layouts/partials/head.html index 39ef8aa..7de4fd4 100644 --- a/users/fcuny/notes/layouts/partials/head.html +++ b/users/fcuny/notes/layouts/partials/head.html @@ -9,6 +9,8 @@ + + diff --git a/users/fcuny/notes/static/css/custom.css b/users/fcuny/notes/static/css/custom.css index 18c9c41..4173138 100644 --- a/users/fcuny/notes/static/css/custom.css +++ b/users/fcuny/notes/static/css/custom.css @@ -4,9 +4,9 @@ *, *:before, *:after { box-sizing: border-box; } body { - background-color: #ffffff; - line-height: 1.5rem; - font-size: 16px; + background-color: #fffff8; + line-height: 1.8rem; + font-size: 1.3em; font-family: "Roboto Slab", sans-serif; color: #000; padding: 2rem; @@ -43,11 +43,21 @@ span.published, span.updated { } code.verbatim { - background-color: #eeeeee; + background-color: #fffff8; +} + +.highlight pre { + background-color: #fffff8 !important; +} + +.highlight { + padding: 5px; + border-radius: 5px; + border: 1px solid #eee; } pre { - padding: 1rem 2rem; + padding: 0.3rem 0.3rem; margin: 0; font-size: 16px; font-family: 'Source Code Pro', monospace; @@ -55,7 +65,7 @@ pre { } .tags { - background-color: #eeeeee; + /* background-color: #eeeeee; */ border-radius:8px; padding:0 .5rem; font-size: 90%; -- cgit 1.4.1 From cf3ffa7b6e1033f64b12e348fc2565050aebcf1f Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Sat, 14 Aug 2021 13:08:02 -0700 Subject: css: reduce the size of the font --- users/fcuny/notes/static/css/custom.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/users/fcuny/notes/static/css/custom.css b/users/fcuny/notes/static/css/custom.css index 4173138..08a7c0a 100644 --- a/users/fcuny/notes/static/css/custom.css +++ b/users/fcuny/notes/static/css/custom.css @@ -6,7 +6,7 @@ body { background-color: #fffff8; line-height: 1.8rem; - font-size: 1.3em; + font-size: 1em; font-family: "Roboto Slab", sans-serif; color: #000; padding: 2rem; -- cgit 1.4.1 From 0c268da997574c049008ae0bea4008d0b646d266 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Sat, 14 Aug 2021 13:08:25 -0700 Subject: blog: add link for containerd-to-vm code --- users/fcuny/notes/content/notes/containerd-to-firecracker.org | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/users/fcuny/notes/content/notes/containerd-to-firecracker.org b/users/fcuny/notes/content/notes/containerd-to-firecracker.org index fd41b1d..8ff268c 100644 --- a/users/fcuny/notes/content/notes/containerd-to-firecracker.org +++ b/users/fcuny/notes/content/notes/containerd-to-firecracker.org @@ -14,7 +14,7 @@ They describe the process as follow: 6. Create a TAP device and configure it 7. Hand it off to Firecracker and boot that thing -That's pretty detailed, and I'm curious how difficult it is to implement this. I've been meaning to look into Firecracker for a while and into containers'd API, so this is a perfect opportunity to get started. +That's pretty detailed, and I'm curious how difficult it is to implement this. I've been meaning to look into Firecracker for a while and into containers'd API, so this is a perfect opportunity to get started. The code is available [[https://git.fcuny.net/fcuny/containerd-to-vm][here]]. * #1 Pull a container from a registry with =containerd= =containerd= has a pretty [[https://pkg.go.dev/github.com/containerd/containerd][detailed documentation]]. From the main page we can see the following example to create a client. -- cgit 1.4.1 From 8d75c9be38a2318d77cca0b066360fbb317abfae Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Sat, 14 Aug 2021 13:17:23 -0700 Subject: blog: replace github with git.fcuny.net --- users/fcuny/notes/layouts/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/users/fcuny/notes/layouts/index.html b/users/fcuny/notes/layouts/index.html index 1b63249..b2f232d 100644 --- a/users/fcuny/notes/layouts/index.html +++ b/users/fcuny/notes/layouts/index.html @@ -5,7 +5,7 @@ -- cgit 1.4.1 From 0d5e2812c71d9b76885a04c0167d0b59e4e4827d Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Sun, 15 Aug 2021 13:42:51 -0700 Subject: CSS: use a class for the menu We will have more use of the tag `nav` and we will need different styles for it. --- users/fcuny/notes/layouts/partials/header.html | 2 +- users/fcuny/notes/static/css/custom.css | 13 ++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/users/fcuny/notes/layouts/partials/header.html b/users/fcuny/notes/layouts/partials/header.html index f918823..508e259 100644 --- a/users/fcuny/notes/layouts/partials/header.html +++ b/users/fcuny/notes/layouts/partials/header.html @@ -1,5 +1,5 @@
    -
    +{{ if .Params.toc }} +
    + Table of Contents + {{ .TableOfContents }} +
    +{{ end }} + {{ .Content }} {{ end }} diff --git a/users/fcuny/notes/static/css/custom.css b/users/fcuny/notes/static/css/custom.css index b4e37bc..8f776d7 100644 --- a/users/fcuny/notes/static/css/custom.css +++ b/users/fcuny/notes/static/css/custom.css @@ -140,3 +140,15 @@ nav.menu a.menu-active:hover { nav.menu a.menu-active { color: #007d9c; } + +.toc { + border: 1px solid black; + padding: 1rem; + margin-top: 1rem; + color: black; +} + +.toc a, +.toc a.visited { + color: black; +} -- cgit 1.4.1 From b53339e215524a1e000a28fe569f3fb2f0071aa7 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Sun, 15 Aug 2021 15:14:02 -0700 Subject: CSS: make the content more readable The Roboto Slab font is hard to read (at least for me). Switch to Droid Sans and make the text a bit smaller. Change the background of the page to white (again), and change the background color for the code snippets. Add text decoration for headlines (similar to org-bullet). --- users/fcuny/notes/static/css/custom.css | 39 ++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/users/fcuny/notes/static/css/custom.css b/users/fcuny/notes/static/css/custom.css index 8f776d7..1113707 100644 --- a/users/fcuny/notes/static/css/custom.css +++ b/users/fcuny/notes/static/css/custom.css @@ -1,13 +1,12 @@ -@import url('https://fonts.googleapis.com/css2?family=Roboto+Slab&display=swap'); @import url('https://fonts.googleapis.com/css2?family=Source+Code+Pro&display=swap'); *, *:before, *:after { box-sizing: border-box; } body { - background-color: #fffff8; - line-height: 1.8rem; - font-size: 1em; - font-family: "Roboto Slab", sans-serif; + background-color: #ffffff; + line-height: 1.4rem; + font-size: 16px; + font-family: 'Droid Sans', sans-serif; color: #000; padding: 2rem; } @@ -25,14 +24,22 @@ a { p { color: #1a1a19; } -h1 { - line-height: normal; +h1:before { + content: '◉'; +} +h2:before { + content: '○'; +} +h3:before { + content: '✸'; +} +h4:before { + content: '✿'; } h2 { margin-top: 2rem; - line-height: 1.4em; - border-bottom-color: #000000; + border-bottom-color: #eee; border-bottom-style: solid; border-bottom-width: 0.8px; } @@ -43,15 +50,18 @@ span.published, span.updated { } code.verbatim { - background-color: #fffff8; + background-color: #f7f7f7; + white-space: nowrap; + border-radius: 2px; + font-size: 90%; + padding: 2px 2px; } .highlight pre { - background-color: #fffff8 !important; + background-color: #f7f7f7 !important; } .highlight { - padding: 5px; border-radius: 5px; border: 1px solid #eee; } @@ -59,13 +69,12 @@ code.verbatim { pre { padding: 0.3rem 0.3rem; margin: 0; - font-size: 16px; + font-size: 14px; font-family: 'Source Code Pro', monospace; overflow-x: auto; } .tags { - /* background-color: #eeeeee; */ border-radius:8px; padding:0 .5rem; font-size: 90%; @@ -82,6 +91,7 @@ pre { table { border: 1px solid black; + border-radius: 2px; width: 100%; border-spacing: 15px; border-collapse: collapse; @@ -109,7 +119,6 @@ nav.menu { justify-content: flex-end; padding-left: 1em; margin: 0 auto; - line-height: 0.2rem; } nav.menu ul { -- cgit 1.4.1 From 9aa8a776a5370aeb1c5250321371949c509ae64f Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Sun, 15 Aug 2021 15:15:40 -0700 Subject: layout: don't use header tag in list --- users/fcuny/notes/layouts/partials/postlist.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/users/fcuny/notes/layouts/partials/postlist.html b/users/fcuny/notes/layouts/partials/postlist.html index 28fd9b2..e124482 100644 --- a/users/fcuny/notes/layouts/partials/postlist.html +++ b/users/fcuny/notes/layouts/partials/postlist.html @@ -4,7 +4,7 @@ {{ range .Pages.ByDate }}
  • {{ end }} -- cgit 1.4.1 From dbe7d1c3fb2767ebd23279bdf1b3ab55977357c9 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Sun, 15 Aug 2021 15:16:01 -0700 Subject: blog: add tags to firecracker notes --- users/fcuny/notes/content/notes/containerd-to-firecracker.org | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/users/fcuny/notes/content/notes/containerd-to-firecracker.org b/users/fcuny/notes/content/notes/containerd-to-firecracker.org index 8ff268c..554771d 100644 --- a/users/fcuny/notes/content/notes/containerd-to-firecracker.org +++ b/users/fcuny/notes/content/notes/containerd-to-firecracker.org @@ -1,6 +1,7 @@ #+TITLE: containerd to firecracker #+DATE: <2021-05-15 Sat> -#+TAGS[]: linux, firecracker, containerd +#+TAGS[]: linux firecracker containerd go +#+toc: t fly.io had an [[https://fly.io/blog/docker-without-docker/][interesting article]] about how they use docker images to create VMs for =firecracker=. -- cgit 1.4.1 From e40a38decc190e0dfbaa94b6c661a3f0afef9e1c Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Sun, 15 Aug 2021 15:16:13 -0700 Subject: blog: working with go - initial content This note captures things that are useful when working with go for me. --- .../fcuny/notes/content/notes/working-with-go.org | 264 +++++++++++++++++++++ 1 file changed, 264 insertions(+) create mode 100644 users/fcuny/notes/content/notes/working-with-go.org diff --git a/users/fcuny/notes/content/notes/working-with-go.org b/users/fcuny/notes/content/notes/working-with-go.org new file mode 100644 index 0000000..e00f635 --- /dev/null +++ b/users/fcuny/notes/content/notes/working-with-go.org @@ -0,0 +1,264 @@ +#+TITLE: Working with Go +#+DATE: <2021-08-05 Thu> +#+TAGS[]: go emacs +#+toc: t + +/This document assumes go version >= 1.16/. + +* Go Modules +[[https://blog.golang.org/using-go-modules][Go modules]] have been added in 2019 with Go 1.11. A number of changes were introduced with [[https://blog.golang.org/go116-module-changes][Go 1.16]]. This document is a reference for me so that I can find answers to things I keep forgetting. +** Creating a new module +To create a new module, run =go mod init golang.fcuny.net/m=. This will create two files: =go.mod= and =go.sum=. + +In the =go.mod= file you'll find: +- the module import path (prefixed with =module=) +- the list of dependencies (within =require=) +- the version of go to use for the module +** Versioning +To bump the version of a module: +#+begin_src sh +$ git tag v1.2.3 +$ git push --tags +#+end_src + +Then as a user: +#+begin_src sh +$ go get -d golang.fcuny.net/m@v1.2.3 +#+end_src +** Updating dependencies +To update the dependencies, run =go mod tidy= +** Editing a module +If you need to modify a module, you can check out the module in your workspace (=git clone =). + +Edit the =go.mod= file to add +#+begin_src go +replace => +#+end_src + +Then modify the code of the module and the next time you compile the project, the cloned module will be used. + +This is particularly useful when trying to debug an issue with an external module. +** Vendor-ing modules +It's still possible to vendor modules by running =go mod vendor=. This can be useful in the case of a CI setup that does not have access to internet. +** Proxy +As of version 1.13, the variable =GOPROXY= defaults to =https://proxy.golang.org,direct= (see [[https://github.com/golang/go/blob/c95464f0ea3f87232b1f3937d1b37da6f335f336/src/cmd/go/internal/cfg/cfg.go#L269][here]]). As a result, when running something like =go get golang.org/x/tools/gopls@latest=, the request goes through the proxy. + +There's a number of ways to control the behavior, they are documented [[https://golang.org/ref/mod#private-modules][here]]. + +There's a few interesting things that can be done when using the proxy. There's a few special URLs (better documentation [[https://golang.org/ref/mod#goproxy-protocol][here]]): +| path | description | +|-----------------------+------------------------------------------------------------------------------------------| +| $mod/@v/list | Returns the list of known versions - there's one version per line and it's in plain text | +| $mod/@v/$version.info | Returns metadata about a version in JSON format | +| $mod/@v/$version.mod | Returns the =go.mod= file for that version | + +For example, looking at the most recent versions for =gopls=: +#+begin_src sh +; curl -s -L https://proxy.golang.org/golang.org/x/tools/gopls/@v/list|sort -r|head +v0.7.1-pre.2 +v0.7.1-pre.1 +v0.7.1 +v0.7.0-pre.3 +v0.7.0-pre.2 +v0.7.0-pre.1 +v0.7.0 +v0.6.9-pre.1 +v0.6.9 +v0.6.8-pre.1 +#+end_src + +Let's check the details for the most recent version +#+begin_src sh +; curl -s -L https://proxy.golang.org/golang.org/x/tools/gopls/@v/list|sort -r|head +v0.7.1-pre.2 +v0.7.1-pre.1 +v0.7.1 +v0.7.0-pre.3 +v0.7.0-pre.2 +v0.7.0-pre.1 +v0.7.0 +v0.6.9-pre.1 +v0.6.9 +v0.6.8-pre.1 +#+end_src + +And let's look at the content of the =go.mod= for that version too: +#+begin_src sh +; curl -s -L https://proxy.golang.org/golang.org/x/tools/gopls/@v/v0.7.1-pre.2.mod +module golang.org/x/tools/gopls + +go 1.17 + +require ( + github.com/BurntSushi/toml v0.3.1 // indirect + github.com/google/go-cmp v0.5.5 + github.com/google/safehtml v0.0.2 // indirect + github.com/jba/templatecheck v0.6.0 + github.com/sanity-io/litter v1.5.0 + github.com/sergi/go-diff v1.1.0 + golang.org/x/mod v0.4.2 + golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect + golang.org/x/sys v0.0.0-20210510120138-977fb7262007 + golang.org/x/text v0.3.6 // indirect + golang.org/x/tools v0.1.6-0.20210802203754-9b21a8868e16 + golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect + honnef.co/go/tools v0.2.0 + mvdan.cc/gofumpt v0.1.1 + mvdan.cc/xurls/v2 v2.2.0 +) +#+end_src +* Tooling +** LSP +=gopls= is the default implementation of the language server protocol maintained by the Go team. To install the latest version, run =go install golang.org/x/tools/gopls@latest= +** =staticcheck= +[[https://staticcheck.io/][=staticcheck=]] is a great tool to run against your code to find issues. To install the latest version, run =go install honnef.co/go/tools/cmd/staticcheck@latest=. +* Emacs integration +** =go-mode= +[[https://github.com/dominikh/go-mode.el][This is the mode]] to install to get syntax highlighting (mostly). +** Integration with LSP +Emacs has a pretty good integration with LSP. +https://geeksocket.in/posts/emacs-lsp-go/ +*** =lsp-mode= +[[src:https://github.com/emacs-lsp/lsp-mode][This is the main mode to install]]. It provides the integration with LSP. + +I've configured the mode like this: +#+begin_src elisp +(use-package lsp-mode + :ensure t + :commands (lsp lsp-deferred) + :diminish lsp-mode + :hook ((go-mode . lsp-deferred) + (lsp-mode . (lambda() (let ((lsp-keymap-prefix "C-c l")) + (lsp-enable-which-key-integration))))) + :config + (define-key lsp-mode-map (kbd "C-c l") lsp-command-map) + (lsp-register-custom-settings + '(("gopls.completeUnimported" t t) + ("gopls.staticcheck" t t))) + :bind + (("C-c l i" . lsp-ui-imenu)) + :custom + (lsp-session-file (expand-file-name "lsp-session-v1" fcuny/path-emacs-var)) + (lsp-enable-snippet nil) + (lsp-signature-doc-lines 5) + (lsp-modeline-diagnostic-scope :workspace) + (lsp-completion-provider :capf) + (lsp-completion-enable t) + (lsp-enable-indentation t) + (lsp-eldoc-render-all t) + (lsp-prefer-flymake nil)) +#+end_src + ++ =C-c l= brings a menu via [[https://github.com/abo-abo/hydra][hydra]] ++ By default it seems that =staticcheck= is not used, so I force it with the =lsp-register-custom-settings= ++ I prefer [[https://www.flycheck.org/en/latest/][flycheck]] +*** =lsp-ui= +This is mostly for UI tweaks. I use the following configuration +#+begin_src elisp +(use-package lsp-ui + :ensure t + :hook (lsp-mode . lsp-ui-mode) + :commands lsp-ui-mode + :custom + (lsp-ui-doc-delay 0.4) + (lsp-ui-doc-enable t) + (lsp-ui-doc-position 'top) + (lsp-ui-doc-include-signature t) + (lsp-ui-peek-enable t) + (lsp-ui-sideline-enable t) + (lsp-ui-imenu-enable t) + (lsp-ui-flycheck-enable t)) + +#+end_src +*** =lsp-ivy= +I use ivy for completion, [[https://github.com/emacs-lsp/lsp-ivy][it provides]] completion based on the current workspace. This is my configuration: +#+begin_src elisp +(use-package lsp-ivy + :ensure t + :commands lsp-ivy-workspace-symbol) +#+end_src +*** =lsp-treemacs= +[[https://github.com/emacs-lsp/lsp-treemacs][It provides]] some nice improvement regarding the UI. This is my configuration: +#+begin_src elisp +(use-package lsp-treemacs + :ensure t + :config + (lsp-treemacs-sync-mode 1)) + +#+end_src +* Profiling +** pprof +[[https://github.com/google/pprof][pprof]] is a tool to visualize performance data. Let's start with the following test: +#+begin_src go +package main + +import ( + "strings" + "testing" +) + +func BenchmarkStringJoin(b *testing.B) { + input := []string{"a", "b"} + for i := 0; i <= b.N; i++ { + r := strings.Join(input, " ") + if r != "a b" { + b.Errorf("want a b got %s", r) + } + } +} +#+end_src + +Let's run a benchmark with ~go test . -bench=. -cpuprofile cpu_profile.out~: +#+begin_src go +goos: linux +goarch: amd64 +pkg: golang.fcuny.net/m +cpu: Intel(R) Core(TM) i3-1005G1 CPU @ 1.20GHz +BenchmarkStringJoin-4 41833486 26.85 ns/op 3 B/op 1 allocs/op +PASS +ok golang.fcuny.net/m 1.327s +#+end_src + +And let's take a look at the profile with =go tool pprof cpu_profile.out= +#+begin_src sh +File: m.test +Type: cpu +Time: Aug 15, 2021 at 3:01pm (PDT) +Duration: 1.31s, Total samples = 1.17s (89.61%) +Entering interactive mode (type "help" for commands, "o" for options) +(pprof) top +Showing nodes accounting for 1100ms, 94.02% of 1170ms total +Showing top 10 nodes out of 41 + flat flat% sum% cum cum% + 240ms 20.51% 20.51% 240ms 20.51% runtime.memmove + 220ms 18.80% 39.32% 320ms 27.35% runtime.mallocgc + 130ms 11.11% 50.43% 450ms 38.46% runtime.makeslice + 110ms 9.40% 59.83% 1150ms 98.29% golang.fcuny.net/m.BenchmarkStringJoin + 110ms 9.40% 69.23% 580ms 49.57% strings.(*Builder).grow (inline) + 110ms 9.40% 78.63% 1040ms 88.89% strings.Join + 70ms 5.98% 84.62% 300ms 25.64% strings.(*Builder).WriteString + 50ms 4.27% 88.89% 630ms 53.85% strings.(*Builder).Grow (inline) + 40ms 3.42% 92.31% 40ms 3.42% runtime.nextFreeFast (inline) + 20ms 1.71% 94.02% 20ms 1.71% runtime.getMCache (inline) +#+end_src + +We can get a breakdown of the data for our module: +#+begin_src sh +(pprof) list golang.fcuny.net +Total: 1.17s +ROUTINE ======================== golang.fcuny.net/m.BenchmarkStringJoin in /home/fcuny/workspace/gobench/app_test.go + 110ms 1.15s (flat, cum) 98.29% of Total + . . 5: "testing" + . . 6:) + . . 7: + . . 8:func BenchmarkStringJoin(b *testing.B) { + . . 9: b.ReportAllocs() + 10ms 10ms 10: input := []string{"a", "b"} + . . 11: for i := 0; i <= b.N; i++ { + 20ms 1.06s 12: r := strings.Join(input, " ") + 80ms 80ms 13: if r != "a b" { + . . 14: b.Errorf("want a b got %s", r) + . . 15: } + . . 16: } + . . 17:} +#+end_src -- cgit 1.4.1 From 88062d392762c3539bbe4cc8ad02e86d0d78e291 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Sun, 15 Aug 2021 15:22:47 -0700 Subject: build: tag the repo after a deploy If the deployment is successful, tag the repository with the version being deployed on fly.io. Don't deploy unless the repository is clean (this is done with the target `worktree-clean`). --- users/fcuny/notes/Makefile | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/users/fcuny/notes/Makefile b/users/fcuny/notes/Makefile index 0276958..1275e1b 100644 --- a/users/fcuny/notes/Makefile +++ b/users/fcuny/notes/Makefile @@ -5,16 +5,21 @@ DOCKER_IMAGE_REF := $(shell git rev-parse HEAD) DOCKERFILE := Dockerfile PROJECT_DIR := $(realpath $(CURDIR)) -.PHONY: server deploy docker-build docker-run +.PHONY: server deploy docker-build docker-run worktree-clean server: @echo "Running hugo server ..." hugo server -deploy: +worktree-clean: + git diff --exit-code + git diff --staged --exit-code + +deploy: worktree-clean docker-build @echo "Deploying to fly ..." flyctl deploy \ --build-arg IMAGE_REF=$(DOCKER_IMAGE_REF) + git tag --message $(shell flyctl info -j |jq '.App | "\(.Name)/v\(.Version)"') $(shell flyctl info -j |jq '.App | "\(.Name)/v\(.Version)"') docker-build: @echo "Building Docker image ..." -- cgit 1.4.1 From dbacc543ca0a397a73a520d6c92fd08a7cf3b6aa Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Mon, 23 Aug 2021 09:15:40 -0700 Subject: CSS: makes the menu more readable Move the title to the left and the menu items to the right. --- users/fcuny/notes/layouts/partials/header.html | 14 ++++---- users/fcuny/notes/static/css/custom.css | 48 ++++++++++++++++++-------- 2 files changed, 39 insertions(+), 23 deletions(-) diff --git a/users/fcuny/notes/layouts/partials/header.html b/users/fcuny/notes/layouts/partials/header.html index 508e259..76e23a2 100644 --- a/users/fcuny/notes/layouts/partials/header.html +++ b/users/fcuny/notes/layouts/partials/header.html @@ -1,15 +1,13 @@
    diff --git a/users/fcuny/notes/static/css/custom.css b/users/fcuny/notes/static/css/custom.css index 1113707..3475d1f 100644 --- a/users/fcuny/notes/static/css/custom.css +++ b/users/fcuny/notes/static/css/custom.css @@ -115,39 +115,57 @@ blockquote { nav.menu { display: flex; - flex: 2 0px; - justify-content: flex-end; - padding-left: 1em; + justify-content: flex-start; + flex-direction: row; + flex-wrap: nowrap; margin: 0 auto; + font-size: 18px; } -nav.menu ul { +.navigation { display: flex; - list-style-type: none; - margin: 0 + justify-content: flex-end; + flex-direction: row; + flex-wrap: nowrap; + box-sizing: border-box; + flex-basis: auto; + flex-grow: 1; + align-items: center; +} + +.menu-item { + box-sizing: border-box; + font-weight: 400; + padding-right: 8px; } nav.menu a { - padding: 1em; display: inline-block; color: black; - font-family: sans-serif; text-decoration: none; transition: all 75ms ease-in; } -nav.menu a:hover { - color: #fff; - background-color: #007d9c; +.navigation a:hover { + text-decoration: underline; + text-decoration-thickness: 4px; + text-underline-offset:.3rem; + color: #007d9c; } -nav.menu a.menu-active:hover { - color: #fff; - background-color: #007d9c; +a.menu-active:hover { + text-decoration: underline; + text-underline-offset:.3rem; + color: #007d9c; + font-weight: 700; } -nav.menu a.menu-active { +a.menu-active { + text-decoration: underline; + text-underline-offset:.3rem; + text-decoration-thickness: 4px; color: #007d9c; + font-weight: 700; } .toc { -- cgit 1.4.1 From 6bc0b64bfb37d59abdfaf9f8b34525353d6794f8 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Mon, 23 Aug 2021 09:31:20 -0700 Subject: CSS: rename the class for the tags --- users/fcuny/notes/static/css/custom.css | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/users/fcuny/notes/static/css/custom.css b/users/fcuny/notes/static/css/custom.css index 3475d1f..95f5feb 100644 --- a/users/fcuny/notes/static/css/custom.css +++ b/users/fcuny/notes/static/css/custom.css @@ -74,10 +74,12 @@ pre { overflow-x: auto; } -.tags { - border-radius:8px; - padding:0 .5rem; - font-size: 90%; +.meta_tags { + border-radius: 8px; + padding: 0 .5rem; + font-size: 80%; + border: 2px solid #eee; + background-color: #eee } .meta_tags a:link, -- cgit 1.4.1 From 9af499ffbf985cd6bea50d079063e6f01cba139a Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Mon, 23 Aug 2021 09:32:05 -0700 Subject: CSS: use decoration on headers only for articles Add an element "article" to the single page template, and change the CSS to use the decoration for headers only for that kind of content. Having decoration for all headers is distracting, it's more suited for actual content. We also don't need decoration for h1, only smaller headers. --- users/fcuny/notes/layouts/_default/single.html | 8 ++++++-- users/fcuny/notes/static/css/custom.css | 8 ++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/users/fcuny/notes/layouts/_default/single.html b/users/fcuny/notes/layouts/_default/single.html index b4c5443..165c568 100644 --- a/users/fcuny/notes/layouts/_default/single.html +++ b/users/fcuny/notes/layouts/_default/single.html @@ -1,5 +1,7 @@ {{ define "main" }} +
    +

    {{ .Title }}

    @@ -18,9 +20,9 @@ {{ if .Params.tags }}
    {{ if eq (len .Params.tags) 1 }} - in tag + tag: {{ else }} - in tags + tags: {{ end }} {{ range $idx, $tag := .Params.tags }} {{ $tag }} @@ -38,4 +40,6 @@ {{ .Content }} +
    + {{ end }} diff --git a/users/fcuny/notes/static/css/custom.css b/users/fcuny/notes/static/css/custom.css index 95f5feb..2d7a36e 100644 --- a/users/fcuny/notes/static/css/custom.css +++ b/users/fcuny/notes/static/css/custom.css @@ -24,16 +24,16 @@ a { p { color: #1a1a19; } -h1:before { +article.article h2:before { content: '◉'; } -h2:before { +article.article h3:before { content: '○'; } -h3:before { +article.article h4:before { content: '✸'; } -h4:before { +article.article h5:before { content: '✿'; } -- cgit 1.4.1 From b61ae35e777222379ba4870d2019cf00186e3b07 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Mon, 23 Aug 2021 09:33:39 -0700 Subject: index: drop the main header It's ugly. --- users/fcuny/notes/layouts/index.html | 2 -- 1 file changed, 2 deletions(-) diff --git a/users/fcuny/notes/layouts/index.html b/users/fcuny/notes/layouts/index.html index b2f232d..f34b21f 100644 --- a/users/fcuny/notes/layouts/index.html +++ b/users/fcuny/notes/layouts/index.html @@ -1,8 +1,6 @@ {{ define "main" }}
    -

    Franck Cuny

    -
    • Email: franck@fcuny.net
    • Git: @fcuny
    • -- cgit 1.4.1 From b305a5348f854b1301696e5537dcee285dd3fa1a Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Mon, 23 Aug 2021 09:33:55 -0700 Subject: CSS: various small fixes --- users/fcuny/notes/static/css/custom.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/users/fcuny/notes/static/css/custom.css b/users/fcuny/notes/static/css/custom.css index 2d7a36e..ba9dddf 100644 --- a/users/fcuny/notes/static/css/custom.css +++ b/users/fcuny/notes/static/css/custom.css @@ -4,7 +4,7 @@ body { background-color: #ffffff; - line-height: 1.4rem; + line-height: 22px; font-size: 16px; font-family: 'Droid Sans', sans-serif; color: #000; @@ -52,7 +52,7 @@ span.published, span.updated { code.verbatim { background-color: #f7f7f7; white-space: nowrap; - border-radius: 2px; + border-radius: 8px; font-size: 90%; padding: 2px 2px; } -- cgit 1.4.1 From df62c0ad444e25b58b1e3bf49450113e2fde3edb Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Tue, 24 Aug 2021 19:24:52 -0700 Subject: build: sleep before tagging The last deploy was tagged v13, while the version deployed was 14. It's possible that running `fly info` too quickly after a deploy returns the incorrect version. Adding a `sleep 5` before running the command for git tag. --- users/fcuny/notes/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/users/fcuny/notes/Makefile b/users/fcuny/notes/Makefile index 1275e1b..d602b52 100644 --- a/users/fcuny/notes/Makefile +++ b/users/fcuny/notes/Makefile @@ -19,6 +19,7 @@ deploy: worktree-clean docker-build @echo "Deploying to fly ..." flyctl deploy \ --build-arg IMAGE_REF=$(DOCKER_IMAGE_REF) + @sleep 5 git tag --message $(shell flyctl info -j |jq '.App | "\(.Name)/v\(.Version)"') $(shell flyctl info -j |jq '.App | "\(.Name)/v\(.Version)"') docker-build: -- cgit 1.4.1 From 23a9bbb216ae9618431e96e6b13d567f79383002 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Tue, 24 Aug 2021 19:21:23 -0700 Subject: blog: sort pages in reverse order --- users/fcuny/notes/layouts/partials/postlist.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/users/fcuny/notes/layouts/partials/postlist.html b/users/fcuny/notes/layouts/partials/postlist.html index e124482..3d5cf04 100644 --- a/users/fcuny/notes/layouts/partials/postlist.html +++ b/users/fcuny/notes/layouts/partials/postlist.html @@ -1,7 +1,7 @@ {{ range .GroupByDate "2006" }}

      {{ .Key }}

        - {{ range .Pages.ByDate }} + {{ range .Pages.ByDate.Reverse }}
      • {{ .Title }} -- cgit 1.4.1 From 03aeb03f76975f06301d8c225d63390c72023165 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Tue, 24 Aug 2021 19:21:46 -0700 Subject: blog: git-link and sourcegraph --- .../content/blog/git-link-and-sourcegraph.org | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 users/fcuny/notes/content/blog/git-link-and-sourcegraph.org diff --git a/users/fcuny/notes/content/blog/git-link-and-sourcegraph.org b/users/fcuny/notes/content/blog/git-link-and-sourcegraph.org new file mode 100644 index 0000000..034f8da --- /dev/null +++ b/users/fcuny/notes/content/blog/git-link-and-sourcegraph.org @@ -0,0 +1,40 @@ +#+TITLE: emacs' git-link and sourcegraph +#+TAGS[]: emacs git +#+DATE: <2021-08-24 Tue> + +I use [[https://sourcegraph.com/][sourcegraph]] for searching code, and I sometimes need to share a link to the source code I'm looking at in a buffer. For this, the package [[https://github.com/sshaw/git-link][=git-link=]] is great. + +To integrate sourcegraph and =git-link=, the [[https://github.com/sshaw/git-link#sourcegraph][documentation]] recommends adding a remote entry named =sourcegraph= in the repository, like this: + +#+begin_src sh +git remote add sourcegraph https://sourcegraph.com/github.com/sshaw/copy-as-format +#+end_src + +The next time you run =M-x git-link= in a buffer, it will use the URL associated with that remote. That's works great, except that now you need to add this for every repository. Instead, for my usage, I came up with the following solution: + +#+begin_src elisp +(use-package git-link + :ensure t + :config + (defun fcuny/get-sg-remote-from-hostname (hostname) + (format "sourcegraph.<$domain>.<$tld>/%s" hostname)) + + (defun fcuny/git-link-work-sourcegraph (hostname dirname filename branch commit start end) + (let ((sg-base-url (fcuny/get-sg-remote-from-hostname hostname))) + (git-link-sourcegraph sg-base-url dirname filename branch commit start end))) + + (defun fcuny/git-link-commit-work-sourcegraph (hostname dirname commit) + (let ((sg-base-url (fcuny/get-sg-remote-from-hostname hostname))) + (git-link-commit-sourcegraph sg-base-url dirname commit))) + + (add-to-list 'git-link-remote-alist '("twitter" fcuny/git-link-work-sourcegraph)) + (add-to-list 'git-link-commit-remote-alist '("twitter" fcuny/git-link-commit-work-sourcegraph)) + + (setq git-link-open-in-browser 't)) +#+end_src + +We use different domains to host various git repositories at work (e.g. =git.$work=, =gitfoo.$work=, etc). Each of them map to a different URI for sourcegraph (e.g. =sourcegraph.$work/gitfoo=). + +=git-link-commit-remote-alist= is an [[https://www.gnu.org/software/emacs/manual/html_node/elisp/Association-Lists.html][association list]] that takes a regular expression and a function. The custom function receives the hostname for the remote repository, which is then used to generate the URI for our sourcegraph instance. I then call =git-link-sourcegraph= replacing the hostname with the URI for sourcegraph. + +Now I can run =M-x git-link= in any repository where the host for the origin git repository matches =twitter= without having to setup the custom remote first. -- cgit 1.4.1 From d44c293403fcd276f4b14e4b5d8e679c2c0c8c23 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Thu, 26 Aug 2021 17:35:15 -0700 Subject: static: add profile picture --- users/fcuny/notes/static/profile.jpg | Bin 0 -> 895450 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 users/fcuny/notes/static/profile.jpg diff --git a/users/fcuny/notes/static/profile.jpg b/users/fcuny/notes/static/profile.jpg new file mode 100644 index 0000000..5417f13 Binary files /dev/null and b/users/fcuny/notes/static/profile.jpg differ -- cgit 1.4.1 From e628fad646c6c23e568e0e29945e75bb058921d2 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Thu, 9 Sep 2021 17:28:29 -0700 Subject: blog: update elisp for git/sourcegraph --- .../fcuny/notes/content/blog/git-link-and-sourcegraph.org | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/users/fcuny/notes/content/blog/git-link-and-sourcegraph.org b/users/fcuny/notes/content/blog/git-link-and-sourcegraph.org index 034f8da..3ab5f4b 100644 --- a/users/fcuny/notes/content/blog/git-link-and-sourcegraph.org +++ b/users/fcuny/notes/content/blog/git-link-and-sourcegraph.org @@ -15,13 +15,22 @@ The next time you run =M-x git-link= in a buffer, it will use the URL associated #+begin_src elisp (use-package git-link :ensure t + :after magit + :bind (("C-c g l" . git-link) + ("C-c g a" . git-link-commit)) :config (defun fcuny/get-sg-remote-from-hostname (hostname) (format "sourcegraph.<$domain>.<$tld>/%s" hostname)) - (defun fcuny/git-link-work-sourcegraph (hostname dirname filename branch commit start end) - (let ((sg-base-url (fcuny/get-sg-remote-from-hostname hostname))) - (git-link-sourcegraph sg-base-url dirname filename branch commit start end))) + (defun fcuny/git-link-work-sourcegraph (hostname dirname filename _branch commit start end) + ;;; For a given repository, build the proper link for sourcegraph. + ;;; Use the default branch of the repository instead of the + ;;; current one (we might be on a feature branch that is not + ;;; available on the remote). + (require 'magit-branch) + (let ((sg-base-url (fcuny/get-sg-remote-from-hostname hostname)) + (main-branch (magit-main-branch))) + (git-link-sourcegraph sg-base-url dirname filename main-branch commit start end))) (defun fcuny/git-link-commit-work-sourcegraph (hostname dirname commit) (let ((sg-base-url (fcuny/get-sg-remote-from-hostname hostname))) -- cgit 1.4.1 From e87223deb3b5508d49b5712215a92d1fa50c362b Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Thu, 9 Sep 2021 18:03:00 -0700 Subject: build: get the proper version for tagging We were evaluating the version of the app when the rule was evaluated, while we need to get the version after we run `flyctl deploy`. Since we're tagging a release, let's also annotate the tag. Remove the `--build-arg` argument to `flyct deploy` since it's being ignored (same with `docker build`). Closes #1. --- users/fcuny/notes/Makefile | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/users/fcuny/notes/Makefile b/users/fcuny/notes/Makefile index d602b52..b117922 100644 --- a/users/fcuny/notes/Makefile +++ b/users/fcuny/notes/Makefile @@ -17,16 +17,13 @@ worktree-clean: deploy: worktree-clean docker-build @echo "Deploying to fly ..." - flyctl deploy \ - --build-arg IMAGE_REF=$(DOCKER_IMAGE_REF) - @sleep 5 - git tag --message $(shell flyctl info -j |jq '.App | "\(.Name)/v\(.Version)"') $(shell flyctl info -j |jq '.App | "\(.Name)/v\(.Version)"') + flyctl deploy + @git tag -a --message $$(flyctl info -j |jq -r '.App | "fcuny.net/v\(.Version)"') $$(flyctl info -j |jq -r '.App | "fcuny.net/v\(.Version)"') docker-build: @echo "Building Docker image ..." $(DOCKER) build $(DOCKER_BUILD_ARGS) \ --tag "${DOCKER_IMAGE}:${DOCKER_IMAGE_REF}" \ - --build-arg IMAGE_REF=$(DOCKER_IMAGE_REF) \ --file "$(DOCKERFILE)" \ "$(PROJECT_DIR)" -- cgit 1.4.1 From c8197f48e8ec6e38f4ae54b34bcda1511ad02a3b Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Sat, 2 Oct 2021 07:40:56 -0700 Subject: static: add ssh-key from desktop --- users/fcuny/notes/static/ssh.pub.sig | 1 + 1 file changed, 1 insertion(+) diff --git a/users/fcuny/notes/static/ssh.pub.sig b/users/fcuny/notes/static/ssh.pub.sig index 808d3ad..88f4f3e 100644 --- a/users/fcuny/notes/static/ssh.pub.sig +++ b/users/fcuny/notes/static/ssh.pub.sig @@ -1 +1,2 @@ ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC1rWKrdSHxlAZnRv1F5jUsHgXSNmr1KzllWEn+JqA7p3zxmSEPBbfIUGxSzkFIQrSbKizJLdH6hGA8DcIm+e+ldQ2RYOdiYBxIkPm+aHB6dw7QGNbnSSdkr9gKThy65j0YOOcmuDExjqxfq6O/8AVstmPH36sUXEIks5F/+WiF+5ehzoJVFqClB1di6w1lml86d0ShrUacgM/ieFPe1vKrzW8ZOM+LaUoGWBTLla1y6UkIqnb7OinmgPu6QAzF6GA7tYJMoHkyV7Axzc2j1/VxVIrUrfY4b0k8lGAzi2GfByq+fXEHzePbaqi8Cy8Trn9eN/ls1WBMUQfSChQi3tM2Vx2BuiOpx/QkXsdgqwe7bTCijcQS7GoREL1qd8tR9sWWd4WMPUiC9kmzvyja5F39xHPgm0A5MtYY7GvQaUPbtBc6g8YuFLLnkqFVEKHSLFiGYP5jIDNvMd5rSSsBUrepCIzWdpprwnKxAjebw5Cyl5p/0MY2zppQRW7AZXehQa7Bv+OClbutEjBa+ioeUxBhezu2rB61XSenTbbUVB5DncD8ceD5AbL9aFz/Bcw6q0kAOGmR1G1MOLgxVHlqcnI5x0E1K2WMKWgQb+1BMek1p5+l3xWNDF4URhLqLupnP5CMrK9ifBOe/76zqyMVrA/mc6tNC58KHhME1IynC1zaLw== franck@fcuny.net +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDg2P92WEDsI2mn2QEk1uSg9MKbj7JgE3pEfI6bWo5fbcnUbVGGZxafK0e7rnSfgWHHyhVeH8W4fQfPb+Iyt/9GLkKEq3aqShVEq+h2FXu7iqdrsANp27UnanuHuL2MzQY041jAiqrmJUBzCedJfnmlydMoo0TdK2Hxzu3cLjaI0VhEySo8c/NKuUB6uIdfuA8dkvIdP2O0owpLoKOGDdsDTedhGiN+mQgB+Z2+oYM4XOVmcMY6/f2cxXRBCkktcy9s451NqhjmsVB/L1n1GjJlOk+mQ6wGjR7KN7bgJtBC2sE/WuiZL+pmOlu3dF9vLyWw7iPHj7YvLlK6gztBHZT2v694Thqd9yb/ESOFfyrcujZu0qkRhjPYOz7VJC9F9PmTIVW6Zk4kknQzh9pmKWJiDNZEaQ88cXGn+HBj9aZ/fj3h6TyowtLZkXWebNcUHFMquuTMpJigFq+bSvus5Ad+v5L185CNa/9o3P1TNAft4YF3IR0WfJ08aNcFBYkiOXivpuTmbMzuRKUQ/5dhAlOuqTSzDDEFa6Q9MMo2oorNcZhjrfKq/T7gKXKqG8DuWNGKsM1ZduduCjunuWJw9SjUHVEwW2NtNHcvRWP19HFy/+T5rWDBEUUSYQba34xnvMRa9NZLeqGC+korXCUjxjQEM8aFpCUmqdwY6QBgpyGAbw== franck@fcuny.net -- cgit 1.4.1 From ac7a611ff004d6f4e2535f3a172bf0bf0734a376 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Thu, 21 Oct 2021 19:32:40 -0700 Subject: build: be explicit about the image to use If we're not explicit, we're trying to run the image tagged `latest', but there's no image with that tag. --- users/fcuny/notes/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/users/fcuny/notes/Makefile b/users/fcuny/notes/Makefile index b117922..81174c9 100644 --- a/users/fcuny/notes/Makefile +++ b/users/fcuny/notes/Makefile @@ -29,4 +29,4 @@ docker-build: docker-run: docker-build @echo "Running Docker image ..." - $(DOCKER) run -ti --rm -p 8080:8080 $(DOCKER_IMAGE) + $(DOCKER) run -ti --rm -p 8080:8080 "${DOCKER_IMAGE}:${DOCKER_IMAGE_REF}" -- cgit 1.4.1 From 702f59c82aea50d0b30a5b6dd0e2e973381b518d Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Fri, 12 Nov 2021 17:17:02 -0800 Subject: static: add my resume --- users/fcuny/notes/static/resume.pdf | Bin 0 -> 46184 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 users/fcuny/notes/static/resume.pdf diff --git a/users/fcuny/notes/static/resume.pdf b/users/fcuny/notes/static/resume.pdf new file mode 100644 index 0000000..80b9b79 Binary files /dev/null and b/users/fcuny/notes/static/resume.pdf differ -- cgit 1.4.1 From a7883a933e13dda438a4518d35647d1f86b101b8 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Fri, 12 Nov 2021 17:25:27 -0800 Subject: resume: update --- users/fcuny/notes/static/resume.pdf | Bin 46184 -> 46970 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/users/fcuny/notes/static/resume.pdf b/users/fcuny/notes/static/resume.pdf index 80b9b79..123b9ef 100644 Binary files a/users/fcuny/notes/static/resume.pdf and b/users/fcuny/notes/static/resume.pdf differ -- cgit 1.4.1 From 1808a79bc6096d68a5e693f5241f898d534be7e1 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Mon, 6 Dec 2021 17:50:39 -0800 Subject: CSS: drop custom fonts + colors --- users/fcuny/notes/static/css/custom.css | 41 ++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/users/fcuny/notes/static/css/custom.css b/users/fcuny/notes/static/css/custom.css index ba9dddf..4502d70 100644 --- a/users/fcuny/notes/static/css/custom.css +++ b/users/fcuny/notes/static/css/custom.css @@ -1,12 +1,10 @@ -@import url('https://fonts.googleapis.com/css2?family=Source+Code+Pro&display=swap'); - *, *:before, *:after { box-sizing: border-box; } body { - background-color: #ffffff; + background-color: #fbf1c7; line-height: 22px; - font-size: 16px; - font-family: 'Droid Sans', sans-serif; + font-size: 1.1em; + font-family: monospace; color: #000; padding: 2rem; } @@ -19,10 +17,10 @@ body { a { text-decoration: underline; text-underline-offset:.3rem; - color: #007d9c; + color: #8f3f71; } -p { color: #1a1a19; } +p { color: #282828; } article.article h2:before { content: '◉'; @@ -37,9 +35,13 @@ article.article h5:before { content: '✿'; } +h1, h2, h3, h4, h5 { + font-family: sans-serif; +} + h2 { - margin-top: 2rem; - border-bottom-color: #eee; + margin-top: 1.3rem; + border-bottom-color: #282828; border-bottom-style: solid; border-bottom-width: 0.8px; } @@ -53,7 +55,6 @@ code.verbatim { background-color: #f7f7f7; white-space: nowrap; border-radius: 8px; - font-size: 90%; padding: 2px 2px; } @@ -69,9 +70,10 @@ code.verbatim { pre { padding: 0.3rem 0.3rem; margin: 0; - font-size: 14px; - font-family: 'Source Code Pro', monospace; + font-size: 1.1em; + font-family: monospace; overflow-x: auto; + border: 1px solid #000; } .meta_tags { @@ -98,8 +100,8 @@ table { border-spacing: 15px; border-collapse: collapse; letter-spacing: 1px; - font-family: 'Source Code Pro', monospace; - font-size: 16px; + font-family: monospace; + font-size: 1.1em; text-align: left; } @@ -111,8 +113,9 @@ thead { blockquote { background-color: #fffff0; border-radius: 5px; - padding-left: 5px; font-style: italic; + border-left: 6px solid lightgray; + margin-left: 10.875px; } nav.menu { @@ -121,7 +124,7 @@ nav.menu { flex-direction: row; flex-wrap: nowrap; margin: 0 auto; - font-size: 18px; + font-size: 1.2em; } .navigation { @@ -152,13 +155,13 @@ nav.menu a { text-decoration: underline; text-decoration-thickness: 4px; text-underline-offset:.3rem; - color: #007d9c; + color: #076678; } a.menu-active:hover { text-decoration: underline; text-underline-offset:.3rem; - color: #007d9c; + color: #076678; font-weight: 700; } @@ -166,7 +169,7 @@ a.menu-active { text-decoration: underline; text-underline-offset:.3rem; text-decoration-thickness: 4px; - color: #007d9c; + color: #076678; font-weight: 700; } -- cgit 1.4.1 From 5031442c1f1107cb1477fa8721aa1d9ff5a8aa4d Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Mon, 6 Dec 2021 17:58:36 -0800 Subject: build: push git branches / tags after deploy After a successful deploy, push all the branches / tags to origin. --- users/fcuny/notes/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/users/fcuny/notes/Makefile b/users/fcuny/notes/Makefile index 81174c9..5414dde 100644 --- a/users/fcuny/notes/Makefile +++ b/users/fcuny/notes/Makefile @@ -19,6 +19,8 @@ deploy: worktree-clean docker-build @echo "Deploying to fly ..." flyctl deploy @git tag -a --message $$(flyctl info -j |jq -r '.App | "fcuny.net/v\(.Version)"') $$(flyctl info -j |jq -r '.App | "fcuny.net/v\(.Version)"') + @git push origin --all + @git push origin --tags docker-build: @echo "Building Docker image ..." -- cgit 1.4.1 From b0385745b32b9853e31c1ccf53cf860e374f1ad0 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Mon, 20 Dec 2021 14:30:49 -0800 Subject: menu: simplify the menu --- users/fcuny/notes/config.toml | 7 +++++++ users/fcuny/notes/layouts/partials/header.html | 12 +++--------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/users/fcuny/notes/config.toml b/users/fcuny/notes/config.toml index d600506..c126d16 100644 --- a/users/fcuny/notes/config.toml +++ b/users/fcuny/notes/config.toml @@ -16,6 +16,13 @@ enableGitInfo = true tags = "/tags/:slug/" [menu] + [[menu.main]] + identifier = "home" + name = "home" + title = "fcuny.net" + url = "/" + weight = 130 + [[menu.main]] identifier = "articles" name = "blog" diff --git a/users/fcuny/notes/layouts/partials/header.html b/users/fcuny/notes/layouts/partials/header.html index 76e23a2..9118a50 100644 --- a/users/fcuny/notes/layouts/partials/header.html +++ b/users/fcuny/notes/layouts/partials/header.html @@ -1,13 +1,7 @@
        -- cgit 1.4.1 From 57f443be096465eb3db6aff56ec32b88530cf6dd Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Mon, 20 Dec 2021 14:31:06 -0800 Subject: index: re-organize the main page Add a "contact" header with my information under it. --- users/fcuny/notes/layouts/index.html | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/users/fcuny/notes/layouts/index.html b/users/fcuny/notes/layouts/index.html index f34b21f..9e15e77 100644 --- a/users/fcuny/notes/layouts/index.html +++ b/users/fcuny/notes/layouts/index.html @@ -1,13 +1,15 @@ {{ define "main" }} -
        - - -

        I'm currently working as an Engineer at Twitter, on the Compute team.

        +

        {{ .Site.Home.Title }}

        + +

        I'm currently working as an Engineer at Twitter, on the Compute team.

        + +

        Contact

        + {{ end }} -- cgit 1.4.1 From 7c9718da9ccd8974ca0824e8d4148374b5ebfcb1 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Mon, 20 Dec 2021 14:31:30 -0800 Subject: css: improve the color and fonts --- users/fcuny/notes/static/css/custom.css | 163 +++++++++----------------------- 1 file changed, 47 insertions(+), 116 deletions(-) diff --git a/users/fcuny/notes/static/css/custom.css b/users/fcuny/notes/static/css/custom.css index 4502d70..cbeac27 100644 --- a/users/fcuny/notes/static/css/custom.css +++ b/users/fcuny/notes/static/css/custom.css @@ -1,77 +1,56 @@ -*, *:before, *:after { box-sizing: border-box; } - body { + font-family: sans-serif; + line-height:1.6; + font-size:18px; + color: #000111; background-color: #fbf1c7; - line-height: 22px; - font-size: 1.1em; - font-family: monospace; - color: #000; - padding: 2rem; -} - -.main { - margin: auto; - max-width: 60rem; -} - -a { - text-decoration: underline; - text-underline-offset:.3rem; - color: #8f3f71; + margin:1em auto; + max-width:750px; + padding:0 0.55em; } -p { color: #282828; } +h1, h2, h3, h4, h5 {line-height:1.2} +h1{margin-top:1em;margin-bottom:0.34em} +h2{margin-top:1.25em;margin-bottom:0.41em} +h3{margin-top:1.5em;margin-bottom:0.5em} -article.article h2:before { - content: '◉'; -} -article.article h3:before { - content: '○'; -} -article.article h4:before { - content: '✸'; -} -article.article h5:before { - content: '✿'; +hr{ + color:#000111; + background-color:#000111; + border:none; + height:2px } -h1, h2, h3, h4, h5 { - font-family: sans-serif; -} - -h2 { - margin-top: 1.3rem; - border-bottom-color: #282828; - border-bottom-style: solid; - border-bottom-width: 0.8px; -} +a {color: #494d7e;} +a:visited {color: #494d7e;} span.published, span.updated { display: center; font-style: oblique; } +code { + font-family: monospace; + font-size: 80%; +} code.verbatim { - background-color: #f7f7f7; - white-space: nowrap; - border-radius: 8px; - padding: 2px 2px; + background-color: #fffff8; } -.highlight pre { - background-color: #f7f7f7 !important; +:not(pre) code{ + padding-left:0.1em; + padding-right:0.1em; + border-radius:2px; } -.highlight { - border-radius: 5px; - border: 1px solid #eee; -} +.highlight pre {background-color: #fffff8 !important} +.highlight {border-radius: 5px} pre { + font-family: monospace; padding: 0.3rem 0.3rem; margin: 0; - font-size: 1.1em; - font-family: monospace; + line-height: 1.1; overflow-x: auto; border: 1px solid #000; } @@ -81,40 +60,40 @@ pre { padding: 0 .5rem; font-size: 80%; border: 2px solid #eee; - background-color: #eee + background-color: #eee; } -.meta_tags a:link, -.meta_tags a:visited { +.meta_tags a:link, .meta_tags a:visited { text-decoration: none; } .meta_date { font-style: italic; + font-size: 80%; } table { - border: 1px solid black; - border-radius: 2px; width: 100%; - border-spacing: 15px; - border-collapse: collapse; - letter-spacing: 1px; - font-family: monospace; - font-size: 1.1em; - text-align: left; + border-spacing: 0px; + outline: none; +} + +th, td{ + padding-left:0.7em; + padding-right:0.7em; + padding-top:0.4em; + padding-bottom:0.4em; } -thead { - background-color: #E0EBF5; - font-weight: bold; +table, th, td { + border:1px solid black; } blockquote { - background-color: #fffff0; + background-color: #fffff8; border-radius: 5px; font-style: italic; - border-left: 6px solid lightgray; + border-left: 6px solid black; margin-left: 10.875px; } @@ -124,63 +103,15 @@ nav.menu { flex-direction: row; flex-wrap: nowrap; margin: 0 auto; - font-size: 1.2em; -} - -.navigation { - display: flex; - justify-content: flex-end; - flex-direction: row; - flex-wrap: nowrap; - box-sizing: border-box; - flex-basis: auto; - flex-grow: 1; - align-items: center; } .menu-item { - box-sizing: border-box; - font-weight: 400; padding-right: 8px; } -nav.menu a { - display: inline-block; - color: black; - text-decoration: none; - transition: all 75ms ease-in; -} - -.navigation a:hover { - text-decoration: underline; - text-decoration-thickness: 4px; - text-underline-offset:.3rem; - color: #076678; -} - -a.menu-active:hover { - text-decoration: underline; - text-underline-offset:.3rem; - color: #076678; - font-weight: 700; -} - -a.menu-active { - text-decoration: underline; - text-underline-offset:.3rem; - text-decoration-thickness: 4px; - color: #076678; - font-weight: 700; -} - .toc { border: 1px solid black; padding: 1rem; margin-top: 1rem; color: black; } - -.toc a, -.toc a.visited { - color: black; -} -- cgit 1.4.1 From 14fc76a6078cbb5334e49ee5edabf51a5072e39d Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Wed, 29 Dec 2021 09:11:14 -0800 Subject: RSS: fix the template Generate correctly the content of the RSS feed. I only want the blog articles, not the notes. --- users/fcuny/notes/layouts/index.atom.xml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/users/fcuny/notes/layouts/index.atom.xml b/users/fcuny/notes/layouts/index.atom.xml index 531e77c..1d73f9b 100644 --- a/users/fcuny/notes/layouts/index.atom.xml +++ b/users/fcuny/notes/layouts/index.atom.xml @@ -1,5 +1,5 @@ - Franck Cuny Website + {{ .Site.Title }} {{ .Permalink }}{{ with .Site.Author.name }} @@ -7,7 +7,8 @@ {{.}}{{ with $.Site.Author.email }} {{.}}{{end}} {{end}} - Hugo -- gohugo.io{{ range where (first 10 (where .Site.Pages "Section" "posts")) "Params.hidden" "ne" "true" }} + Hugo -- gohugo.io + {{ range where (first 10 (where .Site.Pages "Section" "blog")) "Params.hidden" "ne" "true" }} {{ `<![CDATA[` | safeHTML }}{{ .Title }}]]> @@ -18,5 +19,6 @@ {{- $fmt := "2006-01-02T15:04:05-07:00" }} {{ .Date.Format $fmt | safeHTML }} {{ ` - {{ end }} + + {{ end }} -- cgit 1.4.1 From fed6105d6f7a00983402cc6613be7b3b51217d91 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Wed, 29 Dec 2021 09:11:40 -0800 Subject: layout: add a link to the RSS feed in the menu Specify the weight so that the items in the menu are listed in the order I want. --- users/fcuny/notes/config.toml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/users/fcuny/notes/config.toml b/users/fcuny/notes/config.toml index c126d16..6a6f070 100644 --- a/users/fcuny/notes/config.toml +++ b/users/fcuny/notes/config.toml @@ -21,19 +21,28 @@ enableGitInfo = true name = "home" title = "fcuny.net" url = "/" - weight = 130 + weight = 100 [[menu.main]] identifier = "articles" name = "blog" title = "articles" url = "/blog/" + weight = 110 [[menu.main]] identifier = "notes" name = "notes" title = "notes" url = "/notes/" + weight = 120 + + [[menu.main]] + identifier = "RSS" + name = "RSS" + title = "RSS" + url = "/feed.xml" + weight = 130 [markup] [markup.tableOfContents] -- cgit 1.4.1 From 92629ba4a6a03ca8ea7a1f8bdbc1527ebf08a4cf Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Wed, 29 Dec 2021 09:19:46 -0800 Subject: config: add author information --- users/fcuny/notes/config.toml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/users/fcuny/notes/config.toml b/users/fcuny/notes/config.toml index 6a6f070..7162180 100644 --- a/users/fcuny/notes/config.toml +++ b/users/fcuny/notes/config.toml @@ -7,6 +7,10 @@ enableGitInfo = true [params] homeText = "A collection of notes" +[author] + name = "Franck Cuny" + email = "franck@fcuny.net" + [taxonomies] tag = "tags" -- cgit 1.4.1 From 81fcd3d385ad75f85741d3ab4946e4cba88bf1b7 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Wed, 29 Dec 2021 09:12:40 -0800 Subject: blog: article on how to use tailscale + traefik --- .../notes/content/blog/tailscale-docker-https.org | 121 +++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 users/fcuny/notes/content/blog/tailscale-docker-https.org diff --git a/users/fcuny/notes/content/blog/tailscale-docker-https.org b/users/fcuny/notes/content/blog/tailscale-docker-https.org new file mode 100644 index 0000000..14e4cf1 --- /dev/null +++ b/users/fcuny/notes/content/blog/tailscale-docker-https.org @@ -0,0 +1,121 @@ +#+TITLE: Tailscale, Docker and HTTPS +#+TAGS[]: docker tailscale traefik +#+DATE: <2021-12-29 Wed> + +I run a number of services in my home network. For the majority of these services, I don't want to make them available on the internet, I want to only be able to access them when I'm on my home network. However, sometimes I'm not at home and I still want to access them. So far I've been using plain [[https://www.wireguard.com/][wireguard]] to achieve this. While the initial configuration for wireguard is pretty simple, it starts to be a bit more cumbersome as I add more hosts/containers. It's also not easy to share keys with other folks if I want to give access to some of the machines or services. For that reason I decided to give a look at [[https://tailscale.com/][tailscale]]. + +There's already a lot of articles about tailscale and how to use and configure it. Their [[https://tailscale.com/kb/][documentation]] is also pretty good, so I won't cover the initial setup. + +As stated above, I want to access some of my services that are running as docker containers from anywhere. For web services, I want to use them through HTTPS, with a valid certificate, and without having to remember on which port the service it's listening. I also don't want to setup a PKI in my home lab for that (and I'm also not interested in configuring split DNS), and instead I prefer to use [[https://letsencrypt.org/][let's encrypt]] with a proper subdomain that is unique for each service. + +The [[https://tailscale.com/kb/1054/dns/][tailscale documentation]] has two suggestions for this: +- use their magicDNS feature / split DNS +- setup a subdomain on a public domain + +Since I already have a public domain that I use for my home network, I decided to go with the second option (I'm also uncertain how to achieve my goal using magicDNS without running tailscale inside the container). + +The public domain I'm using is managed through [[https://cloud.google.com/dns/docs/tutorials/create-domain-tutorial][Google Cloud Domain]]. I create a new record for the services I want to run (for example, ~dash~ for my instance of grafana), using the IP address from the tailscale node the service runs on (e.g. 100.83.51.12). + +For routing the traffic I use [[https://traefik.io/][traefik]]. The configuration for traefik looks like this: +#+begin_src yaml +global: + sendAnonymousUsage: false +providers: + docker: + exposedByDefault: false +entryPoints: + http: + address: ":80" + https: + address: ":443" +certificatesResolvers: + dash: + acme: + email: franck@fcuny.net + storage: acme.json + dnsChallenge: + provider: gcloud +#+end_src + +The important bit here is the ~certificatesResolvers~ part. I'll be using the [[https://doc.traefik.io/traefik/user-guides/docker-compose/acme-dns/][dnsChallenge]] instead of the [[https://doc.traefik.io/traefik/user-guides/docker-compose/acme-http/][httpChallenge]] to obtain the certificate from let's encrypt. For this to work, I need to specify the ~provider~ to be [[https://go-acme.github.io/lego/dns/gcloud/][gcloud]]. I'll also need a service account (see [[https://cloud.google.com/docs/authentication/production#providing_credentials_to_your_application][this doc]] to create it). I run ~traefik~ in a docker container, and the ~systemd~ unit file is below. The required bits for using the ~dnsChallenge~ with ~gcloud~ are: +- the environment variable ~GCP_SERVICE_ACCOUNT_FILE~: it contains the credentials so that ~traefik~ can update the DNS record for the challenge +- the environment variable ~GCP_PROJECT~: the name of the GCP project +- mounting the service account file inside the container (I store it on the host under ~/data/containers/traefik/config/sa.json~) + +#+begin_src systemd +[Unit] +Description=traefik proxy +Documentation=https://doc.traefik.io/traefik/ +After=docker.service +Requires=docker.service + +[Service] +Restart=on-failure +ExecStartPre=-/usr/bin/docker kill traefik +ExecStartPre=-/usr/bin/docker rm traefik +ExecStartPre=/usr/bin/docker pull traefik:latest + +ExecStart=/usr/bin/docker run \ + -p 80:80 \ + -p 9080:8080 \ + -p 443:443 \ + --name=traefik \ + -e GCE_SERVICE_ACCOUNT_FILE=/var/run/gcp-service-account.json \ + -e GCE_PROJECT= gcp-super-project \ + --volume=/data/containers/traefik/config/acme.json:/acme.json \ + --volume=/data/containers/traefik/config/traefik.yml:/etc/traefik/traefik.yml:ro \ + --volume=/data/containers/traefik/config/sa.json:/var/run/gcp-service-account.json \ + --volume=/var/run/docker.sock:/var/run/docker.sock:ro \ + traefik:latest +ExecStop=/usr/bin/docker stop traefik + +[Install] +WantedBy=multi-user.target +#+end_src + +As an example, I run [[https://grafana.com/][grafana]] on my home network to view metrics from the various containers / hosts. Let's pretend I use ~example.net~ as my domain. I want to be able to access ~grafana~ via https://dash.example.net. Here's the ~systemd~ unit configuration I use for this: + +#+begin_src systemd +[Unit] +Description=Grafana in a docker container +Documentation=https://grafana.com/docs/ +After=docker.service +Requires=docker.service + +[Service] +Restart=on-failure +RuntimeDirectory=grafana +ExecStartPre=-/usr/bin/docker kill grafana-server +ExecStartPre=-/usr/bin/docker rm grafana-server +ExecStartPre=-/usr/bin/docker pull grafana/grafana:latest + +ExecStart=/usr/bin/docker run \ + -p 3000:3000 \ + -e TZ='America/Los_Angeles' \ + --name grafana-server \ + -v /data/containers/grafana/etc/grafana:/etc/grafana \ + -v /data/containers/grafana/var/lib/grafana:/var/lib/grafana \ + -v /data/containers/grafana/var/log/grafana:/var/log/grafana \ + --user=grafana \ + --label traefik.enable=true \ + --label traefik.http.middlewares.grafana-https-redirect.redirectscheme.scheme=https \ + --label traefik.http.middlewares.grafana-https-redirect.redirectscheme.permanent=true \ + --label traefik.http.routers.grafana-http.rule=Host(`dash.example.net`) \ + --label traefik.http.routers.grafana-http.entrypoints=http \ + --label traefik.http.routers.grafana-http.service=grafana-svc \ + --label traefik.http.routers.grafana-http.middlewares=grafana-https-redirect \ + --label traefik.http.routers.grafana-https.rule=Host(`dash.example.net`) \ + --label traefik.http.routers.grafana-https.entrypoints=https \ + --label traefik.http.routers.grafana-https.tls=true \ + --label traefik.http.routers.grafana-https.tls.certresolver=dash \ + --label traefik.http.routers.grafana-https.service=grafana-svc \ + --label traefik.http.services.grafana-svc.loadbalancer.server.port=3000 \ + grafana/grafana:latest + +ExecStop=/usr/bin/docker stop unifi-controller + +[Install] +WantedBy=multi-user.target +#+end_src + +Now I can access my grafana instance via HTTPS (and http://dash.example.net would redirect to HTTPS) while my tailscale interface is up on the machine I'm using (e.g. my desktop or my phone). -- cgit 1.4.1 From 728595148afcc132b8138ca2f1a05f0da61e9867 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Wed, 29 Dec 2021 09:37:38 -0800 Subject: css: highlight links with a background color --- users/fcuny/notes/static/css/custom.css | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/users/fcuny/notes/static/css/custom.css b/users/fcuny/notes/static/css/custom.css index cbeac27..2e96fdc 100644 --- a/users/fcuny/notes/static/css/custom.css +++ b/users/fcuny/notes/static/css/custom.css @@ -21,8 +21,19 @@ hr{ height:2px } -a {color: #494d7e;} -a:visited {color: #494d7e;} +a { + color: #023; + background-color: #eee; +} +a:visited { + color: #345; + background: #eee; +} +a:hover { + color: #000; + text-decoration: none; + background:#ccf; +} span.published, span.updated { display: center; -- cgit 1.4.1 From d9385006236943eb3246b7564002b6332039b971 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Wed, 29 Dec 2021 14:18:58 -0800 Subject: css: adjust line height --- users/fcuny/notes/static/css/custom.css | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/users/fcuny/notes/static/css/custom.css b/users/fcuny/notes/static/css/custom.css index 2e96fdc..df75430 100644 --- a/users/fcuny/notes/static/css/custom.css +++ b/users/fcuny/notes/static/css/custom.css @@ -1,6 +1,5 @@ body { font-family: sans-serif; - line-height:1.6; font-size:18px; color: #000111; background-color: #fbf1c7; @@ -9,7 +8,6 @@ body { padding:0 0.55em; } -h1, h2, h3, h4, h5 {line-height:1.2} h1{margin-top:1em;margin-bottom:0.34em} h2{margin-top:1.25em;margin-bottom:0.41em} h3{margin-top:1.5em;margin-bottom:0.5em} @@ -47,7 +45,6 @@ code { code.verbatim { background-color: #fffff8; } - :not(pre) code{ padding-left:0.1em; padding-right:0.1em; @@ -61,7 +58,6 @@ pre { font-family: monospace; padding: 0.3rem 0.3rem; margin: 0; - line-height: 1.1; overflow-x: auto; border: 1px solid #000; } @@ -87,6 +83,7 @@ table { width: 100%; border-spacing: 0px; outline: none; + line-height: 0.9em; } th, td{ -- cgit 1.4.1 From 45ec71d71e8969197e88c076b1806546518a43a3 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Wed, 29 Dec 2021 14:19:11 -0800 Subject: css: change colors for some sections --- users/fcuny/notes/static/css/custom.css | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/users/fcuny/notes/static/css/custom.css b/users/fcuny/notes/static/css/custom.css index df75430..a38593d 100644 --- a/users/fcuny/notes/static/css/custom.css +++ b/users/fcuny/notes/static/css/custom.css @@ -92,17 +92,23 @@ th, td{ padding-top:0.4em; padding-bottom:0.4em; } - +thead { + background-color: #ebdbb2; +} table, th, td { border:1px solid black; } blockquote { - background-color: #fffff8; - border-radius: 5px; + background-color: #f2e5bc; font-style: italic; - border-left: 6px solid black; - margin-left: 10.875px; + border-left: 6px solid #7c6f64; + margin-left: 0px; + margin-right: 0px; + padding-left: 0.7em; + padding-right:0.7em; + padding-top:0.2em; + padding-bottom:0.2em; } nav.menu { @@ -119,7 +125,7 @@ nav.menu { .toc { border: 1px solid black; - padding: 1rem; - margin-top: 1rem; + padding: 1em; + margin-top: 1em; color: black; } -- cgit 1.4.1 From 8c920b80c757430a707609d65899e7d37b491ec4 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Wed, 29 Dec 2021 14:19:24 -0800 Subject: blog: notes about AMD and Intel CPUs --- .../content/notes/making-sense-intel-amd-cpus.org | 120 +++++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 users/fcuny/notes/content/notes/making-sense-intel-amd-cpus.org diff --git a/users/fcuny/notes/content/notes/making-sense-intel-amd-cpus.org b/users/fcuny/notes/content/notes/making-sense-intel-amd-cpus.org new file mode 100644 index 0000000..4b5541f --- /dev/null +++ b/users/fcuny/notes/content/notes/making-sense-intel-amd-cpus.org @@ -0,0 +1,120 @@ +#+TITLE: Making sense of Intel and AMD CPUs naming +#+DATE: <2021-12-29 Wed> +#+TAGS[]: amd intel cpu +#+toc: t + +* Intel +** Core +The line up for the core family is i3, i5, i7 and i9. As of December 2021, the current generation is Alder Lake (12th generation). + +The brand modifiers are: +- *i3*: laptops/low-end desktop +- *i5*: mainstream users +- *i7*: high-end users +- *i9*: enthusiast users + +How to read a SKU ? Let's use the [[https://ark.intel.com/content/www/us/en/ark/products/134594/intel-core-i712700k-processor-25m-cache-up-to-5-00-ghz.html][i7-12700K]] processor: +- *i7*: high end users +- *12*: 12th generation +- *700*: SKU digits, usually assigned in the order the processors are developed +- *K*: unlocked + +List of suffixes: +| suffix | meaning | +|--------+----------------------------------------| +| G.. | integrated graphics | +| E | embedded | +| F | require discrete graphic card | +| H | high performance for mobile | +| HK | high performance for mobile / unlocked | +| K | unlocked | +| S | special edition | +| T | power optimized lifestyle | +| U | mobile power efficient | +| Y | mobile low power | +| X/XE | unlocked, high end | + +#+begin_quote +*Unlocked,* what does that means ? +A processor with the *K* suffix is made with the an unlocked clock multiplier. When used with some specific chipset, it's possible to overclock the processor. +#+end_quote +*** Sockets/Chipsets +For the Alder Lake generation, the supported socket is the [[https://en.wikipedia.org/wiki/LGA_1700][LGA_1700]]. + +For now the only supported chipset for Alder Lake is the [[https://ark.intel.com/content/www/us/en/ark/products/218833/intel-z690-chipset.html][z690]]. +*** Alder Lake (12th generation) +| model | p-cores | e-cores | GHz (base) | GHz (boosted) | PCIe lanes | memory support | TDP | +|------------+---------+---------+---------------+---------------+--------------------------+----------------+------| +| i9-12900K | 8 (16) | 8 | 3.2/2.4 | 5.1/3.9 | 16 PCIe 5.0 + 4 PCIe 4.0 | DDR5-4800 | 241W | +| i9-12900KF | 8 (16) | 8 | 3.2/2.4 | 5.1/3.9 | - | - | 241W | +| i7-12700K | 8 (16) | 4 | 3.6/2.7 | 4.9/3.8 | - | - | 190W | +| i7-12700KF | 8 (16) | 4 | 3.6/2.7 | 4.9/3.8 | - | - | 190W | +| i5-12600K | 6 (12) | 4 | 3.7/2.8 | 4.9/3.6 | - | - | 150W | +| i5-12600KF | 6 (12) | 4 | 3.7/2.8 | 4.9/3.6 | - | - | 150W | + +- support DDR4 and DDR5 +- support PCIe 4.0 and 5.0 + +Alder lake is an hybrid architecture, featuring both P-cores (performance cores) and E-cores (efficient cores). P-cores are based on the [[https://en.wikipedia.org/wiki/Golden_Cove][Golden Cove]] architecture, while the E-cores are based on the [[https://en.wikipedia.org/wiki/Gracemont_(microarchitecture)][Gracemont]] architecture. + +This is a [[https://www.anandtech.com/show/16881/a-deep-dive-into-intels-alder-lake-microarchitectures/2][good article]] to read about this model. Inside the processor there's a microcontroller that monitors what each thread is doing. This can be used by the OS scheduler to hint on which core a thread should be scheduled on (between performance or efficiency). + +As of December 2021 this is not yet properly supported by the Linux kernel. +** Xeon +Xeon is the brand of Intel processor designed for non-consumer servers and workstations. +The most recent generations are: +- Skylake (2017) +- Cascade lake (2019) +- Cooper lake (2020) + +The following brand identifiers are used: +- platinium +- gold +- silver +- bronze +* AMD +** Ryzen +There are multiple generation for this brand of processors. They are based on the [[https://en.wikipedia.org/wiki/Zen_(microarchitecture)][zen micro architecture]]. The current (as of December 2021) generation is Ryzen 5000. + +The brand modifiers are: +- ryzen 3: entry level +- ryzen 5: mainstream +- ryzen 9: high end performance +- ryzen 9:enthusiast + +List of suffixes: +| suffix | meaning | +|--------+--------------------------------------------| +| X | high performance | +| G | integrated graphics | +| T | power optimized lifecycle | +| S | low power desktop with integrated graphics | +| H | high performance mobile | +| U | standard mobile | +| M | low power mobile | + +** EPYC +EPYC is the AMD brand of processors for the server market, based on the zen architecture. They use the [[https://en.wikipedia.org/wiki/Socket_SP3][SP3]] socket. The EPYC processor is chipset free. +** Threadripper +The threadripper is for high performance desktop. It uses the [[https://en.wikipedia.org/wiki/Socket_TR4][TR4]] socket. At the moment there's only one chipset that supports this process, the [[https://en.wikipedia.org/wiki/List_of_AMD_chipsets#TR4_chipsets][X399]]. + +The threadripper based on zen3 architecture is not yet released, but it's expected to hit the market in the first half of Q1 2022. +** Sockets/Chipsets +The majority of these processors use the [[https://en.wikipedia.org/wiki/Socket_AM4][AM4 socket]]. The threadripper line uses different sockets. + +There are multiple [[https://en.wikipedia.org/wiki/Socket_AM4#Chipsets][chipset]] for the AM4 socket. The more advanced ones are the B550 and the X570. + +The threadripper processors use the TR4, sTRX4 and sWRX8 sockets. +** Zen 3 +Zen 3 was released in November 2020. +| model | cores | GHz (base) | GHz (boosted) | PCIe lanes | memory support | TDP | +|---------------+---------+------------+---------------+------------+----------------+------| +| ryzen 5 5600x | 6 (12) | 3.7 | 4.6 | 24 | DDR4-3200 | 65W | +| ryzen 7 5800 | 8 (16) | 3.4 | 4.6 | 24 | DDR4-3200 | 65W | +| ryzen 7 5800x | 8 (16) | 3.8 | 4.7 | 24 | DDR4-3200 | 105W | +| ryzen 9 5900 | 12 (24) | 3.0 | 4.7 | 24 | DDR4-3200 | 65W | +| ryzen 9 5900x | 12 (24) | 3.7 | 4.8 | 24 | DDR4-3200 | 105W | +| ryzen 9 5950x | 16 (32) | 3.4 | 4.9 | 24 | DDR4-3200 | 105W | + +- support PCIe 3.0 and PCIe 4.0 (except for the G series) +- only support DDR4 -- cgit 1.4.1 From ae1cde50b7ce96e4f3831fdc793c7a0a4842d368 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Sat, 8 Jan 2022 10:07:36 -0800 Subject: blog: add content about PCIe --- .../fcuny/notes/content/notes/stuff-about-pcie.org | 196 +++++++++++++++++++++ 1 file changed, 196 insertions(+) create mode 100644 users/fcuny/notes/content/notes/stuff-about-pcie.org diff --git a/users/fcuny/notes/content/notes/stuff-about-pcie.org b/users/fcuny/notes/content/notes/stuff-about-pcie.org new file mode 100644 index 0000000..4d1a825 --- /dev/null +++ b/users/fcuny/notes/content/notes/stuff-about-pcie.org @@ -0,0 +1,196 @@ +#+TITLE: Stuff about PCIe +#+DATE: <2022-01-03 Mon> +#+TAGS[]: linux hardware +#+toc: t + +* Speed +The most common versions are 3 and 4, while 5 is starting to be available with newer Intel processors. + +| ver | encoding | transfer rate | x1 | x2 | x4 | x8 | x16 | +|-----+-----------+---------------+------------+-------------+------------+------------+-------------| +| 1 | 8b/10b | 2.5GT/s | 250MB/s | 500MB/s | 1GB/s | 2GB/s | 4GB/s | +| 2 | 8b/10b | 5.0GT/s | 500MB/s | 1GB/s | 2GB/s | 4GB/s | 8GB/s | +| 3 | 128b/130b | 8.0GT/s | 984.6 MB/s | 1.969 GB/s | 3.94 GB/s | 7.88 GB/s | 15.75 GB/s | +| 4 | 128b/130b | 16.0GT/s | 1969 MB/s | 3.938 GB/s | 7.88 GB/s | 15.75 GB/s | 31.51 GB/s | +| 5 | 128b/130b | 32.0GT/s | 3938 MB/s | 7.877 GB/s | 15.75 GB/s | 31.51 GB/s | 63.02 GB/s | +| 6 | 128b/130 | 64.0 GT/s | 7877 MB/s | 15.754 GB/s | 31.51 GB/s | 63.02 GB/s | 126.03 GB/s | + +This is a [[https://community.mellanox.com/s/article/understanding-pcie-configuration-for-maximum-performance][useful]] link to understand the formula: Maximum PCIe Bandwidth = *SPEED* * *WIDTH* * (1 - ENCODING) - 1Gb/s. + +We remove 1Gb/s for protocol overhead and error corrections. The main difference between the generations besides the supported speed is the encoding overhead of the packet. For generations 1 and 2, each packet sent on the PCIe has 20% PCIe headers overhead. This was improved in generation 3, where the overhead was reduced to 1.5% (2/130) - see [[https://en.wikipedia.org/wiki/8b/10b_encoding][8b/10b encoding]] and [[https://en.wikipedia.org/wiki/64b/66b_encoding][128b/130b encoding]]. + +If we apply the formula, for a PCIe version 3 device we can expect 3.7GB/s of data transfer rate: +#+begin_src +8GT/s * 4 lanes * (1 - 2/130) - 1G = 32G * 0.985 - 1G = ~30Gb/s -> 3750MB/s +#+end_src +* Topology +The easiest way to see the PCIe topology is with =lspci=: +#+begin_src +$ lspci -tv +-[0000:00]-+-00.0 Advanced Micro Devices, Inc. [AMD] Family 17h (Models 00h-0fh) Root Complex + +-01.0 Advanced Micro Devices, Inc. [AMD] Family 17h (Models 00h-1fh) PCIe Dummy Host Bridge + +-01.1-[01]----00.0 OCZ Technology Group, Inc. RD400/400A SSD + +-01.3-[02-03]----00.0-[03]----00.0 ASPEED Technology, Inc. ASPEED Graphics Family + +-01.5-[04]--+-00.0 Intel Corporation I350 Gigabit Network Connection + | +-00.1 Intel Corporation I350 Gigabit Network Connection + | +-00.2 Intel Corporation I350 Gigabit Network Connection + | \-00.3 Intel Corporation I350 Gigabit Network Connection + +-02.0 Advanced Micro Devices, Inc. [AMD] Family 17h (Models 00h-1fh) PCIe Dummy Host Bridge + +-03.0 Advanced Micro Devices, Inc. [AMD] Family 17h (Models 00h-1fh) PCIe Dummy Host Bridge + +-04.0 Advanced Micro Devices, Inc. [AMD] Family 17h (Models 00h-1fh) PCIe Dummy Host Bridge + +-07.0 Advanced Micro Devices, Inc. [AMD] Family 17h (Models 00h-1fh) PCIe Dummy Host Bridge + +-07.1-[05]--+-00.0 Advanced Micro Devices, Inc. [AMD] Zeppelin/Raven/Raven2 PCIe Dummy Function + | +-00.2 Advanced Micro Devices, Inc. [AMD] Family 17h (Models 00h-0fh) Platform Security Processor + | \-00.3 Advanced Micro Devices, Inc. [AMD] Zeppelin USB 3.0 Host controller + +-08.0 Advanced Micro Devices, Inc. [AMD] Family 17h (Models 00h-1fh) PCIe Dummy Host Bridge + +-08.1-[06]--+-00.0 Advanced Micro Devices, Inc. [AMD] Zeppelin/Renoir PCIe Dummy Function + | +-00.1 Advanced Micro Devices, Inc. [AMD] Zeppelin Cryptographic Coprocessor NTBCCP + | +-00.2 Advanced Micro Devices, Inc. [AMD] FCH SATA Controller [AHCI mode] + | \-00.3 Advanced Micro Devices, Inc. [AMD] Family 17h (Models 00h-0fh) HD Audio Controller + +-14.0 Advanced Micro Devices, Inc. [AMD] FCH SMBus Controller + +-14.3 Advanced Micro Devices, Inc. [AMD] FCH LPC Bridge + +-18.0 Advanced Micro Devices, Inc. [AMD] Family 17h (Models 00h-0fh) Data Fabric: Device 18h; Function 0 + +-18.1 Advanced Micro Devices, Inc. [AMD] Family 17h (Models 00h-0fh) Data Fabric: Device 18h; Function 1 + +-18.2 Advanced Micro Devices, Inc. [AMD] Family 17h (Models 00h-0fh) Data Fabric: Device 18h; Function 2 + +-18.3 Advanced Micro Devices, Inc. [AMD] Family 17h (Models 00h-0fh) Data Fabric: Device 18h; Function 3 + +-18.4 Advanced Micro Devices, Inc. [AMD] Family 17h (Models 00h-0fh) Data Fabric: Device 18h; Function 4 + +-18.5 Advanced Micro Devices, Inc. [AMD] Family 17h (Models 00h-0fh) Data Fabric: Device 18h; Function 5 + +-18.6 Advanced Micro Devices, Inc. [AMD] Family 17h (Models 00h-0fh) Data Fabric: Device 18h; Function 6 + \-18.7 Advanced Micro Devices, Inc. [AMD] Family 17h (Models 00h-0fh) Data Fabric: Device 18h; Function 7 +#+end_src +* View a single device +#+begin_src +$ lspci -s 0000:01:00.0 +01:00.0 Non-Volatile memory controller: OCZ Technology Group, Inc. RD400/400A SSD (rev 01) +#+end_src +* Reading =lspci= output +#+begin_src +$ sudo lspci -vvv -s 0000:01:00.0 +01:00.0 Non-Volatile memory controller: OCZ Technology Group, Inc. RD400/400A SSD (rev 01) (prog-if 02 [NVM Express]) + Subsystem: OCZ Technology Group, Inc. RD400/400A SSD + Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx+ + Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- SERR- Date: Sat, 8 Jan 2022 10:07:43 -0800 Subject: index: update current job --- users/fcuny/notes/layouts/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/users/fcuny/notes/layouts/index.html b/users/fcuny/notes/layouts/index.html index 9e15e77..586aaa5 100644 --- a/users/fcuny/notes/layouts/index.html +++ b/users/fcuny/notes/layouts/index.html @@ -2,7 +2,7 @@

        {{ .Site.Home.Title }}

        -

        I'm currently working as an Engineer at Twitter, on the Compute team.

        +

        I'm an engineer currently working as a break. Previously I was a Site Reliability Engineer at Twitter, on the Compute team.

        Contact

          -- cgit 1.4.1 From 1ad09c465aca33641858bdd9aa06ecd76c3700e6 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Mon, 10 Jan 2022 11:46:19 -0800 Subject: index: rephrase --- users/fcuny/notes/layouts/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/users/fcuny/notes/layouts/index.html b/users/fcuny/notes/layouts/index.html index 586aaa5..21a86b8 100644 --- a/users/fcuny/notes/layouts/index.html +++ b/users/fcuny/notes/layouts/index.html @@ -2,7 +2,7 @@

          {{ .Site.Home.Title }}

          -

          I'm an engineer currently working as a break. Previously I was a Site Reliability Engineer at Twitter, on the Compute team.

          +

          I'm an engineer currently on a break. Previously I was a Site Reliability Engineer working on Twitter's compute platform.

          Contact

            -- cgit 1.4.1 From 5f17134aedef69f78ffd5475de1ee655db54d914 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Thu, 13 Jan 2022 14:02:25 -0800 Subject: css: more tweaking --- users/fcuny/notes/static/css/custom.css | 50 ++++++++++++++------------------- 1 file changed, 21 insertions(+), 29 deletions(-) diff --git a/users/fcuny/notes/static/css/custom.css b/users/fcuny/notes/static/css/custom.css index a38593d..39d3d8c 100644 --- a/users/fcuny/notes/static/css/custom.css +++ b/users/fcuny/notes/static/css/custom.css @@ -19,18 +19,15 @@ hr{ height:2px } -a { - color: #023; - background-color: #eee; -} -a:visited { - color: #345; - background: #eee; -} a:hover { - color: #000; text-decoration: none; - background:#ccf; + border-bottom: 1px solid; +} + +a { + text-decoration: none; + border-bottom: 1px dotted; + color: black; } span.published, span.updated { @@ -41,25 +38,25 @@ span.published, span.updated { code { font-family: monospace; font-size: 80%; -} -code.verbatim { - background-color: #fffff8; -} -:not(pre) code{ padding-left:0.1em; padding-right:0.1em; - border-radius:2px; + border-radius:4px; + background-color: #f7f7f7; } -.highlight pre {background-color: #fffff8 !important} -.highlight {border-radius: 5px} +ol { + line-height: 0.8em; +} pre { font-family: monospace; + font-size: 90%; padding: 0.3rem 0.3rem; margin: 0; overflow-x: auto; border: 1px solid #000; + border-radius: 4px; + background-color: #f7f7f7; } .meta_tags { @@ -70,8 +67,9 @@ pre { background-color: #eee; } -.meta_tags a:link, .meta_tags a:visited { +.meta_tags a { text-decoration: none; + border-bottom: none; } .meta_date { @@ -83,7 +81,6 @@ table { width: 100%; border-spacing: 0px; outline: none; - line-height: 0.9em; } th, td{ @@ -100,15 +97,10 @@ table, th, td { } blockquote { - background-color: #f2e5bc; - font-style: italic; - border-left: 6px solid #7c6f64; - margin-left: 0px; - margin-right: 0px; - padding-left: 0.7em; - padding-right:0.7em; - padding-top:0.2em; - padding-bottom:0.2em; + page-break-inside:avoid; + padding:10px 20px; + margin:0 0 20px; + border-left:5px solid #eee } nav.menu { -- cgit 1.4.1 From 56a2e9d948151f9880f2b0ac403df1cfad508ac2 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Sat, 15 Jan 2022 12:39:41 -0800 Subject: blog: leaving twitter --- users/fcuny/notes/content/blog/leaving-twitter.org | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 users/fcuny/notes/content/blog/leaving-twitter.org diff --git a/users/fcuny/notes/content/blog/leaving-twitter.org b/users/fcuny/notes/content/blog/leaving-twitter.org new file mode 100644 index 0000000..9bc5027 --- /dev/null +++ b/users/fcuny/notes/content/blog/leaving-twitter.org @@ -0,0 +1,10 @@ +#+TITLE: Leaving Twitter +#+DATE: <2022-01-15 Sat> + +January 7th 2022 was my last day at Twitter, after more than 7 years at the company. + +The first few years I worked as an SRE in the core-storage team, with the PUB/SUB and key-value store teams. + +I spend the last four years working with the Compute team, both maintaining and operating our (very large) Aurora/Mesos clusters, and also working on the adoption of kubernetes, both for our data centers and for the cloud. Working with Compute was extremely fulfilling to me, as I worked closely with our hardware engineering and kernel/operating system teams. + +During these 7 years, I was constantly pushed by my coworkers to grow, to step up to new challenges, and I learned a tremendous amount about running large scale distributed systems. I'm extremely glad for that experience, it was by far the most interesting and challenging job I've ever had so far. -- cgit 1.4.1 From 4bdbdb0a1f61cc79d280e41e44d3f40d9d197365 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Fri, 21 Jan 2022 11:13:35 -0800 Subject: nav: drop one item from the menu --- users/fcuny/notes/config.toml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/users/fcuny/notes/config.toml b/users/fcuny/notes/config.toml index 7162180..1fe49bc 100644 --- a/users/fcuny/notes/config.toml +++ b/users/fcuny/notes/config.toml @@ -20,13 +20,6 @@ enableGitInfo = true tags = "/tags/:slug/" [menu] - [[menu.main]] - identifier = "home" - name = "home" - title = "fcuny.net" - url = "/" - weight = 100 - [[menu.main]] identifier = "articles" name = "blog" -- cgit 1.4.1 From 8d089c7d6d798410bfb50f5d2d30106974a984cf Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Fri, 21 Jan 2022 11:13:56 -0800 Subject: post: change formatting for the date --- users/fcuny/notes/layouts/_default/single.html | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/users/fcuny/notes/layouts/_default/single.html b/users/fcuny/notes/layouts/_default/single.html index 165c568..4f21ded 100644 --- a/users/fcuny/notes/layouts/_default/single.html +++ b/users/fcuny/notes/layouts/_default/single.html @@ -5,17 +5,17 @@

            {{ .Title }}

            - {{- $pub := .Date.Format "2006-01-02" -}} + {{- $pub := .Date.Format "Jan 2, 2006" -}} {{- $mod := "" -}} {{- if (not .GitInfo) }} - {{- $mod = .Lastmod.Format "2006-01-02" -}} + {{- $mod = .Lastmod.Format "Jan 2, 2006" -}} {{ else }} - {{- $mod = .Page.GitInfo.CommitDate.Format "2006-01-02" -}} + {{- $mod = .Page.GitInfo.CommitDate.Format "Jan 2, 2006" -}} {{ end -}} {{ if eq $pub $mod }}
            published {{ $pub }}
            {{ else }} -
            published {{ $pub }}, last modified {{ $mod }}
            +
            published {{ $pub }} - last modified {{ $mod }}
            {{ end }} {{ if .Params.tags }}
            -- cgit 1.4.1 From e3c457f0b32c2d4c754ab80d60052b63555d6333 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Fri, 21 Jan 2022 11:14:06 -0800 Subject: nav: align the menu items to the right --- users/fcuny/notes/layouts/partials/header.html | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/users/fcuny/notes/layouts/partials/header.html b/users/fcuny/notes/layouts/partials/header.html index 9118a50..e579329 100644 --- a/users/fcuny/notes/layouts/partials/header.html +++ b/users/fcuny/notes/layouts/partials/header.html @@ -1,7 +1,12 @@
            -
            -- cgit 1.4.1 From 29c6807fdb0692efca11b82c35f963b92d68d12e Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Fri, 21 Jan 2022 11:14:25 -0800 Subject: css: major cleanup --- users/fcuny/notes/static/css/custom.css | 160 +++++++++++++++++--------------- 1 file changed, 84 insertions(+), 76 deletions(-) diff --git a/users/fcuny/notes/static/css/custom.css b/users/fcuny/notes/static/css/custom.css index 39d3d8c..c24db91 100644 --- a/users/fcuny/notes/static/css/custom.css +++ b/users/fcuny/notes/static/css/custom.css @@ -1,123 +1,131 @@ body { - font-family: sans-serif; - font-size:18px; - color: #000111; - background-color: #fbf1c7; - margin:1em auto; - max-width:750px; - padding:0 0.55em; + font-family: sans-serif; + font-size: 1.125em; + line-height: 1.5; + color: #37474f; + word-wrap: break-word; + margin: 1em auto; + max-width: 750px; + padding: 0 0.55em; } -h1{margin-top:1em;margin-bottom:0.34em} -h2{margin-top:1.25em;margin-bottom:0.41em} -h3{margin-top:1.5em;margin-bottom:0.5em} +h1 { + font-size: 2em; +} + +h1 {margin-top: 1em; margin-bottom: 0.34em} +h2 {margin-top: 1.25em; margin-bottom: 0.41em} +h3 {margin-top: 1.5em; margin-bottom: 0.5em} hr{ - color:#000111; - background-color:#000111; - border:none; - height:2px + color:#000111; + background-color:#000111; + border:none; + height:2px } -a:hover { - text-decoration: none; - border-bottom: 1px solid; -} +a {border-bottom: .125em dashed #bdbdbd} a { - text-decoration: none; - border-bottom: 1px dotted; - color: black; + color:#212121; + text-decoration:none; + transition:color .1s ease-in-out } +a:hover, a:focus, a:active {color:#37474f} + +a:hover, a:focus {border-bottom-color: #a6071b} + span.published, span.updated { - display: center; - font-style: oblique; + display: center; + font-style: oblique; } code { - font-family: monospace; - font-size: 80%; - padding-left:0.1em; - padding-right:0.1em; - border-radius:4px; - background-color: #f7f7f7; + font-family: monospace; + padding-left:0.1em; + padding-right:0.1em; + border-radius:4px; + background-color: #fafafa; } -ol { - line-height: 0.8em; -} +p code {color: #f8546a} pre { - font-family: monospace; - font-size: 90%; - padding: 0.3rem 0.3rem; - margin: 0; - overflow-x: auto; - border: 1px solid #000; - border-radius: 4px; - background-color: #f7f7f7; + font-family: monospace; + margin: 0; + word-wrap: normal; + padding:1.125em; + overflow-x: auto; + border: 1px solid #ccc; + border-radius: 3px; + background-color: #fafafa; } .meta_tags { - border-radius: 8px; - padding: 0 .5rem; - font-size: 80%; - border: 2px solid #eee; - background-color: #eee; + border-radius: 8px; + padding: 0 .5rem; + font-size: 80%; + border: 2px solid #eee; + background-color: #eee; } .meta_tags a { - text-decoration: none; - border-bottom: none; + text-decoration: none; + border-bottom: none; } .meta_date { - font-style: italic; - font-size: 80%; + font-style: italic; + font-size: 80%; } table { - width: 100%; - border-spacing: 0px; - outline: none; + width: 100%; + border-spacing: 0px; + outline: none; } th, td{ - padding-left:0.7em; - padding-right:0.7em; - padding-top:0.4em; - padding-bottom:0.4em; + padding-left: 0.7em; + padding-right: 0.7em; + padding-top: 0.4em; + padding-bottom: 0.4em; } thead { - background-color: #ebdbb2; -} -table, th, td { - border:1px solid black; + background-color: #ebdbb2; } +table, th, td {border: 1px solid black} blockquote { - page-break-inside:avoid; - padding:10px 20px; - margin:0 0 20px; - border-left:5px solid #eee + font-size: 1.125em; + font-style: italic; + margin: 0 0 1.5em; + padding-left: 1em; + border-left: .2em solid #bdbdbd +} + +nav { + width: 100%; + padding-right: 10px; + display: flex; + justify-content: space-between; + align-items: center; } -nav.menu { - display: flex; - justify-content: flex-start; - flex-direction: row; - flex-wrap: nowrap; - margin: 0 auto; +.nav-links { + list-style: none; + display: flex; } -.menu-item { - padding-right: 8px; +.navbar a { + display: inline-block; + padding-right: 10px; } .toc { - border: 1px solid black; - padding: 1em; - margin-top: 1em; - color: black; + border: 1px solid black; + padding: 1em; + margin-top: 1em; + color: black; } -- cgit 1.4.1 From b11447bcba41ea413ab2ed633d4c8606b321ff80 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Fri, 21 Jan 2022 11:18:27 -0800 Subject: nav: use 'fcuny.net' instead of template variable Otherwise it's the name of the site, which is not what I'm looking for here. --- users/fcuny/notes/layouts/partials/header.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/users/fcuny/notes/layouts/partials/header.html b/users/fcuny/notes/layouts/partials/header.html index e579329..dede0ae 100644 --- a/users/fcuny/notes/layouts/partials/header.html +++ b/users/fcuny/notes/layouts/partials/header.html @@ -1,7 +1,7 @@
    + {{ end }} -- cgit 1.4.1 From 1f644e51028a77b2e3ef2de33d3497f8bf565ad2 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Sun, 23 Jan 2022 18:22:47 -0800 Subject: layout: proper TOC There's a need for two TOCs in the layout: one for when the page is on mobile; one for non mobile. When we are on mobile, we display the first TOC, before the article. When we're not on mobile, we hide that TOC and display one after the document. We restructure a bit the layout so that's it's a bit more readable too, and close tags properly. --- users/fcuny/notes/layouts/_default/single.html | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/users/fcuny/notes/layouts/_default/single.html b/users/fcuny/notes/layouts/_default/single.html index 4f21ded..524145a 100644 --- a/users/fcuny/notes/layouts/_default/single.html +++ b/users/fcuny/notes/layouts/_default/single.html @@ -1,6 +1,6 @@ {{ define "main" }} -
    +

    {{ .Title }}

    @@ -32,14 +32,23 @@
    {{ if .Params.toc }} -
    - Table of Contents +
    + Table of contents {{ .TableOfContents }}
    {{ end }} +
    {{ .Content }} +
    + +
    -
    +{{ if .Params.toc }} +
    + Table of contents + {{ .TableOfContents }} +
    +{{ end }} {{ end }} -- cgit 1.4.1 From 64b29cae5370751385a506d97da8846b9dfe19c0 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Sun, 23 Jan 2022 18:48:19 -0800 Subject: css: TOC location based on display's size Depending on the size of the display, display the TOC either before the article or on the right of the article and let's make it sticky. --- users/fcuny/notes/static/css/custom.css | 101 ++++++++++++++++++++++++++------ 1 file changed, 82 insertions(+), 19 deletions(-) diff --git a/users/fcuny/notes/static/css/custom.css b/users/fcuny/notes/static/css/custom.css index bbf93a7..80b07a0 100644 --- a/users/fcuny/notes/static/css/custom.css +++ b/users/fcuny/notes/static/css/custom.css @@ -3,17 +3,27 @@ body { font-size: 1.125em; line-height: 1.5; color: #37474f; - word-wrap: break-word; margin: 1em auto; - max-width: 750px; padding: 0 0.55em; + max-width: 45rem; +} + +@media screen and (min-width:58rem) { + body, + main { + max-width:calc(45rem + 15rem); + } + main { + display: flex; + } } h1 { font-size: 2em; + margin-top: 1em; + margin-bottom: 0.34em; } -h1 {margin-top: 1em; margin-bottom: 0.34em} h2 {margin-top: 1.25em; margin-bottom: 0.41em} h3 {margin-top: 1.5em; margin-bottom: 0.5em} @@ -24,17 +34,19 @@ hr{ height:2px } -a {border-bottom: .125em dashed #bdbdbd} - a { color:#047bc2; - text-decoration:none; - transition:color .1s ease-in-out + transition:color .1s ease-in-out; } -a:hover, a:focus, a:active {color:#047bc2} - -a:hover, a:focus {border-bottom-color: #047bc2} +a:link, +a:hover, +a:focus, +a:active { + color:#047bc2; + text-decoration: underline; + text-underline-offset:.2rem +} span.published, span.updated { display: center; @@ -43,9 +55,9 @@ span.published, span.updated { code { font-family: monospace; - padding-left:0.1em; - padding-right:0.1em; - border-radius:4px; + padding-left: 0.1em; + padding-right: 0.1em; + border-radius: 4px; background-color: #fafafa; } @@ -62,6 +74,10 @@ pre { background-color: #fafafa; } +.meta { + display: row; +} + .meta_tags { border-radius: 8px; padding: 0 .5rem; @@ -73,6 +89,7 @@ pre { .meta_tags a { text-decoration: none; border-bottom: none; + color: #005a9c; } .meta_date { @@ -102,7 +119,7 @@ table, th, td { } blockquote { - font-size: 1.125em; + font-size: 1em; font-style: italic; margin: 0 0 1.5em; padding-left: 1em; @@ -115,6 +132,13 @@ nav { display: flex; justify-content: space-between; align-items: center; + padding-top: 0.5rem; +} + +@media screen and (min-width:58rem) { + nav { + max-width: calc(45rem + 15rem); + } } .nav-links { @@ -127,9 +151,48 @@ nav { padding-right: 10px; } -.toc { - border: 1px solid black; - padding: 1em; - margin-top: 1em; - color: black; +article { + max-width: 45rem; +} + +.toc {display: none} + +#toc_small { + font-size: 0.9rem; + margin-bottom: 2rem; + margin-top: 2rem; +} +@media screen and (min-width:58rem) { + #toc_small {display: none;} +} + +summary { + display:flex; + flex-direction:column; +} + +#TableOfContents > ul, #TableOfContents > ul > li > ul { + list-style: none; + margin: 0; + padding: 0; +} + +#TableOfContents li {margin-bottom: 1rem;} + +@media screen and (min-width:58rem) { + .toc { + padding-left: 1rem; + padding-top: 4.5rem; + font-size: 0.8em; + display:block; + position:sticky; + top:0; + align-self:flex-start; + max-width:15rem; + z-index:1; + } + #TableOfContents { + border-left: 3px solid #eee; + padding-left: 1rem; + } } -- cgit 1.4.1 From 5abd6605d975c90a5a9620267bd6ba2371317b9c Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Sun, 23 Jan 2022 18:49:53 -0800 Subject: layout: no need for a class to element 'article' --- users/fcuny/notes/layouts/_default/list.html | 2 +- users/fcuny/notes/layouts/_default/single.html | 2 +- users/fcuny/notes/layouts/index.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/users/fcuny/notes/layouts/_default/list.html b/users/fcuny/notes/layouts/_default/list.html index 6d1c04f..d2c59a7 100644 --- a/users/fcuny/notes/layouts/_default/list.html +++ b/users/fcuny/notes/layouts/_default/list.html @@ -1,6 +1,6 @@ {{ define "main" }} -
    +
    {{ $pgs := where .Data.Pages "Params.hidden" "ne" "true" }} {{ partial "postlist" $pgs }} diff --git a/users/fcuny/notes/layouts/_default/single.html b/users/fcuny/notes/layouts/_default/single.html index 524145a..fe2477e 100644 --- a/users/fcuny/notes/layouts/_default/single.html +++ b/users/fcuny/notes/layouts/_default/single.html @@ -38,7 +38,7 @@
    {{ end }} -
    +
    {{ .Content }}
    diff --git a/users/fcuny/notes/layouts/index.html b/users/fcuny/notes/layouts/index.html index 523ad08..2ab8c40 100644 --- a/users/fcuny/notes/layouts/index.html +++ b/users/fcuny/notes/layouts/index.html @@ -1,6 +1,6 @@ {{ define "main" }} -
    +

    {{ .Site.Home.Title }}

    -- cgit 1.4.1 From 24cebe8b0005ffd6e0dc390780ce54139a1179ec Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Sun, 23 Jan 2022 19:11:39 -0800 Subject: CSS: switch from class to id These elements are unique on each page. --- users/fcuny/notes/layouts/_default/single.html | 10 +++++----- users/fcuny/notes/static/css/custom.css | 18 +++++++++--------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/users/fcuny/notes/layouts/_default/single.html b/users/fcuny/notes/layouts/_default/single.html index fe2477e..7a85a05 100644 --- a/users/fcuny/notes/layouts/_default/single.html +++ b/users/fcuny/notes/layouts/_default/single.html @@ -4,7 +4,7 @@

    {{ .Title }}

    -
    +
    {{- $pub := .Date.Format "Jan 2, 2006" -}} {{- $mod := "" -}} {{- if (not .GitInfo) }} @@ -13,9 +13,9 @@ {{- $mod = .Page.GitInfo.CommitDate.Format "Jan 2, 2006" -}} {{ end -}} {{ if eq $pub $mod }} -
    published {{ $pub }}
    +
    published {{ $pub }}
    {{ else }} -
    published {{ $pub }} - last modified {{ $mod }}
    +
    published {{ $pub }} - last modified {{ $mod }}
    {{ end }} {{ if .Params.tags }}
    @@ -25,7 +25,7 @@ tags: {{ end }} {{ range $idx, $tag := .Params.tags }} - {{ $tag }} + {{ $tag }} {{ end }}
    {{ end }} @@ -45,7 +45,7 @@
    {{ if .Params.toc }} -
    +
    Table of contents {{ .TableOfContents }}
    diff --git a/users/fcuny/notes/static/css/custom.css b/users/fcuny/notes/static/css/custom.css index 80b07a0..3f4a142 100644 --- a/users/fcuny/notes/static/css/custom.css +++ b/users/fcuny/notes/static/css/custom.css @@ -74,27 +74,27 @@ pre { background-color: #fafafa; } -.meta { +#meta { display: row; } -.meta_tags { +#meta_tags { border-radius: 8px; padding: 0 .5rem; - font-size: 80%; + font-size: 0.9rem; border: 2px solid #eee; background-color: #eee; } -.meta_tags a { +#meta_tags a { text-decoration: none; border-bottom: none; color: #005a9c; } -.meta_date { +#meta_date { font-style: italic; - font-size: 80%; + font-size: 0.9rem; } table { @@ -155,7 +155,7 @@ article { max-width: 45rem; } -.toc {display: none} +#toc {display: none} #toc_small { font-size: 0.9rem; @@ -180,10 +180,10 @@ summary { #TableOfContents li {margin-bottom: 1rem;} @media screen and (min-width:58rem) { - .toc { + #toc { padding-left: 1rem; padding-top: 4.5rem; - font-size: 0.8em; + font-size: 0.9rem; display:block; position:sticky; top:0; -- cgit 1.4.1 From 657e032c034e44241243fcbe71475539c92f3b78 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Sun, 23 Jan 2022 19:22:15 -0800 Subject: CSS: adjust some font sizes --- users/fcuny/notes/static/css/custom.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/users/fcuny/notes/static/css/custom.css b/users/fcuny/notes/static/css/custom.css index 3f4a142..c802354 100644 --- a/users/fcuny/notes/static/css/custom.css +++ b/users/fcuny/notes/static/css/custom.css @@ -19,7 +19,7 @@ body { } h1 { - font-size: 2em; + font-size: 2rem; margin-top: 1em; margin-bottom: 0.34em; } @@ -119,7 +119,7 @@ table, th, td { } blockquote { - font-size: 1em; + font-size: 0.95rem; font-style: italic; margin: 0 0 1.5em; padding-left: 1em; -- cgit 1.4.1 From dcdf10728adb8b1b9ba8bf4a31bcfba44e551c89 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Sun, 23 Jan 2022 19:55:55 -0800 Subject: CSS: improve readability Using Firefox' accessibility tool as a guide. --- users/fcuny/notes/static/css/custom.css | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/users/fcuny/notes/static/css/custom.css b/users/fcuny/notes/static/css/custom.css index c802354..ae6d674 100644 --- a/users/fcuny/notes/static/css/custom.css +++ b/users/fcuny/notes/static/css/custom.css @@ -55,21 +55,24 @@ span.published, span.updated { code { font-family: monospace; - padding-left: 0.1em; - padding-right: 0.1em; + padding-left: 0.2em; + padding-right: 0.2em; border-radius: 4px; - background-color: #fafafa; } -p code {color: #f8546a} +p code { + color: black; + background-color: #eee; + padding: 0 0.2rem; +} pre { font-family: monospace; margin: 0; word-wrap: normal; - padding:1.125em; + padding: 0.8em; overflow-x: auto; - border: 1px solid #ccc; + border: 1px solid #eee; border-radius: 3px; background-color: #fafafa; } -- cgit 1.4.1 From 7bc729048e2c1d174aa8459f55a425b35a1eaad2 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Sun, 23 Jan 2022 19:56:11 -0800 Subject: notes: remove some columns for the various CPUs --- .../content/notes/making-sense-intel-amd-cpus.org | 42 +++++++++++----------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/users/fcuny/notes/content/notes/making-sense-intel-amd-cpus.org b/users/fcuny/notes/content/notes/making-sense-intel-amd-cpus.org index 4b5541f..2394085 100644 --- a/users/fcuny/notes/content/notes/making-sense-intel-amd-cpus.org +++ b/users/fcuny/notes/content/notes/making-sense-intel-amd-cpus.org @@ -43,17 +43,19 @@ For the Alder Lake generation, the supported socket is the [[https://en.wikipedi For now the only supported chipset for Alder Lake is the [[https://ark.intel.com/content/www/us/en/ark/products/218833/intel-z690-chipset.html][z690]]. *** Alder Lake (12th generation) -| model | p-cores | e-cores | GHz (base) | GHz (boosted) | PCIe lanes | memory support | TDP | -|------------+---------+---------+---------------+---------------+--------------------------+----------------+------| -| i9-12900K | 8 (16) | 8 | 3.2/2.4 | 5.1/3.9 | 16 PCIe 5.0 + 4 PCIe 4.0 | DDR5-4800 | 241W | -| i9-12900KF | 8 (16) | 8 | 3.2/2.4 | 5.1/3.9 | - | - | 241W | -| i7-12700K | 8 (16) | 4 | 3.6/2.7 | 4.9/3.8 | - | - | 190W | -| i7-12700KF | 8 (16) | 4 | 3.6/2.7 | 4.9/3.8 | - | - | 190W | -| i5-12600K | 6 (12) | 4 | 3.7/2.8 | 4.9/3.6 | - | - | 150W | -| i5-12600KF | 6 (12) | 4 | 3.7/2.8 | 4.9/3.6 | - | - | 150W | - -- support DDR4 and DDR5 -- support PCIe 4.0 and 5.0 +| model | p-cores | e-cores | GHz (base) | GHz (boosted) | TDP | +|------------+---------+---------+------------+---------------+------| +| i9-12900K | 8 (16) | 8 | 3.2/2.4 | 5.1/3.9 | 241W | +| i9-12900KF | 8 (16) | 8 | 3.2/2.4 | 5.1/3.9 | 241W | +| i7-12700K | 8 (16) | 4 | 3.6/2.7 | 4.9/3.8 | 190W | +| i7-12700KF | 8 (16) | 4 | 3.6/2.7 | 4.9/3.8 | 190W | +| i5-12600K | 6 (12) | 4 | 3.7/2.8 | 4.9/3.6 | 150W | +| i5-12600KF | 6 (12) | 4 | 3.7/2.8 | 4.9/3.6 | 150W | + +- support DDR4 and DDR5 (up to DDR5-4800) +- support PCIe 4.0 and 5.0 (16 PCIe 5.0 and 4 PCIe 4.0) + +The socket used is the [[https://en.wikipedia.org/wiki/LGA_1700][LGA 1700]]. Alder lake is an hybrid architecture, featuring both P-cores (performance cores) and E-cores (efficient cores). P-cores are based on the [[https://en.wikipedia.org/wiki/Golden_Cove][Golden Cove]] architecture, while the E-cores are based on the [[https://en.wikipedia.org/wiki/Gracemont_(microarchitecture)][Gracemont]] architecture. @@ -107,14 +109,14 @@ There are multiple [[https://en.wikipedia.org/wiki/Socket_AM4#Chipsets][chipset] The threadripper processors use the TR4, sTRX4 and sWRX8 sockets. ** Zen 3 Zen 3 was released in November 2020. -| model | cores | GHz (base) | GHz (boosted) | PCIe lanes | memory support | TDP | -|---------------+---------+------------+---------------+------------+----------------+------| -| ryzen 5 5600x | 6 (12) | 3.7 | 4.6 | 24 | DDR4-3200 | 65W | -| ryzen 7 5800 | 8 (16) | 3.4 | 4.6 | 24 | DDR4-3200 | 65W | -| ryzen 7 5800x | 8 (16) | 3.8 | 4.7 | 24 | DDR4-3200 | 105W | -| ryzen 9 5900 | 12 (24) | 3.0 | 4.7 | 24 | DDR4-3200 | 65W | -| ryzen 9 5900x | 12 (24) | 3.7 | 4.8 | 24 | DDR4-3200 | 105W | -| ryzen 9 5950x | 16 (32) | 3.4 | 4.9 | 24 | DDR4-3200 | 105W | +| model | cores | GHz (base) | GHz (boosted) | PCIe lanes | TDP | +|---------------+---------+------------+---------------+------------+------| +| ryzen 5 5600x | 6 (12) | 3.7 | 4.6 | 24 | 65W | +| ryzen 7 5800 | 8 (16) | 3.4 | 4.6 | 24 | 65W | +| ryzen 7 5800x | 8 (16) | 3.8 | 4.7 | 24 | 105W | +| ryzen 9 5900 | 12 (24) | 3.0 | 4.7 | 24 | 65W | +| ryzen 9 5900x | 12 (24) | 3.7 | 4.8 | 24 | 105W | +| ryzen 9 5950x | 16 (32) | 3.4 | 4.9 | 24 | 105W | - support PCIe 3.0 and PCIe 4.0 (except for the G series) -- only support DDR4 +- only support DDR4 (up to DDR4-3200) -- cgit 1.4.1 From c6cb3d5046ec75f33fea88b43eeec1b8cd658adf Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Sun, 23 Jan 2022 19:56:42 -0800 Subject: build: use more recent version of hugo --- users/fcuny/notes/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/users/fcuny/notes/Dockerfile b/users/fcuny/notes/Dockerfile index 5e2b55a..64c0f97 100644 --- a/users/fcuny/notes/Dockerfile +++ b/users/fcuny/notes/Dockerfile @@ -1,4 +1,4 @@ -FROM klakegg/hugo:0.83.1-ext-alpine-onbuild AS hugo +FROM klakegg/hugo:0.91.2-ext-alpine-onbuild AS hugo FROM pierrezemb/gostatic -- cgit 1.4.1 From 7f7a1d65a5bfe079bdff6f000359f856528b4903 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Sun, 30 Jan 2022 19:38:58 -0800 Subject: note: update list of chipset for alder lake --- .../notes/content/notes/making-sense-intel-amd-cpus.org | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/users/fcuny/notes/content/notes/making-sense-intel-amd-cpus.org b/users/fcuny/notes/content/notes/making-sense-intel-amd-cpus.org index 2394085..60b433f 100644 --- a/users/fcuny/notes/content/notes/making-sense-intel-amd-cpus.org +++ b/users/fcuny/notes/content/notes/making-sense-intel-amd-cpus.org @@ -1,7 +1,7 @@ #+TITLE: Making sense of Intel and AMD CPUs naming #+DATE: <2021-12-29 Wed> #+TAGS[]: amd intel cpu -#+toc: t +#+toc: headlines 1 * Intel ** Core @@ -41,7 +41,16 @@ A processor with the *K* suffix is made with the an unlocked clock multiplier. W *** Sockets/Chipsets For the Alder Lake generation, the supported socket is the [[https://en.wikipedia.org/wiki/LGA_1700][LGA_1700]]. -For now the only supported chipset for Alder Lake is the [[https://ark.intel.com/content/www/us/en/ark/products/218833/intel-z690-chipset.html][z690]]. +For now only supported chipset for Alder Lake are: +| feature | [[https://ark.intel.com/content/www/us/en/ark/products/218833/intel-z690-chipset.html][z690]] | [[https://www.intel.com/content/www/us/en/products/sku/218831/intel-h670-chipset/specifications.html][h670]] | [[https://ark.intel.com/content/www/us/en/ark/products/218832/intel-b660-chipset.html][b660]] | [[https://www.intel.com/content/www/us/en/products/sku/218829/intel-h610-chipset/specifications.html][h610]] | +|-----------------------------+----------+----------+---------+------| +| P and E cores over clocking | yes | no | no | no | +| memory over clocking | yes | yes | yes | no | +| DMI 4 lanes | 8 | 8 | 4 | 4 | +| chipset PCIe 4.0 lanes | up to 12 | up to 12 | up to 6 | none | +| chipset PCIe 3.0 lanes | up to 16 | up to 12 | up to 8 | 8 | +| SATA 3.0 ports | up to 8 | up to 8 | 4 | 4 | + *** Alder Lake (12th generation) | model | p-cores | e-cores | GHz (base) | GHz (boosted) | TDP | |------------+---------+---------+------------+---------------+------| -- cgit 1.4.1 From 5483be5a93faac53c2319696e1d024fd049b8a09 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Mon, 28 Mar 2022 19:50:38 -0700 Subject: convert blog to notes Separating the two sites so I can customize them differently. --- users/fcuny/notes/Makefile | 4 +- users/fcuny/notes/config.toml | 22 +---- users/fcuny/notes/fly.toml | 7 +- users/fcuny/notes/layouts/_default/baseof.html | 1 + users/fcuny/notes/layouts/_default/single.html | 14 --- users/fcuny/notes/layouts/index.atom.xml | 2 +- users/fcuny/notes/layouts/index.html | 17 ++-- users/fcuny/notes/layouts/partials/footer.html | 32 +++++++ users/fcuny/notes/layouts/partials/header.html | 12 ++- users/fcuny/notes/static/CNAME | 2 +- users/fcuny/notes/static/css/custom.css | 120 ++++++++++++------------- 11 files changed, 117 insertions(+), 116 deletions(-) create mode 100644 users/fcuny/notes/layouts/partials/footer.html diff --git a/users/fcuny/notes/Makefile b/users/fcuny/notes/Makefile index 5414dde..4644ac3 100644 --- a/users/fcuny/notes/Makefile +++ b/users/fcuny/notes/Makefile @@ -1,6 +1,6 @@ DOCKER := DOCKER_BUILDKIT=1 docker DOCKER_BUILD_ARGS := -DOCKER_IMAGE := fcuny/fcuny.net +DOCKER_IMAGE := fcuny/notes.fcuny.net DOCKER_IMAGE_REF := $(shell git rev-parse HEAD) DOCKERFILE := Dockerfile PROJECT_DIR := $(realpath $(CURDIR)) @@ -18,7 +18,7 @@ worktree-clean: deploy: worktree-clean docker-build @echo "Deploying to fly ..." flyctl deploy - @git tag -a --message $$(flyctl info -j |jq -r '.App | "fcuny.net/v\(.Version)"') $$(flyctl info -j |jq -r '.App | "fcuny.net/v\(.Version)"') + @git tag -a --message $$(flyctl info -j |jq -r '.App | "notes.fcuny.net/v\(.Version)"') $$(flyctl info -j |jq -r '.App | "notes.fcuny.net/v\(.Version)"') @git push origin --all @git push origin --tags diff --git a/users/fcuny/notes/config.toml b/users/fcuny/notes/config.toml index 1fe49bc..6ee3e63 100644 --- a/users/fcuny/notes/config.toml +++ b/users/fcuny/notes/config.toml @@ -1,11 +1,12 @@ -baseURL = "https://fcuny.net/" +baseURL = "https://notes.fcuny.net/" languageCode = "en-us" -title = "Franck's rambling" +title = "Franck's notes" publishDir = "docs" enableGitInfo = true [params] homeText = "A collection of notes" + mainSections = ['notes'] [author] name = "Franck Cuny" @@ -15,29 +16,14 @@ enableGitInfo = true tag = "tags" [permalinks] - blog = "/blog/:slug/" notes = "/notes/:slug/" tags = "/tags/:slug/" [menu] - [[menu.main]] - identifier = "articles" - name = "blog" - title = "articles" - url = "/blog/" - weight = 110 - - [[menu.main]] - identifier = "notes" - name = "notes" - title = "notes" - url = "/notes/" - weight = 120 - [[menu.main]] identifier = "RSS" name = "RSS" - title = "RSS" + title = "~/notes/feed" url = "/feed.xml" weight = 130 diff --git a/users/fcuny/notes/fly.toml b/users/fcuny/notes/fly.toml index 46468c1..4db1311 100644 --- a/users/fcuny/notes/fly.toml +++ b/users/fcuny/notes/fly.toml @@ -1,13 +1,10 @@ -# fly.toml file generated for fcunynet on 2021-06-20T10:01:50-07:00 +# fly.toml file generated for notes-fcunynet on 2022-03-28T19:44:54-07:00 -app = "fcunynet" +app = "notes-fcunynet" kill_signal = "SIGINT" kill_timeout = 5 -[build] - builtin = "hugo-static" - [env] [experimental] diff --git a/users/fcuny/notes/layouts/_default/baseof.html b/users/fcuny/notes/layouts/_default/baseof.html index 0c72fb1..410e2bc 100644 --- a/users/fcuny/notes/layouts/_default/baseof.html +++ b/users/fcuny/notes/layouts/_default/baseof.html @@ -6,5 +6,6 @@
    {{ block "main" . }}{{ end }}
    + {{- partial "footer.html" . -}} diff --git a/users/fcuny/notes/layouts/_default/single.html b/users/fcuny/notes/layouts/_default/single.html index 7a85a05..7f594ad 100644 --- a/users/fcuny/notes/layouts/_default/single.html +++ b/users/fcuny/notes/layouts/_default/single.html @@ -31,24 +31,10 @@ {{ end }}
    -{{ if .Params.toc }} -
    - Table of contents - {{ .TableOfContents }} -
    -{{ end }} -
    {{ .Content }}
    -{{ if .Params.toc }} -
    - Table of contents - {{ .TableOfContents }} -
    -{{ end }} - {{ end }} diff --git a/users/fcuny/notes/layouts/index.atom.xml b/users/fcuny/notes/layouts/index.atom.xml index 1d73f9b..e4b014b 100644 --- a/users/fcuny/notes/layouts/index.atom.xml +++ b/users/fcuny/notes/layouts/index.atom.xml @@ -8,7 +8,7 @@ {{.}}{{end}} {{end}} Hugo -- gohugo.io - {{ range where (first 10 (where .Site.Pages "Section" "blog")) "Params.hidden" "ne" "true" }} + {{ range where (first 10 (where .Site.Pages "Section" "notes")) "Params.hidden" "ne" "true" }} {{ `<![CDATA[` | safeHTML }}{{ .Title }}]]> diff --git a/users/fcuny/notes/layouts/index.html b/users/fcuny/notes/layouts/index.html index 2ab8c40..a340d3d 100644 --- a/users/fcuny/notes/layouts/index.html +++ b/users/fcuny/notes/layouts/index.html @@ -4,15 +4,16 @@

    {{ .Site.Home.Title }}

    -

    I'm an engineer currently on a break. Previously I was a Site Reliability Engineer working on Twitter's compute platform.

    +

    This is my collection of notes.

    -

    Contact

    - +

    Notes

    +
      + {{- $pages := where site.RegularPages "Type" "in" site.Params.mainSections }} + {{ range $pages }} + {{- $fmt := "2006-01-02" }} +
    • , {{ .Title }}
    • + {{ end }} +
    diff --git a/users/fcuny/notes/layouts/partials/footer.html b/users/fcuny/notes/layouts/partials/footer.html new file mode 100644 index 0000000..e2bf7ab --- /dev/null +++ b/users/fcuny/notes/layouts/partials/footer.html @@ -0,0 +1,32 @@ + diff --git a/users/fcuny/notes/layouts/partials/header.html b/users/fcuny/notes/layouts/partials/header.html index dede0ae..fe90497 100644 --- a/users/fcuny/notes/layouts/partials/header.html +++ b/users/fcuny/notes/layouts/partials/header.html @@ -1,12 +1,10 @@
    -
    diff --git a/users/fcuny/notes/static/CNAME b/users/fcuny/notes/static/CNAME index 7398ba2..5f43d63 100644 --- a/users/fcuny/notes/static/CNAME +++ b/users/fcuny/notes/static/CNAME @@ -1 +1 @@ -fcuny.net \ No newline at end of file +notes.fcuny.net diff --git a/users/fcuny/notes/static/css/custom.css b/users/fcuny/notes/static/css/custom.css index ae6d674..70ce618 100644 --- a/users/fcuny/notes/static/css/custom.css +++ b/users/fcuny/notes/static/css/custom.css @@ -1,37 +1,40 @@ body { font-family: sans-serif; - font-size: 1.125em; - line-height: 1.5; - color: #37474f; + font-size: 1em; + line-height: 1.8em; + color: #0e0e0b; margin: 1em auto; padding: 0 0.55em; - max-width: 45rem; -} - -@media screen and (min-width:58rem) { - body, - main { - max-width:calc(45rem + 15rem); - } - main { - display: flex; - } + max-width: 50rem; } h1 { + color: #0e0e0b; font-size: 2rem; margin-top: 1em; margin-bottom: 0.34em; } -h2 {margin-top: 1.25em; margin-bottom: 0.41em} -h3 {margin-top: 1.5em; margin-bottom: 0.5em} +h2, h3 { + border-bottom: 1px solid #eee; + font-style: italic; +} +h2 { + margin-top: 1.25em; + margin-bottom: 0.41em; + font-size: 1.4rem; +} +h3 { + margin-top: 1.5em; + margin-bottom: 0.5em; + font-size: 1.2rem; +} hr{ color:#000111; background-color:#000111; border:none; - height:2px + height:1px } a { @@ -64,10 +67,12 @@ p code { color: black; background-color: #eee; padding: 0 0.2rem; + font-size: 1.1em; } pre { font-family: monospace; + font-size: 1.1em; margin: 0; word-wrap: normal; padding: 0.8em; @@ -130,20 +135,15 @@ blockquote { } nav { - width: 100%; padding-right: 10px; + font-size: 1.4em; display: flex; + font-family: monospace; justify-content: space-between; align-items: center; padding-top: 0.5rem; } -@media screen and (min-width:58rem) { - nav { - max-width: calc(45rem + 15rem); - } -} - .nav-links { list-style: none; display: flex; @@ -151,51 +151,51 @@ nav { .navbar a { display: inline-block; - padding-right: 10px; + text-decoration: none; +} + +.navbar a:hover { + background-color: #b72d2d; + color: #fafafa; + text-decoration: none; +} + +.nav-bold { + font-weight: 700; + color: #b72d2d; + text-decoration: none; } article { - max-width: 45rem; + text-align: justify; } -#toc {display: none} +.post-permalink { + list-style: none; + margin-left: -20px; +} -#toc_small { - font-size: 0.9rem; - margin-bottom: 2rem; - margin-top: 2rem; +.post-date { + font-family: monospace; + font-weight: 400; + font-size: 1.1em; } -@media screen and (min-width:58rem) { - #toc_small {display: none;} + +footer { + border-top: 2px solid #eee; + margin-top: 2em; + display: flex; + flex-direction: row; + justify-content: left; + align-items: left; } -summary { - display:flex; - flex-direction:column; +footer a, footer a:link, footer a:focus, footer a:active, footer a:hover { + color: black; + text-decoration: none; + padding: 5px; } -#TableOfContents > ul, #TableOfContents > ul > li > ul { - list-style: none; - margin: 0; - padding: 0; -} - -#TableOfContents li {margin-bottom: 1rem;} - -@media screen and (min-width:58rem) { - #toc { - padding-left: 1rem; - padding-top: 4.5rem; - font-size: 0.9rem; - display:block; - position:sticky; - top:0; - align-self:flex-start; - max-width:15rem; - z-index:1; - } - #TableOfContents { - border-left: 3px solid #eee; - padding-left: 1rem; - } +footer a:not(:first-child) { + margin-left: 15px; } -- cgit 1.4.1 From fe35032d82c4b70d2b43fadbd3306ef3f6615cd2 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Mon, 28 Mar 2022 19:51:05 -0700 Subject: delete some content --- .../content/blog/git-link-and-sourcegraph.org | 49 --------- .../notes/content/blog/google-doc-failure.org | 56 ---------- users/fcuny/notes/content/blog/leaving-twitter.org | 10 -- .../notes/content/blog/tailscale-docker-https.org | 121 --------------------- users/fcuny/notes/static/profile.jpg | Bin 895450 -> 0 bytes users/fcuny/notes/static/resume.pdf | Bin 46970 -> 0 bytes users/fcuny/notes/static/ssh.pub.sig | 2 - 7 files changed, 238 deletions(-) delete mode 100644 users/fcuny/notes/content/blog/git-link-and-sourcegraph.org delete mode 100644 users/fcuny/notes/content/blog/google-doc-failure.org delete mode 100644 users/fcuny/notes/content/blog/leaving-twitter.org delete mode 100644 users/fcuny/notes/content/blog/tailscale-docker-https.org delete mode 100644 users/fcuny/notes/static/profile.jpg delete mode 100644 users/fcuny/notes/static/resume.pdf delete mode 100644 users/fcuny/notes/static/ssh.pub.sig diff --git a/users/fcuny/notes/content/blog/git-link-and-sourcegraph.org b/users/fcuny/notes/content/blog/git-link-and-sourcegraph.org deleted file mode 100644 index 3ab5f4b..0000000 --- a/users/fcuny/notes/content/blog/git-link-and-sourcegraph.org +++ /dev/null @@ -1,49 +0,0 @@ -#+TITLE: emacs' git-link and sourcegraph -#+TAGS[]: emacs git -#+DATE: <2021-08-24 Tue> - -I use [[https://sourcegraph.com/][sourcegraph]] for searching code, and I sometimes need to share a link to the source code I'm looking at in a buffer. For this, the package [[https://github.com/sshaw/git-link][=git-link=]] is great. - -To integrate sourcegraph and =git-link=, the [[https://github.com/sshaw/git-link#sourcegraph][documentation]] recommends adding a remote entry named =sourcegraph= in the repository, like this: - -#+begin_src sh -git remote add sourcegraph https://sourcegraph.com/github.com/sshaw/copy-as-format -#+end_src - -The next time you run =M-x git-link= in a buffer, it will use the URL associated with that remote. That's works great, except that now you need to add this for every repository. Instead, for my usage, I came up with the following solution: - -#+begin_src elisp -(use-package git-link - :ensure t - :after magit - :bind (("C-c g l" . git-link) - ("C-c g a" . git-link-commit)) - :config - (defun fcuny/get-sg-remote-from-hostname (hostname) - (format "sourcegraph.<$domain>.<$tld>/%s" hostname)) - - (defun fcuny/git-link-work-sourcegraph (hostname dirname filename _branch commit start end) - ;;; For a given repository, build the proper link for sourcegraph. - ;;; Use the default branch of the repository instead of the - ;;; current one (we might be on a feature branch that is not - ;;; available on the remote). - (require 'magit-branch) - (let ((sg-base-url (fcuny/get-sg-remote-from-hostname hostname)) - (main-branch (magit-main-branch))) - (git-link-sourcegraph sg-base-url dirname filename main-branch commit start end))) - - (defun fcuny/git-link-commit-work-sourcegraph (hostname dirname commit) - (let ((sg-base-url (fcuny/get-sg-remote-from-hostname hostname))) - (git-link-commit-sourcegraph sg-base-url dirname commit))) - - (add-to-list 'git-link-remote-alist '("twitter" fcuny/git-link-work-sourcegraph)) - (add-to-list 'git-link-commit-remote-alist '("twitter" fcuny/git-link-commit-work-sourcegraph)) - - (setq git-link-open-in-browser 't)) -#+end_src - -We use different domains to host various git repositories at work (e.g. =git.$work=, =gitfoo.$work=, etc). Each of them map to a different URI for sourcegraph (e.g. =sourcegraph.$work/gitfoo=). - -=git-link-commit-remote-alist= is an [[https://www.gnu.org/software/emacs/manual/html_node/elisp/Association-Lists.html][association list]] that takes a regular expression and a function. The custom function receives the hostname for the remote repository, which is then used to generate the URI for our sourcegraph instance. I then call =git-link-sourcegraph= replacing the hostname with the URI for sourcegraph. - -Now I can run =M-x git-link= in any repository where the host for the origin git repository matches =twitter= without having to setup the custom remote first. diff --git a/users/fcuny/notes/content/blog/google-doc-failure.org b/users/fcuny/notes/content/blog/google-doc-failure.org deleted file mode 100644 index b4d449d..0000000 --- a/users/fcuny/notes/content/blog/google-doc-failure.org +++ /dev/null @@ -1,56 +0,0 @@ -#+TITLE: Google Doc Failures -#+TAGS[]: documentation process -#+DATE: <2021-04-11 Sun> - -In most use cases, Google Doc is an effective tool to create "write once, read never" documents. - -* Convenience -Google Doc (GDoc from now on) is the most common way of writing and sharing documents at my current job. It's very easy to start a new document, even more since we can now point our browser to https://doc.new and start typing right away. - -Like most of my co-workers, I use it frequently during the day. Some of these documents are draft for some communication that I want others to review before I share with a broader audience; it can be a [[https://en.wikipedia.org/wiki/Request_for_Comments][Request For Comments]] for a project; meeting notes for others to read; information that I need to capture during an incident or a debugging session; interviews notes; etc. - -I would not be surprised if the teams I work closely with generate 50 new documents each week. -* ETOOMANYTABS -I have a tendency of having hundreds of open tabs in my browser during the week. A majority of these tabs are GDocs, and I think this is one of the true failure of the product. Why do I have so many tabs ? There's mainly two reasons. - -The first reason is a problem with Chrome's UX itself: it happily let me open the same URL as many times as I want in as many tabs, instead of sending me to the already opened tab if the document is loaded. It's not uncommon that I find the same document opened in 5 different tabs. - -The second reason, and it's the most important one, I know that if I need to read or comment on a doc and I close the tab, I'll likely never find that document again, or will completely forget about it. -* Discoverability -In 'the old days', you'd start a new document in Word or LibreOffice, and as you hit "save" for the first time, you've two decisions to make: how am I going to name that file, and where am I going to save it on disk. - -With GDoc these questions don't have to be answered, you don't have to name the file, and it does not matter where it lives. I've likely hundreds of docs named 'untitled' in my "drive". I also don't have to think about where they will live, because they are saved automatically for me. I'm sure there's hundreds of studies that show that these two simple steps are actually complex for many users and creates useless friction (in which folder do I store it; should I organize the docuemnts by team, years, projects; do I name it with the date and the current project; etc.). - -GDoc being a Google product, it seems pretty obvious that they would come up with a better solution: let's not organize in a strict hierarchy these files, and let's instead search for them. - -Unfortunately, GDoc's search is really poor (and I'm being kind). By default most of us start by looking for some words we know are in the doc, maybe even in the title. But when working on a multiple projects that are related to the same technology, you suddenly get hundreds of documents matching your query. It's unclear how the returned set is ordered (by date ? by author ? by some scoring that is invisible to me ?). - -You can also search by owners, but here is another annoying bit: I think about owner as author, so I usually type =author:foo= before realizing it does not work. And that implies you already know who's the owner of the document. In the case of TDDs (Technical Design Document), I might know which team is behind it, but rarely who's the actual author. - -I could search for the title, but I rarely remember or know the name of the document I'm looking for. I could also be looking by keywords, but when working on a project with tens of related documents, you have to open all the returned docs to see which one is the correct one. - -And then what about new members joining your the team ? They don't know which docs exist, who wrote them, and how they are named. They end up searching and hoping that something good will be returned. -* Workflows -More and more we create workflows around these documents: some of the docs are TDDs that are going through reviews; others are decision documents that require input from multiple teams and are pending approval; others are road map documents that also go through some review process. - -As a result we create templates for all kind of documents, with usually something like "draft → reviews → approved/rejected" at the top. We expect the owner of the doc to mark in bold what's the status of the doc to help the reader understand in what state the document is. It's difficult to keep track of open actions and comments. Yes, there's a way to get a list of all of them, but it's not in an obvious place. - -As a result, some engineers in my team built an external dashboard with swim lanes which captures the state of a document. We add new document with their URLs, add who are the reviewers, and we move the doc between the lanes. Now we have to operate a service and a database to keep track of the status of documents in GDoc. -* Alternatives -When it comes to technical document, I find that [[https://caitiem.com/2020/03/29/design-docs-markdown-and-git/][approach]] much more interesting. Some open source projects have adopted a similar workflow ([[https://github.com/kubernetes/enhancements/tree/master/keps][Kubernetes]], [[https://github.com/golang/proposal][Go]]). - -A new document starts its life as a text file (using what ever markup language your team/company prefers). The document is submitted for review, and the people who need to be consulted are added as reviewers. They can now comment on the document, the author can address them, mark them as resolved. It's clear in which state the document is: it's either in review, committed, or rejected. With this approach you also end up with a clear history, as time moves on you can amend the document by submitting a change, and the change goes through the same process. - -New comers will find the document in the repository, and if they want to see the conversation they can open the review associated with the original change. They can also see how the document evolved over time. It's also easy to publish these documents on an internal website, using a static site generator for example. - -One of the thing that I think are critical, is that all of that is done using the tools the engineers are already using for their day to day job: a text editor, a version control system, a code review tool. - -There's obviously challenges with this approach too: -+ *it's more heavy handed*: not every one likes to write in a text editor using a markup language. It can requires some time to learn or get used to the syntax -+ *it's harder to integrate schema / visuals*: but having them checked in in the repository also improves the discoverability - -It's also true that no all documents suffer the same challenges for discoverability: -+ meeting notes are usually linked to meeting invites (however if you were not part of the meeting, you end up with the same challenges to discover them) -+ drafts for communications are usually not relevant once the communication has been sent -+ interview notes are usually transferred to some tools for HR when the feedback is submitted - diff --git a/users/fcuny/notes/content/blog/leaving-twitter.org b/users/fcuny/notes/content/blog/leaving-twitter.org deleted file mode 100644 index 9bc5027..0000000 --- a/users/fcuny/notes/content/blog/leaving-twitter.org +++ /dev/null @@ -1,10 +0,0 @@ -#+TITLE: Leaving Twitter -#+DATE: <2022-01-15 Sat> - -January 7th 2022 was my last day at Twitter, after more than 7 years at the company. - -The first few years I worked as an SRE in the core-storage team, with the PUB/SUB and key-value store teams. - -I spend the last four years working with the Compute team, both maintaining and operating our (very large) Aurora/Mesos clusters, and also working on the adoption of kubernetes, both for our data centers and for the cloud. Working with Compute was extremely fulfilling to me, as I worked closely with our hardware engineering and kernel/operating system teams. - -During these 7 years, I was constantly pushed by my coworkers to grow, to step up to new challenges, and I learned a tremendous amount about running large scale distributed systems. I'm extremely glad for that experience, it was by far the most interesting and challenging job I've ever had so far. diff --git a/users/fcuny/notes/content/blog/tailscale-docker-https.org b/users/fcuny/notes/content/blog/tailscale-docker-https.org deleted file mode 100644 index 14e4cf1..0000000 --- a/users/fcuny/notes/content/blog/tailscale-docker-https.org +++ /dev/null @@ -1,121 +0,0 @@ -#+TITLE: Tailscale, Docker and HTTPS -#+TAGS[]: docker tailscale traefik -#+DATE: <2021-12-29 Wed> - -I run a number of services in my home network. For the majority of these services, I don't want to make them available on the internet, I want to only be able to access them when I'm on my home network. However, sometimes I'm not at home and I still want to access them. So far I've been using plain [[https://www.wireguard.com/][wireguard]] to achieve this. While the initial configuration for wireguard is pretty simple, it starts to be a bit more cumbersome as I add more hosts/containers. It's also not easy to share keys with other folks if I want to give access to some of the machines or services. For that reason I decided to give a look at [[https://tailscale.com/][tailscale]]. - -There's already a lot of articles about tailscale and how to use and configure it. Their [[https://tailscale.com/kb/][documentation]] is also pretty good, so I won't cover the initial setup. - -As stated above, I want to access some of my services that are running as docker containers from anywhere. For web services, I want to use them through HTTPS, with a valid certificate, and without having to remember on which port the service it's listening. I also don't want to setup a PKI in my home lab for that (and I'm also not interested in configuring split DNS), and instead I prefer to use [[https://letsencrypt.org/][let's encrypt]] with a proper subdomain that is unique for each service. - -The [[https://tailscale.com/kb/1054/dns/][tailscale documentation]] has two suggestions for this: -- use their magicDNS feature / split DNS -- setup a subdomain on a public domain - -Since I already have a public domain that I use for my home network, I decided to go with the second option (I'm also uncertain how to achieve my goal using magicDNS without running tailscale inside the container). - -The public domain I'm using is managed through [[https://cloud.google.com/dns/docs/tutorials/create-domain-tutorial][Google Cloud Domain]]. I create a new record for the services I want to run (for example, ~dash~ for my instance of grafana), using the IP address from the tailscale node the service runs on (e.g. 100.83.51.12). - -For routing the traffic I use [[https://traefik.io/][traefik]]. The configuration for traefik looks like this: -#+begin_src yaml -global: - sendAnonymousUsage: false -providers: - docker: - exposedByDefault: false -entryPoints: - http: - address: ":80" - https: - address: ":443" -certificatesResolvers: - dash: - acme: - email: franck@fcuny.net - storage: acme.json - dnsChallenge: - provider: gcloud -#+end_src - -The important bit here is the ~certificatesResolvers~ part. I'll be using the [[https://doc.traefik.io/traefik/user-guides/docker-compose/acme-dns/][dnsChallenge]] instead of the [[https://doc.traefik.io/traefik/user-guides/docker-compose/acme-http/][httpChallenge]] to obtain the certificate from let's encrypt. For this to work, I need to specify the ~provider~ to be [[https://go-acme.github.io/lego/dns/gcloud/][gcloud]]. I'll also need a service account (see [[https://cloud.google.com/docs/authentication/production#providing_credentials_to_your_application][this doc]] to create it). I run ~traefik~ in a docker container, and the ~systemd~ unit file is below. The required bits for using the ~dnsChallenge~ with ~gcloud~ are: -- the environment variable ~GCP_SERVICE_ACCOUNT_FILE~: it contains the credentials so that ~traefik~ can update the DNS record for the challenge -- the environment variable ~GCP_PROJECT~: the name of the GCP project -- mounting the service account file inside the container (I store it on the host under ~/data/containers/traefik/config/sa.json~) - -#+begin_src systemd -[Unit] -Description=traefik proxy -Documentation=https://doc.traefik.io/traefik/ -After=docker.service -Requires=docker.service - -[Service] -Restart=on-failure -ExecStartPre=-/usr/bin/docker kill traefik -ExecStartPre=-/usr/bin/docker rm traefik -ExecStartPre=/usr/bin/docker pull traefik:latest - -ExecStart=/usr/bin/docker run \ - -p 80:80 \ - -p 9080:8080 \ - -p 443:443 \ - --name=traefik \ - -e GCE_SERVICE_ACCOUNT_FILE=/var/run/gcp-service-account.json \ - -e GCE_PROJECT= gcp-super-project \ - --volume=/data/containers/traefik/config/acme.json:/acme.json \ - --volume=/data/containers/traefik/config/traefik.yml:/etc/traefik/traefik.yml:ro \ - --volume=/data/containers/traefik/config/sa.json:/var/run/gcp-service-account.json \ - --volume=/var/run/docker.sock:/var/run/docker.sock:ro \ - traefik:latest -ExecStop=/usr/bin/docker stop traefik - -[Install] -WantedBy=multi-user.target -#+end_src - -As an example, I run [[https://grafana.com/][grafana]] on my home network to view metrics from the various containers / hosts. Let's pretend I use ~example.net~ as my domain. I want to be able to access ~grafana~ via https://dash.example.net. Here's the ~systemd~ unit configuration I use for this: - -#+begin_src systemd -[Unit] -Description=Grafana in a docker container -Documentation=https://grafana.com/docs/ -After=docker.service -Requires=docker.service - -[Service] -Restart=on-failure -RuntimeDirectory=grafana -ExecStartPre=-/usr/bin/docker kill grafana-server -ExecStartPre=-/usr/bin/docker rm grafana-server -ExecStartPre=-/usr/bin/docker pull grafana/grafana:latest - -ExecStart=/usr/bin/docker run \ - -p 3000:3000 \ - -e TZ='America/Los_Angeles' \ - --name grafana-server \ - -v /data/containers/grafana/etc/grafana:/etc/grafana \ - -v /data/containers/grafana/var/lib/grafana:/var/lib/grafana \ - -v /data/containers/grafana/var/log/grafana:/var/log/grafana \ - --user=grafana \ - --label traefik.enable=true \ - --label traefik.http.middlewares.grafana-https-redirect.redirectscheme.scheme=https \ - --label traefik.http.middlewares.grafana-https-redirect.redirectscheme.permanent=true \ - --label traefik.http.routers.grafana-http.rule=Host(`dash.example.net`) \ - --label traefik.http.routers.grafana-http.entrypoints=http \ - --label traefik.http.routers.grafana-http.service=grafana-svc \ - --label traefik.http.routers.grafana-http.middlewares=grafana-https-redirect \ - --label traefik.http.routers.grafana-https.rule=Host(`dash.example.net`) \ - --label traefik.http.routers.grafana-https.entrypoints=https \ - --label traefik.http.routers.grafana-https.tls=true \ - --label traefik.http.routers.grafana-https.tls.certresolver=dash \ - --label traefik.http.routers.grafana-https.service=grafana-svc \ - --label traefik.http.services.grafana-svc.loadbalancer.server.port=3000 \ - grafana/grafana:latest - -ExecStop=/usr/bin/docker stop unifi-controller - -[Install] -WantedBy=multi-user.target -#+end_src - -Now I can access my grafana instance via HTTPS (and http://dash.example.net would redirect to HTTPS) while my tailscale interface is up on the machine I'm using (e.g. my desktop or my phone). diff --git a/users/fcuny/notes/static/profile.jpg b/users/fcuny/notes/static/profile.jpg deleted file mode 100644 index 5417f13..0000000 Binary files a/users/fcuny/notes/static/profile.jpg and /dev/null differ diff --git a/users/fcuny/notes/static/resume.pdf b/users/fcuny/notes/static/resume.pdf deleted file mode 100644 index 123b9ef..0000000 Binary files a/users/fcuny/notes/static/resume.pdf and /dev/null differ diff --git a/users/fcuny/notes/static/ssh.pub.sig b/users/fcuny/notes/static/ssh.pub.sig deleted file mode 100644 index 88f4f3e..0000000 --- a/users/fcuny/notes/static/ssh.pub.sig +++ /dev/null @@ -1,2 +0,0 @@ -ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC1rWKrdSHxlAZnRv1F5jUsHgXSNmr1KzllWEn+JqA7p3zxmSEPBbfIUGxSzkFIQrSbKizJLdH6hGA8DcIm+e+ldQ2RYOdiYBxIkPm+aHB6dw7QGNbnSSdkr9gKThy65j0YOOcmuDExjqxfq6O/8AVstmPH36sUXEIks5F/+WiF+5ehzoJVFqClB1di6w1lml86d0ShrUacgM/ieFPe1vKrzW8ZOM+LaUoGWBTLla1y6UkIqnb7OinmgPu6QAzF6GA7tYJMoHkyV7Axzc2j1/VxVIrUrfY4b0k8lGAzi2GfByq+fXEHzePbaqi8Cy8Trn9eN/ls1WBMUQfSChQi3tM2Vx2BuiOpx/QkXsdgqwe7bTCijcQS7GoREL1qd8tR9sWWd4WMPUiC9kmzvyja5F39xHPgm0A5MtYY7GvQaUPbtBc6g8YuFLLnkqFVEKHSLFiGYP5jIDNvMd5rSSsBUrepCIzWdpprwnKxAjebw5Cyl5p/0MY2zppQRW7AZXehQa7Bv+OClbutEjBa+ioeUxBhezu2rB61XSenTbbUVB5DncD8ceD5AbL9aFz/Bcw6q0kAOGmR1G1MOLgxVHlqcnI5x0E1K2WMKWgQb+1BMek1p5+l3xWNDF4URhLqLupnP5CMrK9ifBOe/76zqyMVrA/mc6tNC58KHhME1IynC1zaLw== franck@fcuny.net -ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDg2P92WEDsI2mn2QEk1uSg9MKbj7JgE3pEfI6bWo5fbcnUbVGGZxafK0e7rnSfgWHHyhVeH8W4fQfPb+Iyt/9GLkKEq3aqShVEq+h2FXu7iqdrsANp27UnanuHuL2MzQY041jAiqrmJUBzCedJfnmlydMoo0TdK2Hxzu3cLjaI0VhEySo8c/NKuUB6uIdfuA8dkvIdP2O0owpLoKOGDdsDTedhGiN+mQgB+Z2+oYM4XOVmcMY6/f2cxXRBCkktcy9s451NqhjmsVB/L1n1GjJlOk+mQ6wGjR7KN7bgJtBC2sE/WuiZL+pmOlu3dF9vLyWw7iPHj7YvLlK6gztBHZT2v694Thqd9yb/ESOFfyrcujZu0qkRhjPYOz7VJC9F9PmTIVW6Zk4kknQzh9pmKWJiDNZEaQ88cXGn+HBj9aZ/fj3h6TyowtLZkXWebNcUHFMquuTMpJigFq+bSvus5Ad+v5L185CNa/9o3P1TNAft4YF3IR0WfJ08aNcFBYkiOXivpuTmbMzuRKUQ/5dhAlOuqTSzDDEFa6Q9MMo2oorNcZhjrfKq/T7gKXKqG8DuWNGKsM1ZduduCjunuWJw9SjUHVEwW2NtNHcvRWP19HFy/+T5rWDBEUUSYQba34xnvMRa9NZLeqGC+korXCUjxjQEM8aFpCUmqdwY6QBgpyGAbw== franck@fcuny.net -- cgit 1.4.1 From a92df1fcec2d419f4352c56585f3cd1a871fc87c Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Sun, 3 Apr 2022 17:50:25 -0700 Subject: site: remove unnecessary elements --- users/fcuny/notes/config.toml | 8 --- users/fcuny/notes/layouts/_default/baseof.html | 1 - users/fcuny/notes/layouts/index.atom.xml | 24 --------- users/fcuny/notes/layouts/index.html | 16 +++--- users/fcuny/notes/layouts/partials/footer.html | 32 ------------ users/fcuny/notes/layouts/partials/head.html | 3 +- users/fcuny/notes/layouts/partials/header.html | 5 -- users/fcuny/notes/static/css/custom.css | 67 ++++++++++++-------------- 8 files changed, 40 insertions(+), 116 deletions(-) delete mode 100644 users/fcuny/notes/layouts/index.atom.xml delete mode 100644 users/fcuny/notes/layouts/partials/footer.html diff --git a/users/fcuny/notes/config.toml b/users/fcuny/notes/config.toml index 6ee3e63..cb488ee 100644 --- a/users/fcuny/notes/config.toml +++ b/users/fcuny/notes/config.toml @@ -19,14 +19,6 @@ enableGitInfo = true notes = "/notes/:slug/" tags = "/tags/:slug/" -[menu] - [[menu.main]] - identifier = "RSS" - name = "RSS" - title = "~/notes/feed" - url = "/feed.xml" - weight = 130 - [markup] [markup.tableOfContents] startLevel = 1 diff --git a/users/fcuny/notes/layouts/_default/baseof.html b/users/fcuny/notes/layouts/_default/baseof.html index 410e2bc..0c72fb1 100644 --- a/users/fcuny/notes/layouts/_default/baseof.html +++ b/users/fcuny/notes/layouts/_default/baseof.html @@ -6,6 +6,5 @@
    {{ block "main" . }}{{ end }}
    - {{- partial "footer.html" . -}} diff --git a/users/fcuny/notes/layouts/index.atom.xml b/users/fcuny/notes/layouts/index.atom.xml deleted file mode 100644 index e4b014b..0000000 --- a/users/fcuny/notes/layouts/index.atom.xml +++ /dev/null @@ -1,24 +0,0 @@ - - {{ .Site.Title }} - - - {{ .Permalink }}{{ with .Site.Author.name }} - - {{.}}{{ with $.Site.Author.email }} - {{.}}{{end}} - {{end}} - Hugo -- gohugo.io - {{ range where (first 10 (where .Site.Pages "Section" "notes")) "Params.hidden" "ne" "true" }} - - {{ `<![CDATA[` | safeHTML }}{{ .Title }}]]> - - {{ .Permalink }}{{ with .Site.Params.Author }} - - {{.}} - {{end}} - {{- $fmt := "2006-01-02T15:04:05-07:00" }} - {{ .Date.Format $fmt | safeHTML }} - {{ ` - - {{ end }} - diff --git a/users/fcuny/notes/layouts/index.html b/users/fcuny/notes/layouts/index.html index a340d3d..8ddc67d 100644 --- a/users/fcuny/notes/layouts/index.html +++ b/users/fcuny/notes/layouts/index.html @@ -2,16 +2,18 @@
    -

    {{ .Site.Home.Title }}

    + A place to collect random notes. -

    This is my collection of notes.

    - -

    Notes

    -
      +
        {{- $pages := where site.RegularPages "Type" "in" site.Params.mainSections }} {{ range $pages }} - {{- $fmt := "2006-01-02" }} -
      • , {{ .Title }}
      • +
      • + {{ .Title }} + {{ range $idx, $tag := .Params.tags }} + {{ $tag }} + {{ end }} +
      • + {{ end }}
      diff --git a/users/fcuny/notes/layouts/partials/footer.html b/users/fcuny/notes/layouts/partials/footer.html deleted file mode 100644 index e2bf7ab..0000000 --- a/users/fcuny/notes/layouts/partials/footer.html +++ /dev/null @@ -1,32 +0,0 @@ - diff --git a/users/fcuny/notes/layouts/partials/head.html b/users/fcuny/notes/layouts/partials/head.html index 7de4fd4..6e5a6fb 100644 --- a/users/fcuny/notes/layouts/partials/head.html +++ b/users/fcuny/notes/layouts/partials/head.html @@ -6,12 +6,11 @@ {{ $css := "/css/custom.css" }} - - + {{ .Title }} diff --git a/users/fcuny/notes/layouts/partials/header.html b/users/fcuny/notes/layouts/partials/header.html index fe90497..798463c 100644 --- a/users/fcuny/notes/layouts/partials/header.html +++ b/users/fcuny/notes/layouts/partials/header.html @@ -1,10 +1,5 @@
      diff --git a/users/fcuny/notes/static/css/custom.css b/users/fcuny/notes/static/css/custom.css index 70ce618..e02631a 100644 --- a/users/fcuny/notes/static/css/custom.css +++ b/users/fcuny/notes/static/css/custom.css @@ -1,11 +1,16 @@ +html { + margin-left: 2em; + margin-right: 0em; + margin-top: 1em; +} + body { - font-family: sans-serif; - font-size: 1em; - line-height: 1.8em; + font-family: monospace; + font-size: 1.15em; + line-height: 1.5em; color: #0e0e0b; - margin: 1em auto; padding: 0 0.55em; - max-width: 50rem; + max-width: 60rem; } h1 { @@ -87,9 +92,8 @@ pre { } #meta_tags { - border-radius: 8px; padding: 0 .5rem; - font-size: 0.9rem; + font-size: 0.8rem; border: 2px solid #eee; background-color: #eee; } @@ -102,28 +106,30 @@ pre { #meta_date { font-style: italic; - font-size: 0.9rem; + font-size: 0.8rem; } table { width: 100%; - border-spacing: 0px; + border-spacing: px; outline: none; } td{ - padding-right: 0.7em; + padding-left: 0.4em; padding-top: 0.4em; padding-bottom: 0.4em; } thead { - color: #000; - font-style: bold; - text-align: left; + color: #000; + font-style: bold; + text-align: left; } table, th, td { - font-family: monospace; - color: #000; + font-family: monospace; + border: 1px solid; + border-collapse: collapse; + color: #000; } blockquote { @@ -168,11 +174,17 @@ nav { article { text-align: justify; + padding-top: 2em; } -.post-permalink { - list-style: none; - margin-left: -20px; +#post-permalink { + list-style-type: none; + padding-left: 0; +} + +#post-permalink>li { + line-height:1.2rem; + margin:.6rem 0 } .post-date { @@ -180,22 +192,3 @@ article { font-weight: 400; font-size: 1.1em; } - -footer { - border-top: 2px solid #eee; - margin-top: 2em; - display: flex; - flex-direction: row; - justify-content: left; - align-items: left; -} - -footer a, footer a:link, footer a:focus, footer a:active, footer a:hover { - color: black; - text-decoration: none; - padding: 5px; -} - -footer a:not(:first-child) { - margin-left: 15px; -} -- cgit 1.4.1 From d1addb107351273219c4637ba8557bda86902f69 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Sun, 3 Apr 2022 17:51:04 -0700 Subject: content: update PCIe doc --- users/fcuny/notes/content/notes/stuff-about-pcie.org | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/users/fcuny/notes/content/notes/stuff-about-pcie.org b/users/fcuny/notes/content/notes/stuff-about-pcie.org index 4d1a825..eeb0b16 100644 --- a/users/fcuny/notes/content/notes/stuff-about-pcie.org +++ b/users/fcuny/notes/content/notes/stuff-about-pcie.org @@ -15,7 +15,10 @@ The most common versions are 3 and 4, while 5 is starting to be available with n | 5 | 128b/130b | 32.0GT/s | 3938 MB/s | 7.877 GB/s | 15.75 GB/s | 31.51 GB/s | 63.02 GB/s | | 6 | 128b/130 | 64.0 GT/s | 7877 MB/s | 15.754 GB/s | 31.51 GB/s | 63.02 GB/s | 126.03 GB/s | -This is a [[https://community.mellanox.com/s/article/understanding-pcie-configuration-for-maximum-performance][useful]] link to understand the formula: Maximum PCIe Bandwidth = *SPEED* * *WIDTH* * (1 - ENCODING) - 1Gb/s. +This is a [[https://community.mellanox.com/s/article/understanding-pcie-configuration-for-maximum-performance][useful]] link to understand the formula: +#+begin_quote +Maximum PCIe Bandwidth = *SPEED* * *WIDTH* * (1 - ENCODING) - 1Gb/s. +#+end_quote We remove 1Gb/s for protocol overhead and error corrections. The main difference between the generations besides the supported speed is the encoding overhead of the packet. For generations 1 and 2, each packet sent on the PCIe has 20% PCIe headers overhead. This was improved in generation 3, where the overhead was reduced to 1.5% (2/130) - see [[https://en.wikipedia.org/wiki/8b/10b_encoding][8b/10b encoding]] and [[https://en.wikipedia.org/wiki/64b/66b_encoding][128b/130b encoding]]. -- cgit 1.4.1 From 967137ce526cc3c6501b7cca19a6d88fa9c53d17 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Tue, 10 May 2022 08:11:31 -0700 Subject: nix: start documenting what I'm learning --- .../fcuny/notes/content/notes/working-with-nix.org | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 users/fcuny/notes/content/notes/working-with-nix.org diff --git a/users/fcuny/notes/content/notes/working-with-nix.org b/users/fcuny/notes/content/notes/working-with-nix.org new file mode 100644 index 0000000..05e6720 --- /dev/null +++ b/users/fcuny/notes/content/notes/working-with-nix.org @@ -0,0 +1,21 @@ +#+TITLE: Working with nix + +* the =nix develop= command +The =nix develop= command is for working on a repository. If our repository contains a =Makefile=, it will be used by the various sub-commands. + +=nix develop= supports multiple [[https://nixos.org/manual/nixpkgs/stable/#sec-stdenv-phases][phases]] and they map as follow: + +| phase | default to | command | note | +|----------------+--------------+-------------------------+------| +| configurePhase | =./configure= | =nix develop --configure= | | +| buildPhase | =make= | =nix develop --build= | | +| checkPhase | =make check= | =nix develop --check= | | +| installPhase | =make install= | =nix develop --install= | | + +In the repository, running =nix develop --build= will build the binary *using the Makefile*. This is different from running =nix build=. + +* the =nix build= and =nix run= commands +** for Go +For Go, there's the =buildGoModule=. Looking at the [[https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/go-modules/generic/default.nix][source]] we can see there's a definition of what will be done for each phases. As a result, we don't have to define them ourselves. + +If we run =nix build= in the repository, it will run the default [[https://github.com/NixOS/nixpkgs/blob/fb7287e6d2d2684520f756639846ee07f6287caa/pkgs/development/go-modules/generic/default.nix#L171][build phase]]. -- cgit 1.4.1 From 2be7a6c9fec9822af397f8b691e43f2efdbc0489 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Tue, 10 May 2022 08:17:37 -0700 Subject: go: replace lsp-mode with eglot --- .../fcuny/notes/content/notes/working-with-go.org | 81 ++++------------------ 1 file changed, 15 insertions(+), 66 deletions(-) diff --git a/users/fcuny/notes/content/notes/working-with-go.org b/users/fcuny/notes/content/notes/working-with-go.org index e00f635..fd39d26 100644 --- a/users/fcuny/notes/content/notes/working-with-go.org +++ b/users/fcuny/notes/content/notes/working-with-go.org @@ -116,76 +116,25 @@ require ( ** =go-mode= [[https://github.com/dominikh/go-mode.el][This is the mode]] to install to get syntax highlighting (mostly). ** Integration with LSP -Emacs has a pretty good integration with LSP. -https://geeksocket.in/posts/emacs-lsp-go/ -*** =lsp-mode= -[[src:https://github.com/emacs-lsp/lsp-mode][This is the main mode to install]]. It provides the integration with LSP. +Emacs has a pretty good integration with LSP, and [[https://whatacold.io/blog/2022-01-22-emacs-eglot-lsp/]["Eglot for better programming experience in Emacs"]] is a good starting point. +*** eglot +[[https://github.com/joaotavora/eglot][This is the main mode to install]]. -I've configured the mode like this: +The configuration is straightforward, this is what I use: #+begin_src elisp -(use-package lsp-mode - :ensure t - :commands (lsp lsp-deferred) - :diminish lsp-mode - :hook ((go-mode . lsp-deferred) - (lsp-mode . (lambda() (let ((lsp-keymap-prefix "C-c l")) - (lsp-enable-which-key-integration))))) - :config - (define-key lsp-mode-map (kbd "C-c l") lsp-command-map) - (lsp-register-custom-settings - '(("gopls.completeUnimported" t t) - ("gopls.staticcheck" t t))) - :bind - (("C-c l i" . lsp-ui-imenu)) - :custom - (lsp-session-file (expand-file-name "lsp-session-v1" fcuny/path-emacs-var)) - (lsp-enable-snippet nil) - (lsp-signature-doc-lines 5) - (lsp-modeline-diagnostic-scope :workspace) - (lsp-completion-provider :capf) - (lsp-completion-enable t) - (lsp-enable-indentation t) - (lsp-eldoc-render-all t) - (lsp-prefer-flymake nil)) +;; for go's LSP I want to use staticcheck and placeholders for completion +(customize-set-variable 'eglot-workspace-configuration + '((:gopls . + ((staticcheck . t) + (matcher . "CaseSensitive") + (usePlaceholders . t))))) + +;; ensure we load eglot for some specific modes +(dolist (hook '(go-mode-hook nix-mode-hook)) + (add-hook hook 'eglot-ensure)) #+end_src -+ =C-c l= brings a menu via [[https://github.com/abo-abo/hydra][hydra]] -+ By default it seems that =staticcheck= is not used, so I force it with the =lsp-register-custom-settings= -+ I prefer [[https://www.flycheck.org/en/latest/][flycheck]] -*** =lsp-ui= -This is mostly for UI tweaks. I use the following configuration -#+begin_src elisp -(use-package lsp-ui - :ensure t - :hook (lsp-mode . lsp-ui-mode) - :commands lsp-ui-mode - :custom - (lsp-ui-doc-delay 0.4) - (lsp-ui-doc-enable t) - (lsp-ui-doc-position 'top) - (lsp-ui-doc-include-signature t) - (lsp-ui-peek-enable t) - (lsp-ui-sideline-enable t) - (lsp-ui-imenu-enable t) - (lsp-ui-flycheck-enable t)) - -#+end_src -*** =lsp-ivy= -I use ivy for completion, [[https://github.com/emacs-lsp/lsp-ivy][it provides]] completion based on the current workspace. This is my configuration: -#+begin_src elisp -(use-package lsp-ivy - :ensure t - :commands lsp-ivy-workspace-symbol) -#+end_src -*** =lsp-treemacs= -[[https://github.com/emacs-lsp/lsp-treemacs][It provides]] some nice improvement regarding the UI. This is my configuration: -#+begin_src elisp -(use-package lsp-treemacs - :ensure t - :config - (lsp-treemacs-sync-mode 1)) - -#+end_src +=eglot= integrates well with existing modes for Emacs, mainly xref, flymake, eldoc. * Profiling ** pprof [[https://github.com/google/pprof][pprof]] is a tool to visualize performance data. Let's start with the following test: -- cgit 1.4.1 From 55003fe1676d51cd30d1c35f6a21e06b5a9e32dd Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Tue, 10 May 2022 08:17:53 -0700 Subject: nix: add tags --- users/fcuny/notes/content/notes/working-with-nix.org | 1 + 1 file changed, 1 insertion(+) diff --git a/users/fcuny/notes/content/notes/working-with-nix.org b/users/fcuny/notes/content/notes/working-with-nix.org index 05e6720..b7be859 100644 --- a/users/fcuny/notes/content/notes/working-with-nix.org +++ b/users/fcuny/notes/content/notes/working-with-nix.org @@ -1,4 +1,5 @@ #+TITLE: Working with nix +#+TAGS[]: linux nix * the =nix develop= command The =nix develop= command is for working on a repository. If our repository contains a =Makefile=, it will be used by the various sub-commands. -- cgit 1.4.1 From 46f50a78c1a7feb201c3794918b9ea2612b9f3de Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Tue, 10 May 2022 19:57:21 -0700 Subject: update gitignore --- users/fcuny/notes/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/users/fcuny/notes/.gitignore b/users/fcuny/notes/.gitignore index 6e68499..a85694c 100644 --- a/users/fcuny/notes/.gitignore +++ b/users/fcuny/notes/.gitignore @@ -1 +1,2 @@ /docs/ +/.hugo_build.lock -- cgit 1.4.1 From 2bb299e6ba529015c3d4d8f124a6cfe003cb5e1a Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Wed, 11 May 2022 12:13:22 -0700 Subject: remove atom from the list of outputs --- users/fcuny/notes/config.toml | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/users/fcuny/notes/config.toml b/users/fcuny/notes/config.toml index cb488ee..4f335a9 100644 --- a/users/fcuny/notes/config.toml +++ b/users/fcuny/notes/config.toml @@ -37,13 +37,5 @@ enableGitInfo = true style = "emacs" tabWidth = 4 -[mediaTypes."application/atom"] - suffixes = ["xml"] - -[outputFormats.Atom] - mediaType = "application/atom" - baseName = "feed" - isPlainText = false - [outputs] - home = [ "HTML", "Atom" ] + home = [ "HTML" ] -- cgit 1.4.1 From 53ed1f0d9ab3ff83bee2609df1acce0aa036f374 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Wed, 11 May 2022 12:13:50 -0700 Subject: remove GitHub action workflow --- users/fcuny/notes/.github/workflows/gh-pages.yml | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 users/fcuny/notes/.github/workflows/gh-pages.yml diff --git a/users/fcuny/notes/.github/workflows/gh-pages.yml b/users/fcuny/notes/.github/workflows/gh-pages.yml deleted file mode 100644 index bf3398a..0000000 --- a/users/fcuny/notes/.github/workflows/gh-pages.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: github pages - -on: - push: - branches: - - main # Set a branch to deploy - -jobs: - deploy: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Setup Hugo - uses: superfly/flyctl-actions@master - env: - FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} - with: - args: "deploy" -- cgit 1.4.1 From 9fcea5424c25562fc71fa2f0250dac254ba3a89f Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Wed, 11 May 2022 12:15:24 -0700 Subject: add a script to deploy the site Instead of using the Makefile, move the content to a script. This will be executed by drone later. --- users/fcuny/notes/Makefile | 9 +-------- users/fcuny/notes/scripts/deploy.sh | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 8 deletions(-) create mode 100755 users/fcuny/notes/scripts/deploy.sh diff --git a/users/fcuny/notes/Makefile b/users/fcuny/notes/Makefile index 4644ac3..fbd1205 100644 --- a/users/fcuny/notes/Makefile +++ b/users/fcuny/notes/Makefile @@ -5,7 +5,7 @@ DOCKER_IMAGE_REF := $(shell git rev-parse HEAD) DOCKERFILE := Dockerfile PROJECT_DIR := $(realpath $(CURDIR)) -.PHONY: server deploy docker-build docker-run worktree-clean +.PHONY: server docker-build docker-run worktree-clean server: @echo "Running hugo server ..." @@ -15,13 +15,6 @@ worktree-clean: git diff --exit-code git diff --staged --exit-code -deploy: worktree-clean docker-build - @echo "Deploying to fly ..." - flyctl deploy - @git tag -a --message $$(flyctl info -j |jq -r '.App | "notes.fcuny.net/v\(.Version)"') $$(flyctl info -j |jq -r '.App | "notes.fcuny.net/v\(.Version)"') - @git push origin --all - @git push origin --tags - docker-build: @echo "Building Docker image ..." $(DOCKER) build $(DOCKER_BUILD_ARGS) \ diff --git a/users/fcuny/notes/scripts/deploy.sh b/users/fcuny/notes/scripts/deploy.sh new file mode 100755 index 0000000..4075f08 --- /dev/null +++ b/users/fcuny/notes/scripts/deploy.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +git diff --exit-code +git diff --staged --exit-code + +flyctl deploy + +VERSION=$(flyctl info -j |jq -r '.App | "notes.fcuny.net/v\(.Version)"') + +git tag -a --message ${VERSION} ${VERSION} +git push origin --all +git push origin --tags + +flyctl agent stop -- cgit 1.4.1 From 32f1ea7d820d3806fa761f399f18619fafe2a2d7 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Wed, 11 May 2022 12:18:13 -0700 Subject: add flake support --- users/fcuny/notes/.envrc | 1 + users/fcuny/notes/flake.lock | 42 ++++++++++++++++++++++++++++++++++++++++ users/fcuny/notes/flake.nix | 46 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 89 insertions(+) create mode 100644 users/fcuny/notes/.envrc create mode 100644 users/fcuny/notes/flake.lock create mode 100644 users/fcuny/notes/flake.nix diff --git a/users/fcuny/notes/.envrc b/users/fcuny/notes/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/users/fcuny/notes/.envrc @@ -0,0 +1 @@ +use flake diff --git a/users/fcuny/notes/flake.lock b/users/fcuny/notes/flake.lock new file mode 100644 index 0000000..afaae62 --- /dev/null +++ b/users/fcuny/notes/flake.lock @@ -0,0 +1,42 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1649676176, + "narHash": "sha256-OWKJratjt2RW151VUlJPRALb7OU2S5s+f0vLj4o1bHM=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "a4b154ebbdc88c8498a5c7b01589addc9e9cb678", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1652295142, + "narHash": "sha256-vqvZa2xoNPhkpAhAbtUCA2wyga1qv6QeuGH2C8IVnus=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "174c43d7d17b27e50074fe3c970a5659a4d8e39b", + "type": "github" + }, + "original": { + "owner": "nixos", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/users/fcuny/notes/flake.nix b/users/fcuny/notes/flake.nix new file mode 100644 index 0000000..52e25c1 --- /dev/null +++ b/users/fcuny/notes/flake.nix @@ -0,0 +1,46 @@ +{ + description = "Franck Cuny's notes."; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let pkgs = nixpkgs.legacyPackages.${system}; + in { + defaultPackage = with pkgs; + stdenv.mkDerivation { + pname = "notes.fcuny.net"; + version = self.lastModifiedDate; + src = ./.; + buildInputs = [ hugo git ]; + buildPhase = '' + mkdir -p $out + hugo --minify --destination $out + ''; + dontInstall = true; + }; + + defaultApp = pkgs.writers.writeBashBin "run-hugo" '' + set -e + set -o pipefail + export PATH=${pkgs.lib.makeBinPath [ pkgs.hugo pkgs.git ]} + hugo server -D + ''; + + apps = { + deploy = pkgs.pkgs.writeShellScriptBin "run-deploy" '' + set -euxo pipefail + export PATH=${ + pkgs.lib.makeBinPath [ pkgs.hugo pkgs.git pkgs.jq pkgs.flyctl ] + }:$PATH + bash ./scripts/deploy.sh + ''; + }; + + devShell = + pkgs.mkShell { buildInputs = with pkgs; [ hugo flyctl git jq ]; }; + }); +} -- cgit 1.4.1 From 74fb4a4a13afa64c0324194825948d3502848617 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Wed, 11 May 2022 12:20:07 -0700 Subject: add drone configuration --- users/fcuny/notes/.drone.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 users/fcuny/notes/.drone.yml diff --git a/users/fcuny/notes/.drone.yml b/users/fcuny/notes/.drone.yml new file mode 100644 index 0000000..ee50017 --- /dev/null +++ b/users/fcuny/notes/.drone.yml @@ -0,0 +1,18 @@ +--- +kind: pipeline +type: exec +name: default + +trigger: + event: + - push + branch: + - main + +steps: + - name: deploy + environment: + FLY_API_TOKEN: + from_secret: FLY_API_TOKEN + commands: + - nix run .#deploy -- cgit 1.4.1 From 34809448bee4d8116ed6ad1193ea80dae59d9210 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Wed, 11 May 2022 12:20:15 -0700 Subject: nix: add more content --- users/fcuny/notes/content/notes/working-with-nix.org | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/users/fcuny/notes/content/notes/working-with-nix.org b/users/fcuny/notes/content/notes/working-with-nix.org index b7be859..105d025 100644 --- a/users/fcuny/notes/content/notes/working-with-nix.org +++ b/users/fcuny/notes/content/notes/working-with-nix.org @@ -1,4 +1,5 @@ #+TITLE: Working with nix +#+DATE: <2022-05-10 Tue> #+TAGS[]: linux nix * the =nix develop= command @@ -20,3 +21,6 @@ In the repository, running =nix develop --build= will build the binary *using th For Go, there's the =buildGoModule=. Looking at the [[https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/go-modules/generic/default.nix][source]] we can see there's a definition of what will be done for each phases. As a result, we don't have to define them ourselves. If we run =nix build= in the repository, it will run the default [[https://github.com/NixOS/nixpkgs/blob/fb7287e6d2d2684520f756639846ee07f6287caa/pkgs/development/go-modules/generic/default.nix#L171][build phase]]. +* =buildInputs= or =nativeBuildInputs= ++ =nativeBuildInputs= is intended for architecture-dependent build-time-only dependencies ++ =buildInputs= is intended for architecture-independent build-time-only dependencies -- cgit 1.4.1 From 3de7d59b2685ef89bf36f077ac30ea0734f16d92 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Wed, 11 May 2022 12:22:05 -0700 Subject: delete Makefile This is not needed anymore. --- users/fcuny/notes/Makefile | 27 --------------------------- 1 file changed, 27 deletions(-) delete mode 100644 users/fcuny/notes/Makefile diff --git a/users/fcuny/notes/Makefile b/users/fcuny/notes/Makefile deleted file mode 100644 index fbd1205..0000000 --- a/users/fcuny/notes/Makefile +++ /dev/null @@ -1,27 +0,0 @@ -DOCKER := DOCKER_BUILDKIT=1 docker -DOCKER_BUILD_ARGS := -DOCKER_IMAGE := fcuny/notes.fcuny.net -DOCKER_IMAGE_REF := $(shell git rev-parse HEAD) -DOCKERFILE := Dockerfile -PROJECT_DIR := $(realpath $(CURDIR)) - -.PHONY: server docker-build docker-run worktree-clean - -server: - @echo "Running hugo server ..." - hugo server - -worktree-clean: - git diff --exit-code - git diff --staged --exit-code - -docker-build: - @echo "Building Docker image ..." - $(DOCKER) build $(DOCKER_BUILD_ARGS) \ - --tag "${DOCKER_IMAGE}:${DOCKER_IMAGE_REF}" \ - --file "$(DOCKERFILE)" \ - "$(PROJECT_DIR)" - -docker-run: docker-build - @echo "Running Docker image ..." - $(DOCKER) run -ti --rm -p 8080:8080 "${DOCKER_IMAGE}:${DOCKER_IMAGE_REF}" -- cgit 1.4.1