diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..2de8067 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,8 @@ +[*] +insert_final_newline = true +trim_trailing_whitespace = true +indent_style = space +indent_size = 2 + +[*.md] +trim_trailing_whitespace = false diff --git a/.gitignore b/.gitignore index 9520b5a..6240da8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ # build output dist/ +# generated types +.astro/ # dependencies node_modules/ @@ -17,6 +19,3 @@ pnpm-debug.log* # macOS-specific files .DS_Store - -# vscode -# .vscode diff --git a/.npmrc b/.npmrc deleted file mode 100644 index ef83021..0000000 --- a/.npmrc +++ /dev/null @@ -1,2 +0,0 @@ -# Expose Astro dependencies for `pnpm` users -shamefully-hoist=true diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000..9a2a0e2 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +v20 diff --git a/.prettierrc b/.prettierrc index 80469c1..da480e5 100644 --- a/.prettierrc +++ b/.prettierrc @@ -6,7 +6,7 @@ "tabWidth": 2, "requireConfig": false, "useTabs": false, - "trailingComma": "none", + "trailingComma": "all", "bracketSpacing": true, "jsxBracketSameLine": false, "semi": true diff --git a/.stackblitzrc b/.stackblitzrc deleted file mode 100644 index 0dfa8f1..0000000 --- a/.stackblitzrc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "startCommand": "npm start", - "env": { - "ENABLE_CJS_IMPORTS": true - } -} diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..22a1505 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,4 @@ +{ + "recommendations": ["astro-build.astro-vscode"], + "unwantedRecommendations": [] +} diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..d642209 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,11 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "command": "./node_modules/.bin/astro dev", + "name": "Development server", + "request": "launch", + "type": "node-terminal" + } + ] +} diff --git a/README.md b/README.md index dceb4d3..6bc629c 100644 --- a/README.md +++ b/README.md @@ -1,69 +1,15 @@ -

- -


- -This website is statically generated thanks to **Astro**, a new (1.0.0-rc.1 at -the moment) all-in-one web framework for building fast, content-focused -websites. Here are some of its features: - -- **Component Islands**: Interactive UI component on an otherwise static page of - HTML. -- **Server-first API design**: Astro renders directly to HTML & CSS, eliminating - heavy JavaScript automatically. -- **Zero JS, by default**: No JavaScript runtime overhead. -- **Edge-ready**: Deploy anywhere, even a global edge runtime like Deno or - Cloudflare. -- **UI-agnostic**: Supports React, Preact, Svelte, Vue, Solid, Lit and more. - -The folder structure of this website looks something like this: - -``` -. -├── public/ -│ └── assets -└── src/ - ├── components/ - ├── layouts/ - ├── pages/ - ├── scripts/ - └── style/ -``` - -[Astro](https://astro.build/) looks for `.astro` or `.md` files in the -`/src/pages/` directory. Each page is exposed as a route based on its file name. -If the page has [brackets] in it's name it's a -[dynamic route](https://docs.astro.build/en/core-concepts/routing/). - -Page layouts are in the `src/layouts` folder while `src/components/` is where I -put anything that I want to re-use inside pages. All client side JS is put into -the `src/scripts/` folder. - -All global styles are in `src/styles/` and written with -[SASS](https://sass-lang.com/). Individual page or component styles are in each -page or component file inside the `Daniele Salvagni \ No newline at end of file +Daniele Salvagni diff --git a/public/fonts/Inconsolata-Bold.woff2 b/public/fonts/Inconsolata-Bold.woff2 new file mode 100644 index 0000000..a183d29 Binary files /dev/null and b/public/fonts/Inconsolata-Bold.woff2 differ diff --git a/public/fonts/Inconsolata-Light.woff2 b/public/fonts/Inconsolata-Light.woff2 new file mode 100644 index 0000000..67c1971 Binary files /dev/null and b/public/fonts/Inconsolata-Light.woff2 differ diff --git a/public/fonts/Inconsolata-Regular.woff2 b/public/fonts/Inconsolata-Regular.woff2 new file mode 100644 index 0000000..fb2d3c4 Binary files /dev/null and b/public/fonts/Inconsolata-Regular.woff2 differ diff --git a/public/assets/img/content/008/swagger-ui.png b/public/img/blog/aws-sam-swagger/swagger-ui.png similarity index 100% rename from public/assets/img/content/008/swagger-ui.png rename to public/img/blog/aws-sam-swagger/swagger-ui.png diff --git a/public/assets/img/content/001/github-comments.png b/public/img/blog/comments/github-comments.png similarity index 100% rename from public/assets/img/content/001/github-comments.png rename to public/img/blog/comments/github-comments.png diff --git a/public/assets/img/content/009/fnm.png b/public/img/blog/fnm/fnm.png similarity index 100% rename from public/assets/img/content/009/fnm.png rename to public/img/blog/fnm/fnm.png diff --git a/public/assets/img/content/009/zprof.png b/public/img/blog/fnm/zprof.png similarity index 100% rename from public/assets/img/content/009/zprof.png rename to public/img/blog/fnm/zprof.png diff --git a/public/assets/img/content/010/m01.webp b/public/img/blog/guitar-effects-custom/m01.webp similarity index 100% rename from public/assets/img/content/010/m01.webp rename to public/img/blog/guitar-effects-custom/m01.webp diff --git a/public/assets/img/content/010/m02.webp b/public/img/blog/guitar-effects-custom/m02.webp similarity index 100% rename from public/assets/img/content/010/m02.webp rename to public/img/blog/guitar-effects-custom/m02.webp diff --git a/public/assets/img/content/010/m03.webp b/public/img/blog/guitar-effects-custom/m03.webp similarity index 100% rename from public/assets/img/content/010/m03.webp rename to public/img/blog/guitar-effects-custom/m03.webp diff --git a/public/assets/img/content/010/m04.webp b/public/img/blog/guitar-effects-custom/m04.webp similarity index 100% rename from public/assets/img/content/010/m04.webp rename to public/img/blog/guitar-effects-custom/m04.webp diff --git a/public/assets/img/content/010/m05.webp b/public/img/blog/guitar-effects-custom/m05.webp similarity index 100% rename from public/assets/img/content/010/m05.webp rename to public/img/blog/guitar-effects-custom/m05.webp diff --git a/public/assets/img/content/010/m06.webp b/public/img/blog/guitar-effects-custom/m06.webp similarity index 100% rename from public/assets/img/content/010/m06.webp rename to public/img/blog/guitar-effects-custom/m06.webp diff --git a/public/assets/img/content/010/m07.webp b/public/img/blog/guitar-effects-custom/m07.webp similarity index 100% rename from public/assets/img/content/010/m07.webp rename to public/img/blog/guitar-effects-custom/m07.webp diff --git a/public/assets/img/content/010/m08.webp b/public/img/blog/guitar-effects-custom/m08.webp similarity index 100% rename from public/assets/img/content/010/m08.webp rename to public/img/blog/guitar-effects-custom/m08.webp diff --git a/public/assets/img/content/010/m09.webp b/public/img/blog/guitar-effects-custom/m09.webp similarity index 100% rename from public/assets/img/content/010/m09.webp rename to public/img/blog/guitar-effects-custom/m09.webp diff --git a/public/assets/img/content/010/m10.webp b/public/img/blog/guitar-effects-custom/m10.webp similarity index 100% rename from public/assets/img/content/010/m10.webp rename to public/img/blog/guitar-effects-custom/m10.webp diff --git a/public/assets/img/content/010/m11.webp b/public/img/blog/guitar-effects-custom/m11.webp similarity index 100% rename from public/assets/img/content/010/m11.webp rename to public/img/blog/guitar-effects-custom/m11.webp diff --git a/public/assets/img/content/010/m12.webp b/public/img/blog/guitar-effects-custom/m12.webp similarity index 100% rename from public/assets/img/content/010/m12.webp rename to public/img/blog/guitar-effects-custom/m12.webp diff --git a/public/assets/img/content/010/m13.webp b/public/img/blog/guitar-effects-custom/m13.webp similarity index 100% rename from public/assets/img/content/010/m13.webp rename to public/img/blog/guitar-effects-custom/m13.webp diff --git a/public/assets/img/content/010/m14.webp b/public/img/blog/guitar-effects-custom/m14.webp similarity index 100% rename from public/assets/img/content/010/m14.webp rename to public/img/blog/guitar-effects-custom/m14.webp diff --git a/public/assets/img/content/010/t01.webp b/public/img/blog/guitar-effects-custom/t01.webp similarity index 100% rename from public/assets/img/content/010/t01.webp rename to public/img/blog/guitar-effects-custom/t01.webp diff --git a/public/assets/img/content/010/t02.webp b/public/img/blog/guitar-effects-custom/t02.webp similarity index 100% rename from public/assets/img/content/010/t02.webp rename to public/img/blog/guitar-effects-custom/t02.webp diff --git a/public/assets/img/content/010/t03.webp b/public/img/blog/guitar-effects-custom/t03.webp similarity index 100% rename from public/assets/img/content/010/t03.webp rename to public/img/blog/guitar-effects-custom/t03.webp diff --git a/public/assets/img/content/010/t04.webp b/public/img/blog/guitar-effects-custom/t04.webp similarity index 100% rename from public/assets/img/content/010/t04.webp rename to public/img/blog/guitar-effects-custom/t04.webp diff --git a/public/assets/img/content/010/t05.webp b/public/img/blog/guitar-effects-custom/t05.webp similarity index 100% rename from public/assets/img/content/010/t05.webp rename to public/img/blog/guitar-effects-custom/t05.webp diff --git a/public/assets/img/content/010/t06.webp b/public/img/blog/guitar-effects-custom/t06.webp similarity index 100% rename from public/assets/img/content/010/t06.webp rename to public/img/blog/guitar-effects-custom/t06.webp diff --git a/public/assets/img/content/003/my-planck.png b/public/img/blog/planck/my-planck.png similarity index 100% rename from public/assets/img/content/003/my-planck.png rename to public/img/blog/planck/my-planck.png diff --git a/public/assets/img/content/003/qmk-fw.png b/public/img/blog/planck/qmk-fw.png similarity index 100% rename from public/assets/img/content/003/qmk-fw.png rename to public/img/blog/planck/qmk-fw.png diff --git a/public/assets/img/content/002/analytics-01.png b/public/img/blog/unfair-gamers/analytics-01.png similarity index 100% rename from public/assets/img/content/002/analytics-01.png rename to public/img/blog/unfair-gamers/analytics-01.png diff --git a/public/assets/img/content/002/cb-emoticons.zip b/public/img/blog/unfair-gamers/cb-emoticons.zip similarity index 100% rename from public/assets/img/content/002/cb-emoticons.zip rename to public/img/blog/unfair-gamers/cb-emoticons.zip diff --git a/public/assets/img/content/002/meet1.jpg b/public/img/blog/unfair-gamers/meet1.jpg similarity index 100% rename from public/assets/img/content/002/meet1.jpg rename to public/img/blog/unfair-gamers/meet1.jpg diff --git a/public/assets/img/content/002/meet2.jpg b/public/img/blog/unfair-gamers/meet2.jpg similarity index 100% rename from public/assets/img/content/002/meet2.jpg rename to public/img/blog/unfair-gamers/meet2.jpg diff --git a/public/assets/img/content/002/minimap.mp4 b/public/img/blog/unfair-gamers/minimap.mp4 similarity index 100% rename from public/assets/img/content/002/minimap.mp4 rename to public/img/blog/unfair-gamers/minimap.mp4 diff --git a/public/assets/img/content/002/mobber.mp4 b/public/img/blog/unfair-gamers/mobber.mp4 similarity index 100% rename from public/assets/img/content/002/mobber.mp4 rename to public/img/blog/unfair-gamers/mobber.mp4 diff --git a/public/assets/img/content/002/sisi.gif b/public/img/blog/unfair-gamers/sisi.gif similarity index 100% rename from public/assets/img/content/002/sisi.gif rename to public/img/blog/unfair-gamers/sisi.gif diff --git a/public/assets/img/content/002/the-coders-bay.png b/public/img/blog/unfair-gamers/the-coders-bay.png similarity index 100% rename from public/assets/img/content/002/the-coders-bay.png rename to public/img/blog/unfair-gamers/the-coders-bay.png diff --git a/public/assets/img/content/002/ug-dark.png b/public/img/blog/unfair-gamers/ug-dark.png similarity index 100% rename from public/assets/img/content/002/ug-dark.png rename to public/img/blog/unfair-gamers/ug-dark.png diff --git a/public/assets/img/content/002/ug-logo.png b/public/img/blog/unfair-gamers/ug-logo.png similarity index 100% rename from public/assets/img/content/002/ug-logo.png rename to public/img/blog/unfair-gamers/ug-logo.png diff --git a/public/assets/img/content/002/ug-screenshot.png b/public/img/blog/unfair-gamers/ug-screenshot.png similarity index 100% rename from public/assets/img/content/002/ug-screenshot.png rename to public/img/blog/unfair-gamers/ug-screenshot.png diff --git a/public/assets/img/content/002/ug-splash.png b/public/img/blog/unfair-gamers/ug-splash.png similarity index 100% rename from public/assets/img/content/002/ug-splash.png rename to public/img/blog/unfair-gamers/ug-splash.png diff --git a/public/assets/img/content/002/unreleased-mockup.png b/public/img/blog/unfair-gamers/unreleased-mockup.png similarity index 100% rename from public/assets/img/content/002/unreleased-mockup.png rename to public/img/blog/unfair-gamers/unreleased-mockup.png diff --git a/public/assets/img/content/002/users-100.txt b/public/img/blog/unfair-gamers/users-100.txt similarity index 100% rename from public/assets/img/content/002/users-100.txt rename to public/img/blog/unfair-gamers/users-100.txt diff --git a/public/assets/img/content/004/asus-rog-strix-wol.png b/public/img/blog/wol/asus-rog-strix-wol.png similarity index 100% rename from public/assets/img/content/004/asus-rog-strix-wol.png rename to public/img/blog/wol/asus-rog-strix-wol.png diff --git a/public/assets/img/content/004/disable-fast-startup.png b/public/img/blog/wol/disable-fast-startup.png similarity index 100% rename from public/assets/img/content/004/disable-fast-startup.png rename to public/img/blog/wol/disable-fast-startup.png diff --git a/public/assets/img/content/004/esp32-wake-on-lan.mp4 b/public/img/blog/wol/esp32-wake-on-lan.mp4 similarity index 100% rename from public/assets/img/content/004/esp32-wake-on-lan.mp4 rename to public/img/blog/wol/esp32-wake-on-lan.mp4 diff --git a/public/assets/img/content/004/telegram.png b/public/img/blog/wol/telegram.png similarity index 100% rename from public/assets/img/content/004/telegram.png rename to public/img/blog/wol/telegram.png diff --git a/public/assets/img/content/004/wol-wireshark.png b/public/img/blog/wol/wol-wireshark.png similarity index 100% rename from public/assets/img/content/004/wol-wireshark.png rename to public/img/blog/wol/wol-wireshark.png diff --git a/public/assets/img/content/colorgoggles.png b/public/img/cg/colorgoggles.png similarity index 100% rename from public/assets/img/content/colorgoggles.png rename to public/img/cg/colorgoggles.png diff --git a/public/img/notes/git/git-overview.png b/public/img/notes/git/git-overview.png new file mode 100644 index 0000000..1ed3613 Binary files /dev/null and b/public/img/notes/git/git-overview.png differ diff --git a/public/img/tracks/Imola_2009.svg b/public/img/tracks/Imola_2009.svg new file mode 100644 index 0000000..6111cb1 --- /dev/null +++ b/public/img/tracks/Imola_2009.svg @@ -0,0 +1,201 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + 7-29-2008 + + + Will Pittenger + + + + + + + + + + Will Pittenger + + + + + Imola + Enzo Ferrari + road course + racing + Formula 1 + Traguardo + Tamburello + Villeneuve + Tosa + Piratella + Acque Minerali + Variante Alta + Rivazza + Variante Bassa + + + Created in Inkscape with data from Google Earth + + + + + + + + + + + + + + + + + + N + + + + + 1 + + + + + 3 + + + + + 5 + + + + 6 + + + + + 13 + + + + 15 + + + + 2 + + + + 4 + + + + VarianteTamburello + + VarianteVilleneuve + + + 7 + + Tosa + + + 8 + + Piratella + + + 9 + + + + 10 + + AcqueMinerali + + + 11 + + + + 12 + + + + Variante Alta + + + + 14 + + + Rivazza + Rivazza + + + + 16 + + + + 17 + + + + Variante Bassa + + + + + + + moto + + + + + 18 + + + + 19 + + + \ No newline at end of file diff --git a/public/assets/img/logo.svg b/public/logo.svg similarity index 88% rename from public/assets/img/logo.svg rename to public/logo.svg index abeb5aa..5f1250d 100644 --- a/public/assets/img/logo.svg +++ b/public/logo.svg @@ -1 +1 @@ -Daniele Salvagni \ No newline at end of file +Daniele Salvagni diff --git a/src/components/BaseHead.astro b/src/components/BaseHead.astro index a908f22..3441240 100644 --- a/src/components/BaseHead.astro +++ b/src/components/BaseHead.astro @@ -1,17 +1,31 @@ --- -import '../style/style.scss'; -export interface Props { - title: string; - description: string; +// Import the global.css file here so that it is included on +// all pages through the use of the component. +import '../styles/global.css'; + +interface Props { + title: string; + description: string; + image?: string; } + const canonicalURL = new URL(Astro.url.pathname, Astro.site); -const { title, description } = Astro.props; + +const { title, description, image = '/blog-placeholder-1.jpg' } = Astro.props; --- - - + + + + + + + + + + {title} @@ -20,33 +34,14 @@ const { title, description } = Astro.props; - + - + - + - - - - - - - - + diff --git a/src/components/BlogEntry.astro b/src/components/BlogEntry.astro deleted file mode 100644 index 98f07d9..0000000 --- a/src/components/BlogEntry.astro +++ /dev/null @@ -1,20 +0,0 @@ ---- -export interface Props { - title: string; - description: string; - publishDate: string; - url: string; -} -const { title, description, publishDate, url } = Astro.props as Props; ---- - -
  • - {title} - - {new Date(publishDate).toDateString().substring(4)} -
  • - - \ No newline at end of file diff --git a/src/components/Footer.astro b/src/components/Footer.astro index cc103c0..342ca48 100644 --- a/src/components/Footer.astro +++ b/src/components/Footer.astro @@ -1,17 +1,33 @@ -
    - Made with ❤ and #Code -
    +--- +const today = new Date(); +--- + diff --git a/src/components/FormattedDate.astro b/src/components/FormattedDate.astro new file mode 100644 index 0000000..f60d41c --- /dev/null +++ b/src/components/FormattedDate.astro @@ -0,0 +1,17 @@ +--- +interface Props { + date: Date; +} + +const { date } = Astro.props; +--- + + diff --git a/src/components/Header.astro b/src/components/Header.astro index 69285f1..06a6da7 100644 --- a/src/components/Header.astro +++ b/src/components/Header.astro @@ -1,28 +1,163 @@ -
    - -
    +--- +import HeaderLink from './HeaderLink.astro'; +import { SITE_TITLE } from '../consts'; +--- +
    + +
    diff --git a/src/components/HeaderLink.astro b/src/components/HeaderLink.astro new file mode 100644 index 0000000..ab99693 --- /dev/null +++ b/src/components/HeaderLink.astro @@ -0,0 +1,25 @@ +--- +import type { HTMLAttributes } from 'astro/types'; + +type Props = HTMLAttributes<'a'>; + +const { href, class: className, ...props } = Astro.props; + +const { pathname } = Astro.url; +const isActive = pathname.split('/')[1] === href?.toString().split('/')[1]; +--- + + + + + diff --git a/src/components/SoftEntry.astro b/src/components/SoftEntry.astro deleted file mode 100644 index e485339..0000000 --- a/src/components/SoftEntry.astro +++ /dev/null @@ -1,20 +0,0 @@ ---- -export interface Props { - title: string; - description: string; - publishDate: string; - url: string; -} -const { title, description, publishDate, url } = Astro.props as Props; ---- - -
  • - {title} - - {description} -
  • - - \ No newline at end of file diff --git a/src/components/utilities/Date.astro b/src/components/utilities/Date.astro deleted file mode 100644 index 6298440..0000000 --- a/src/components/utilities/Date.astro +++ /dev/null @@ -1,14 +0,0 @@ ---- -const { date } = Astro.props; - -const options: Intl.DateTimeFormatOptions = { - year: 'numeric', - month: 'long', - day: 'numeric' -}; -const formattedDate = new Intl.DateTimeFormat('en-US', options).format( - Date.parse(date) -); ---- - - diff --git a/src/consts.ts b/src/consts.ts new file mode 100644 index 0000000..433ce5c --- /dev/null +++ b/src/consts.ts @@ -0,0 +1,5 @@ +// Place any global data in this file. +// You can import this data from anywhere in your site by using the `import` keyword. + +export const SITE_TITLE = 'Daniele Salvagni'; +export const SITE_DESCRIPTION = 'Daniele Salvagni\'s personal website.'; diff --git a/src/pages/b/aws-sam-and-typescript-building-functions-and-layers.md b/src/content/blog/aws-sam-and-typescript-building-functions-and-layers.md similarity index 92% rename from src/pages/b/aws-sam-and-typescript-building-functions-and-layers.md rename to src/content/blog/aws-sam-and-typescript-building-functions-and-layers.md index 4d9897d..3d15105 100644 --- a/src/pages/b/aws-sam-and-typescript-building-functions-and-layers.md +++ b/src/content/blog/aws-sam-and-typescript-building-functions-and-layers.md @@ -1,13 +1,14 @@ --- -layout: '../../layouts/BlogPost.astro' -collection: blog +# layout: '../../layouts/BlogPost.astro' +# collection: blog issue: 7 author: Daniele Salvagni title: 'AWS SAM and Typescript: building functions and layers' -publishDate: 2022-11-02 +pubDate: 'Nov 2, 2022' +emoji: ☁️ -excerpt: > +description: > Addressing some issues when working with SAM using Typescript and Lambda Layers. By using esbuild you will need to be careful as you will be building different parts of your code in different ways @@ -40,25 +41,25 @@ defaults), the following is one of the errors that prompted this post: "errorMessage": "SyntaxError: Unexpected token 'export'", ``` -> The main takeaway is that currently, by using esbuild with SAM for λ +> The main takeaway is that currently, by using esbuild with SAM for λ > functions, there is no way to change the > [format option](https://esbuild.github.io/api/#format), which is forced to be -> `cjs`. When building layers, for which at the moment we must use a different +> "cjs". When building layers, for which at the moment we must use a different > build system through a Makefile, we should always remember to transpile our -> code to use `commonjs` modules. +> code to use "commonjs" modules. This post will provide an example of a working configuration to avoid some of the common pitfalls. -# Setting up the project +## Setting up the project -## SAM init +### SAM init We will start from the official AWS SAM Typescript template sam init --runtime nodejs16.x --app-template hello-world-typescript --name sam-typescript-functions-layers --package-type Zip --dependency-manager npm --no-interactive -## Refactoring +### Refactoring We plan on having multiple λ functions, so let's create a new top-level folder named `functions/` and move the `hello-world/` folder there. We plan to achieve @@ -72,7 +73,7 @@ sam-typescript-functions-layers/ └── commmons/ ``` -# Adding a Typescript Layer +## Adding a Typescript Layer All of our λ functions will need a way to build a response object, we can use a Layer to share the following code as a module: @@ -81,12 +82,12 @@ Layer to share the following code as a module: export const responseBuilder = ( payload: any, statusCode: number = 200, - headers: any = { 'Content-Type': 'application/json' } + headers: any = { 'Content-Type': 'application/json' }, ) => { return { statusCode, headers, - body: JSON.stringify({ payload }) + body: JSON.stringify({ payload }), }; }; ``` @@ -186,7 +187,7 @@ layers/commons/ BuildMethod: makefile ``` -# Using the Layer inside a Lambda function +## Using the Layer inside a Lambda function 1. Reference the new layer in the λ functions that are using it: @@ -214,7 +215,7 @@ layers/commons/ We are now able to use the code from the Layer in our Lambda functions. -# Further documentation: +## Further documentation: Here are a few links worth reading about the topics of this post: diff --git a/src/pages/b/aws-sam-rest-api-from-swagger-file.md b/src/content/blog/aws-sam-rest-api-from-swagger-file.md similarity index 94% rename from src/pages/b/aws-sam-rest-api-from-swagger-file.md rename to src/content/blog/aws-sam-rest-api-from-swagger-file.md index 60f796d..a2b578b 100644 --- a/src/pages/b/aws-sam-rest-api-from-swagger-file.md +++ b/src/content/blog/aws-sam-rest-api-from-swagger-file.md @@ -1,13 +1,14 @@ --- -layout: '../../layouts/BlogPost.astro' -collection: blog +# layout: '../../layouts/BlogPost.astro' +# collection: blog issue: 8 author: Daniele Salvagni title: 'AWS SAM: Creating a REST API from a Swagger file' -publishDate: 2022-11-04 +pubDate: 'Nov 4, 2022' +emoji: ☁️ -excerpt: > +description: > How to create a REST API starting from a Swagger/OpenAPI file. One advantage of going this way is that it will be very easy to document our API inside the Swagger file or directly publishing the Swagger UI as documentation from an @@ -20,7 +21,7 @@ easy to document our API inside the Swagger file or directly [publishing the Swagger UI](https://dev.to/coolblue/using-swagger-ui-in-aws-serverless-stack-4hi5) as documentation from an endpoint of the API itself. -![Swagger UI](/assets/img/content/008/swagger-ui.png) +![Swagger UI](/img/blog/aws-sam-swagger/swagger-ui.png) # Integrating the Swagger file @@ -143,5 +144,7 @@ can be well defined and documented inside the Swagger file. Here are a few links worth reading about the topics of this post: - [OpenAPI Specification](https://swagger.io/specification/) [Swagger docs] -- [Configuring a REST API using OpenAPI](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-import-api.html) [AWS docs] -- [Usign Swagger UI in AWS Serverless stack](https://dev.to/coolblue/using-swagger-ui-in-aws-serverless-stack-4hi5) [dev.to] +- [Configuring a REST API using OpenAPI](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-import-api.html) + [AWS docs] +- [Usign Swagger UI in AWS Serverless stack](https://dev.to/coolblue/using-swagger-ui-in-aws-serverless-stack-4hi5) + [dev.to] diff --git a/src/pages/b/building-custom-effects-inside-a-1590a-enclosure.md b/src/content/blog/building-custom-effects-inside-a-1590a-enclosure.md similarity index 66% rename from src/pages/b/building-custom-effects-inside-a-1590a-enclosure.md rename to src/content/blog/building-custom-effects-inside-a-1590a-enclosure.md index c43d682..f9f60eb 100644 --- a/src/pages/b/building-custom-effects-inside-a-1590a-enclosure.md +++ b/src/content/blog/building-custom-effects-inside-a-1590a-enclosure.md @@ -1,19 +1,20 @@ --- -layout: '../../layouts/BlogPost.astro' -collection: blog +# layout: '../../layouts/BlogPost.astro' +# collection: blog issue: 10 author: Daniele Salvagni title: 'Show: Building custom effects inside a 1590A enclosure' -publishDate: 2020-01-03 +pubDate: 'Jan 3, 2020' +emoji: 🎸 -excerpt: > +description: > A gallery of the build process of two custom DIY guitar effects inside a 1590A enclosure, a fuzz effect based on the Woolly Mammoth and an octave effect based on the Green Ringer / EDQ Tentacle. --- -# Smol™ Woolly Mammoth fuzz effect +## Smol™ Woolly Mammoth 🦣 fuzz effect I was looking for a fuzz guitar effect and I really liked the sound of the **Woolly Mammoth**, but I also wanted something in a small 1590A enclosure @@ -26,35 +27,35 @@ use SMD components where I could. Most components are from they have many parts to build your own pedals which are very cheap and could be hard to find elsewhere. -![Smol Mammoth](/assets/img/content/010/m01.webp) +![Smol Mammoth](/img/blog/guitar-effects-custom/m01.webp) A preview of the finished pedal, I'm pretty happy with the result :) -![Smol Mammoth](/assets/img/content/010/m02.webp) +![Smol Mammoth](/img/blog/guitar-effects-custom/m02.webp) I started by adding a couple of pots and enlarging some holes on the board to fit the shielding stabilizers. -![Smol Mammoth](/assets/img/content/010/m03.webp) +![Smol Mammoth](/img/blog/guitar-effects-custom/m03.webp) Drilled some holes in the 1590A enclosure to fit the knobs. -![Smol Mammoth](/assets/img/content/010/m04.webp) +![Smol Mammoth](/img/blog/guitar-effects-custom/m04.webp) I started fitting the first SMD components between solder joints, they are the right size to fit nicely in between. -![Smol Mammoth](/assets/img/content/010/m05.webp) +![Smol Mammoth](/img/blog/guitar-effects-custom/m05.webp) Added more components, I added an IC socket which will be used to fit the 2 transistor in case I'd have to swap them out at some point. -![Smol Mammoth](/assets/img/content/010/m06.webp) +![Smol Mammoth](/img/blog/guitar-effects-custom/m06.webp) Some jumper wires and more SMD components between solder joints (they can be hard to spot). -![Smol Mammoth](/assets/img/content/010/m07.webp) +![Smol Mammoth](/img/blog/guitar-effects-custom/m07.webp) More drilling for DC power, input and putput 6.3mm jacks, a LED and the main knob. Ilso wanted to give an antique look so I sanded with some grainy sandpaper @@ -63,39 +64,39 @@ tools. I then sprayed some matte black spray paint onto a paper towel and brushed it onto the surface. I then removed the excess paint with fine grained sandpaper and polished the edges a bit more. -![Smol Mammoth](/assets/img/content/010/m08.webp) +![Smol Mammoth](/img/blog/guitar-effects-custom/m08.webp) All components are now there plus wires for VCC, GND, Send and Return. At this point I also cut the perfboard to length. -![Smol Mammoth](/assets/img/content/010/m09.webp) +![Smol Mammoth](/img/blog/guitar-effects-custom/m09.webp) -Not the prettiest soldering job but I guess if it works... It wasn't the easiest -either. +Not the prettiest soldering job (I was also missing some eqpipment) but I guess +if it works... It wasn't the easiest either. -![Smol Mammoth](/assets/img/content/010/m10.webp) +![Smol Mammoth](/img/blog/guitar-effects-custom/m10.webp) I prepared an amber LED with a 330ohm resistor hidden inside the red heatshrink. -![Smol Mammoth](/assets/img/content/010/m11.webp) +![Smol Mammoth](/img/blog/guitar-effects-custom/m11.webp) -Test fit, I don't have a single mm to spare. +Test fit, I don't have a single millimeter to spare. -![Smol Mammoth](/assets/img/content/010/m12.webp) +![Smol Mammoth](/img/blog/guitar-effects-custom/m12.webp) Gut shot before closing, I also insulated the inside of the bottom plate with some Kapton tape to avoid shorts. -![Smol Mammoth](/assets/img/content/010/m13.webp) +![Smol Mammoth](/img/blog/guitar-effects-custom/m13.webp) Aaaaand it's done! -![Smol Mammoth](/assets/img/content/010/m14.webp) +![Smol Mammoth](/img/blog/guitar-effects-custom/m14.webp) Fits right in :) After some thesting I'm convinced that this is the best sounding effect on my pedalboard, so I'd call it a s success! 🎸 -# Smol™ Tentacle octave effect +## Smol™ Tentacle 🦑 octave effect In the same week I finished the fuzz pedal I also started building a Tentacle, an octabe effect based on the **Green Ringer** / **EDQ Tentacle**. Again, I @@ -105,33 +106,33 @@ I'm still not sure how to use this effect honestly but it seems fun combined with other effects, it does sound better from about the 10th fret and up on the neck pickup. -![Smol Tentacle](/assets/img/content/010/t01.webp) +![Smol Tentacle](/img/blog/guitar-effects-custom/t01.webp) This time I did try something different with the enclosure by giving it a matte -look. I also added the image of a squig by using a toner transfer method: I +look. I also added the image of a squid by using a toner transfer method: I printed the image on a piece of glossy newspaper and then transferred it on the enclosure with the heat of an iron. -![Smol Tentacle](/assets/img/content/010/t02.webp) +![Smol Tentacle](/img/blog/guitar-effects-custom/t02.webp) Two euro coin for scale. This is the perfboard top side. Don't mind the -transistors as some are in the wrong orientation, I fixed this later. +transistors as some were in the wrong orientation, I fixed this later. -![Smol Tentacle](/assets/img/content/010/t03.webp) +![Smol Tentacle](/img/blog/guitar-effects-custom/t03.webp) And this is the bottom side, this time there are no knobs. -![Smol Tentacle](/assets/img/content/010/t04.webp) +![Smol Tentacle](/img/blog/guitar-effects-custom/t04.webp) I call this technique _"parkour"_. This was a work in progress so some joints were still not soldered. Combining through-hole and SMD components can solve a -lot of problems. +lot of routing problems. -![Smol Tentacle](/assets/img/content/010/t05.webp) +![Smol Tentacle](/img/blog/guitar-effects-custom/t05.webp) Gut shot before closing it up showing the 6.3mm jacks and a lot of wiring. -![Smol Tentacle](/assets/img/content/010/t06.webp) +![Smol Tentacle](/img/blog/guitar-effects-custom/t06.webp) -And the finished product. I really like how the eyes of the squid light up on -this one. +And the finished product. I really like the effect of the quid eyes lighting up +on this one 🦑. diff --git a/src/pages/b/embedded-telegram-bot-for-wake-on-lan-pc.md b/src/content/blog/embedded-telegram-bot-for-wake-on-lan-pc.md similarity index 75% rename from src/pages/b/embedded-telegram-bot-for-wake-on-lan-pc.md rename to src/content/blog/embedded-telegram-bot-for-wake-on-lan-pc.md index be3faae..3de4621 100644 --- a/src/pages/b/embedded-telegram-bot-for-wake-on-lan-pc.md +++ b/src/content/blog/embedded-telegram-bot-for-wake-on-lan-pc.md @@ -1,13 +1,14 @@ --- -layout: '../../layouts/BlogPost.astro' -collection: blog +# layout: '../../layouts/BlogPost.astro' +# collection: blog issue: 6 author: Daniele Salvagni title: Wake On Lan using an ESP32 Telegram bot -publishDate: 2022-08-26 +pubDate: 'Aug 26, 2022' +emoji: 🤖 -excerpt: > +description: > An embeddedd ESP32 M5Atom Telegram bot for sending a Wake-on-Lan magic packet on the local network to turn on my PC from anywhere. --- @@ -15,19 +16,19 @@ excerpt: > I wanted a simple and reliable way to turn on my PC from anywhere without having to choose one of the following: -- **Port Forwarding:** As most consumer routers don't support forwarding +- **~Port Forwarding~:** As most consumer routers don't support forwarding broadcast packets, this would imply having to make a DHCP reservation for the device that needs waking up so that the local IP will not change. Also, in case of internet connections with dynamic IP, a DDNS service would be required. -- **Local Server:** This would require having to maintain a small local server +- **~Local Server~:** This would require having to maintain a small local server like a Raspberry Pi and having it powered on 24/7. They don't consume much power but it's overkill and if you run them from an SD card it often gets corrupted. I wanted something reliable that I could quickly setup and then mostly forget -about it. The solution I came up with was to host a simple Telegram Bot on an +about. The solution I came up with was to host a simple Telegram Bot on an **ESP32** board, it will: 1. Connect to the local network via WiFI @@ -35,17 +36,17 @@ about it. The solution I came up with was to host a simple Telegram Bot on an 3. Broadcast the Wake-on-Lan packet on the local network 💵 The power consumption is very low, less than half a watt, so you can keep it -running for about **1$** in electricity per year. +running for about **1$** in electricity per year without any optimization.
    -> It keeps working if I buy a new router, it does not depend on my public or +> _It keeps working if I buy a new router, it does not depend on my public or > local IP staying the same and I don't have to keep a linux server running for -> such a simple task. +> such a simple task._ -# The sketch +## The sketch I am using an ESP32 board called **M5Atom**, it is pretty small and can be powered by USB type-c. It's a pretty simple project, so I am using the **Arduino @@ -54,7 +55,7 @@ IDE** for ease of use. The code should be pretty simple to understand and can be found on my Github at https://github.com/daniele-salvagni/wol-bot-esp32 -## ⚙️ Configuration +### Configuration In orfer to compile, the following extra libraries can be installed from the Library Manager: @@ -66,6 +67,8 @@ Library Manager: - [UniversalTelegramBot](https://www.arduino.cc/reference/en/libraries/universaltelegrambot/): for using the Telegram API +The following configuration needs to be updated in the sketch code: + ```cpp // WiFi configuration #define WIFI_SSID "" @@ -79,20 +82,20 @@ Library Manager: #define ALLOWED_ID "" ``` -Then you just need to fill your WiFi configuration and MAC Address, your -Telegram bot token and your Telegram User ID so no one else can use the bot. You -can use [@Botfather](https://t.me/botfather) to create a new bot and +You just need to fill your WiFi configuration and MAC Address, your Telegram bot +token and your Telegram User ID so no one else can control the bot. You can use +[@Botfather](https://t.me/botfather) to create a new bot and [@userinfobot](https://t.me/userinfobot) to get your ID. -## 🔎 Usage +### Usage - Use `/start` to get a list of the available commands - Use the `/wol` command or press the physical button to turn on your PC - Use the `/ping` command to check if the bot is online -![Telegram Bot](/assets/img/content/004/telegram.png) +![Telegram Bot](/img/blog/wol/telegram.png) -# Enabling Wake on Lan +## Enabling Wake on Lan Most motherboards support the "Wake-on-Lan" (WOL) function. This works by sending a packet of data called a "Magic Packet". When this packet is received @@ -110,7 +113,7 @@ system** of the PC/server you want to wake up. Here is a screenshot of the setting in my BIOS: -![Asus ROG Strix Wake-on-Lan](/assets/img/content/004/asus-rog-strix-wol.png) +![Asus ROG Strix Wake-on-Lan](/img/blog/wol/asus-rog-strix-wol.png) To enable Wake-on-Lan on Windows you can go to _Device Manager => Network Adapters => Properties_. Then enable _"Wake on Magic Packet"_ in the _Advanced_ @@ -120,15 +123,14 @@ Management tab_. "Fast Startup" also needs to be disabled (_Power Options => "Choose what the power buttons do"_) as it will conflict with this feature. -![Disable Fast Startup in Windows 11](/assets/img/content/004/disable-fast-startup.png) +![Disable Fast Startup in Windows 11](/img/blog/wol/disable-fast-startup.png) -## 🐛 Debugging with Wireshark +## Debugging with Wireshark If you encounter any issues you can use Wireshark and filter for -[WOL packets](/assets/img/content/004/wol-wireshark.png) to check what's going -wrong. +[WOL packets](/img/blog/wol/wol-wireshark.png) to check what's going wrong. -## ✅ TODO List +## TODO List - [ ] Refactor code - [ ] Store network configuration in EEPROM diff --git a/src/pages/b/fixing-zsh-slowdown-caused-by-nvm.md b/src/content/blog/fixing-zsh-slowdown-caused-by-nvm.md similarity index 57% rename from src/pages/b/fixing-zsh-slowdown-caused-by-nvm.md rename to src/content/blog/fixing-zsh-slowdown-caused-by-nvm.md index 6216c6f..85ca231 100644 --- a/src/pages/b/fixing-zsh-slowdown-caused-by-nvm.md +++ b/src/content/blog/fixing-zsh-slowdown-caused-by-nvm.md @@ -1,27 +1,31 @@ --- -layout: '../../layouts/BlogPost.astro' -collection: blog +# layout: '../../layouts/BlogPost.astro' +# collection: blog issue: 9 author: Daniele Salvagni title: 'Fixing ZSH slowdown caused by NVM' -publishDate: 2022-11-18 +pubDate: 'Nov 18, 2022' +emoji: 🛠️ -excerpt: > +description: > After profiling zsh I found out that nvm was the reason of the slow startup times. This script solved the issue by loading nvm only when needed. --- +> Update: I have been using `fnm` instead of `nvm` for more than one year +> without any problems, see more in the second half of this post. + When I first started using [oh-my-zsh](https://github.com/ohmyzsh/ohmyzsh) on my MacBook, I immediately noticed was how slow it was to startup. -To find the root cause, I turned on profiling by adding `zmodload zsh/zprof` at -the start of `.zshrc` file and `zprof` at the end, this clearly showed that -`nvm` was the main culprit. +To find the root cause, I turned on profiling by adding in my `.zshrc` file +`zmodload zsh/zprof` as the first line and `zprof` at the end. The results +showed that `nvm` was the main culprit: -![zprof](/assets/img/content/009/zprof.png) +![zprof](/img/blog/fnm/zprof.png) -The best solution I found was removing the `nvm` plugin inside `.zshrc` and +The best workaround I found was removing the `nvm` plugin inside `.zshrc` and replacing the default `nvm` stuff with the following: ```shell @@ -33,30 +37,18 @@ alias npm='unalias node ; unalias npm ; nvm use default ; npm $@' ``` This fixes the issue and moves the slowness to the first time you actually run -`node` or `nvm`. More info on this +`node/npm/nvm`. More info on this [Github issue comment](https://github.com/nvm-sh/nvm/issues/539#issuecomment-245791291) by @parasyte. -# Alternative: Replacing `nvm` with `fnm` +## Alternative solution: reeplacing nvm with fnm If you want a less "patchy" solution with less downsides, you can just entirely replace `nvm` with [`fnm`](https://github.com/Schniz/fnm), a much faster Node.js -version manager built in Rust. It's compatible with `nvm` and works with -`.nvmrc` and `.node-version`. - -## Installation - -```sh -brew install fnm -``` - -And then add the following to your `.zshrc` profile - -```sh -eval "$(fnm env --use-on-cd)" -``` +version manager written in Rust. It's a drop-in replacement for `nvm` also +compatible with `.nvmrc` and `.node-version`. -I also created an alias so I can stop typing `nvm` by habit +To stop typyng `nvm` by habit though, I had to create the following alias: ```sh alias nvm='echo "(╯°□°)╯︵ɯʌu, did you mean fnm?"' diff --git a/src/pages/b/hosting-comments-on-github-for-static-websites.md b/src/content/blog/hosting-comments-on-github-for-static-websites.md similarity index 94% rename from src/pages/b/hosting-comments-on-github-for-static-websites.md rename to src/content/blog/hosting-comments-on-github-for-static-websites.md index 728dd1e..52cea31 100644 --- a/src/pages/b/hosting-comments-on-github-for-static-websites.md +++ b/src/content/blog/hosting-comments-on-github-for-static-websites.md @@ -1,20 +1,21 @@ --- -layout: '../../layouts/BlogPost.astro' -collection: blog +# layout: '../../layouts/BlogPost.astro' +# collection: blog issue: 3 author: Daniele Salvagni title: Hosting comments on GitHub for static websites -publishDate: 2017-06-18 +pubDate: 'Jun 18, 2017' +emoji: 🛠️ -excerpt: > +description: > How I'm hosting comments on GitHub for my static website with Vue.js and GitHub APIs. --- -![Github Comments](/assets/img/content/001/github-comments.png) +![Github Comments](/img/blog/comments/github-comments.png) -# 2022 Update +## 2022 Update It has been a long time since I written this post and while I was remaking my website with a new stack I have been looking at what's available today. Many @@ -29,7 +30,7 @@ the existing issues to discussions. Doing it manually is still perfectly fine if you want to be minimal as possible, but this time around I felt like didn't want to reinvent the wheel again. -# Original post +--- I was in the middle of the development of my new website when I decided that I wanted to allow comments on my posts. That's not an easy task if like me you @@ -47,7 +48,7 @@ In this post I will show you how to host comments with GitHub issues, I will try to give you a general idea and some examples so you will be able to implement it for any static site. -# Analyzing GitHub's issue tracker +## Analyzing GitHub's issue tracker We will have to manually create a new issue for each post we make, this could be automated but in my opinion it isn't quite worth the effort. If you haven't yet, @@ -117,7 +118,7 @@ on GitHub, it will show up here! This will be shown in every post and will link the user to the correct Github issue. -# Retrieving the comments with Javascript +## Retrieving the comments with Javascript This can be done in many ways, you could make an [XHR](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest) and @@ -128,7 +129,7 @@ suggest something like the [axios](https://github.com/mzabriskie/axios) library instead (the one I'm using here) if you don't want to deal manually with `XMLHttpRequest`. -### About the Same Origin Policy +#### About the Same Origin Policy The [Same Origin Policy](https://en.wikipedia.org/wiki/Same-origin_policy) is a security mechanism to prevent a potentially malicious script loaded from one @@ -163,12 +164,12 @@ let instance = axios.create({ baseURL: 'https://api.github.com', timeout: 5000, // Set the correct media type - headers: { Accept: 'application/vnd.github.VERSION.html+json' } + headers: { Accept: 'application/vnd.github.VERSION.html+json' }, }); instance .get( - '/repos/daniele-salvagni/dan.salvagni.io/issues/' + issueNum + '/comments' + '/repos/daniele-salvagni/dan.salvagni.io/issues/' + issueNum + '/comments', ) .then((response) => console.log(response.data)) .catch(function (error) { diff --git a/src/content/blog/markdown-style-guide.md b/src/content/blog/markdown-style-guide.md new file mode 100644 index 0000000..1218949 --- /dev/null +++ b/src/content/blog/markdown-style-guide.md @@ -0,0 +1,217 @@ +--- +title: 'Markdown Style Guide' +description: 'Here is a sample of some basic Markdown syntax that can be used when writing Markdown content in Astro.' +pubDate: 'Jul 01 2022' +heroImage: '/blog-placeholder-1.jpg' +emoji: 🌲 +--- + +Here is a sample of some basic Markdown syntax that can be used when writing Markdown content in Astro. + +## Headings + +The following `following` HTML `

    `, `

    ` elements represent six levels of section headings. `

    ` is the highest section level while `

    ` is the lowest. + +# H1 - This is a Heading 1 + +## H2 - This is a Heading 2 + +### H3 - This is a Heading 3 + +#### H4 - This is a Heading 4 + +##### H5 - This is a Heading 5 + +###### H6 - This is a Heading 6 + +## Paragraph + +Xerum, quo qui aut unt expliquam qui dolut labo. Aque venitatiusda cum, voluptionse latur sitiae dolessi aut parist aut dollo enim qui voluptate ma dolestendit peritin re plis aut quas inctum laceat est volestemque commosa as cus endigna tectur, offic to cor sequas etum rerum idem sintibus eiur? Quianimin porecus evelectur, cum que nis nust voloribus ratem aut omnimi, sitatur? Quiatem. Nam, omnis sum am facea corem alique molestrunt et eos evelece arcillit ut aut eos eos nus, sin conecerem erum fuga. Ri oditatquam, ad quibus unda veliamenimin cusam et facea ipsamus es exerum sitate dolores editium rerore eost, temped molorro ratiae volorro te reribus dolorer sperchicium faceata tiustia prat. + +Itatur? Quiatae cullecum rem ent aut odis in re eossequodi nonsequ idebis ne sapicia is sinveli squiatum, core et que aut hariosam ex eat. + +## Images + +#### Syntax + +```markdown +![Alt text](./full/or/relative/path/of/image) +``` + +#### Output + +![blog placeholder](/blog-placeholder-about.jpg) + +## Blockquotes + +The blockquote element represents content that is quoted from another source, optionally with a citation which must be within a `footer` or `cite` element, and optionally with in-line changes such as annotations and abbreviations. + +### Blockquote without attribution + +#### Syntax + +```markdown +> Tiam, ad mint andaepu dandae nostion secatur sequo quae. +> **Note** that you can use _Markdown syntax_ within a blockquote. +``` + +#### Output + +> Tiam, ad mint andaepu dandae nostion secatur sequo quae. +> **Note** that you can use _Markdown syntax_ within a blockquote. + +### Blockquote with attribution + +#### Syntax + +```markdown +> Don't communicate by sharing memory, share memory by communicating.
    +> — Rob Pike[^1] +``` + +#### Output + +> Don't communicate by sharing memory, share memory by communicating.
    +> — Rob Pike[^1] + +[^1]: The above quote is excerpted from Rob Pike's [talk](https://www.youtube.com/watch?v=PAAkCSZUG1c) during Gopherfest, November 18, 2015. + +## Tables + +#### Syntax + +```markdown +| Italics | Bold | Code | +| --------- | -------- | ------ | +| _italics_ | **bold** | `code` | +``` + +#### Output + +| Italics | Bold | Code | +| --------- | -------- | ------ | +| _italics_ | **bold** | `code` | + +## Code Blocks + +#### Syntax + +we can use 3 backticks ``` in new line and write snippet and close with 3 backticks on new line and to highlight language specific syntac, write one word of language name after first 3 backticks, for eg. html, javascript, css, markdown, typescript, txt, bash + +````markdown +```html + + + + + Example HTML5 Document + + +

    Test

    + + +``` +```` + +Output + +```html + + + + + Example HTML5 Document + + +

    Test

    + + +``` + +## List Types + +### Ordered List + +#### Syntax + +```markdown +1. First item +2. Second item +3. Third item +``` + +#### Output + +1. First item +2. Second item +3. Third item + +### Unordered List + +#### Syntax + +```markdown +- List item +- Another item +- And another item +``` + +#### Output + +- List item +- Another item +- And another item + +### Nested list + +#### Syntax + +```markdown +- Fruit + - Apple + - Orange + - Banana +- Dairy + - Milk + - Cheese +``` + +#### Output + +- Fruit + - Apple + - Orange + - Banana +- Dairy + - Milk + - Cheese + +## Other Elements — abbr, sub, sup, kbd, mark + +#### Syntax + +```markdown +GIF is a bitmap image format. + +H2O + +Xn + Yn = Zn + +Press CTRL+ALT+Delete to end the session. + +Most salamanders are nocturnal, and hunt for insects, worms, and other small creatures. +``` + +#### Output + +GIF is a bitmap image format. + +H2O + +Xn + Yn = Zn + +Press CTRL+ALT+Delete to end the session. + +----- + +Most salamanders are nocturnal, and hunt for insects, worms, and other small creatures. diff --git a/src/pages/b/paginators-in-the-aws-sdk-for-javascript-v3.md b/src/content/blog/paginators-in-the-aws-sdk-for-javascript-v3.md similarity index 92% rename from src/pages/b/paginators-in-the-aws-sdk-for-javascript-v3.md rename to src/content/blog/paginators-in-the-aws-sdk-for-javascript-v3.md index 290cdbc..3fd3700 100644 --- a/src/pages/b/paginators-in-the-aws-sdk-for-javascript-v3.md +++ b/src/content/blog/paginators-in-the-aws-sdk-for-javascript-v3.md @@ -1,14 +1,14 @@ --- -layout: '../../layouts/BlogPost.astro' -collection: blog +# layout: '../../layouts/BlogPost.astro' +# collection: blog issue: 11 author: Daniele Salvagni -title: - Paginators in the AWS SDK for Javascript V3 -publishDate: 2023-10-26 +title: 'Paginators in the AWS SDK for Javascript V3' +pubDate: 'Oct 26, 2023' +emoji: ☁️ -excerpt: > +description: > How many times have you found yourself implementing pagination manually while retrieving data from the AWS SDK for Javascript? Let's see how we can use paginators with an example using DynamoDB queries. @@ -36,7 +36,7 @@ for await (const page of paginator) { } ``` -# Manual pagination +## Manual pagination Let's take the example of a DynamoDB query. When doing things manually, you would need to make a first query, check if there is a _LastEvaluatedKey_ in the @@ -47,7 +47,7 @@ By using the **paginateQuery** method instead, you can get rid of most of this boilerplate code. This same pattern can be applied to any other clients in the SDK that support paginators. -# Using Paginators +## Using Paginators Many AWS operations return paginated results when the response object is too big to be returned in a single response. For these operations, the AWS SDK for @@ -60,7 +60,7 @@ and return [Async Iterators](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/AsyncIterator) that can be used with a `for await...of` loop. -## A DynamoDB example using the **paginateQuery** method +### A DynamoDB example using the **paginateQuery** method Let's see an example using _paginateQuery_ to paginate over a query operation with the DynamoDB Document client. @@ -80,7 +80,7 @@ As you can see, it takes as inputs: - [DynamoDBPaginationConfiguration](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-dynamodb/Interface/DynamoDBPaginationConfiguration/) (extends - [PaginationConfiguration ](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-smithy-types/Interface/PaginationConfiguration/)) + [PaginationConfiguration](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-smithy-types/Interface/PaginationConfiguration/)) containing the client to be used and other configurations - [QueryCommandInput](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-lib-dynamodb/TypeAlias/QueryCommandInput/) that defines the query to be made @@ -146,7 +146,7 @@ In conclusion, if you are using the AWS SDK for Javascript, it's worth taking the time to learn how to use paginators effectively to make your code easier to read and maintain, as they are available for many clients throughout the SDK. -# References +## References - [AWS SDK for Javascript v3 - Documentation](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/) - [AWS SDK for Javascript v3 - Github](https://github.com/aws/aws-sdk-js-v3) diff --git a/src/pages/b/the-planck-an-ortholinear-keyboard.md b/src/content/blog/the-planck-an-ortholinear-keyboard.md similarity index 78% rename from src/pages/b/the-planck-an-ortholinear-keyboard.md rename to src/content/blog/the-planck-an-ortholinear-keyboard.md index b442dfe..a74fc13 100644 --- a/src/pages/b/the-planck-an-ortholinear-keyboard.md +++ b/src/content/blog/the-planck-an-ortholinear-keyboard.md @@ -1,13 +1,14 @@ --- -layout: '../../layouts/BlogPost.astro' -collection: blog +# layout: '../../layouts/BlogPost.astro' +# collection: blog issue: 5 author: Daniele Salvagni title: The Planck - An ortholinear keyboard -publishDate: 2022-07-29 +pubDate: 'Jul 29, 2022' +emoji: ⌨️ -excerpt: > +description: > My layout on the Plank, an ortholinear 40% keyboard. Why I like it more than normal keybaords and some pros of the QMK firmware. --- @@ -15,8 +16,8 @@ excerpt: > The Plank is an ortholinear 40% keyboard. **Ortholinear** means that the keys are arranged in a grid instead of on the staggered rows, which are just an historical artifact of typewriters having to avoid their levers smacking into -each other. Most common keyboard are Full-Sized with 104 keys, so having a **40% -keyboard** means we have much less, 47 keys in this case. +each other. Most common keyboards are Full-Sized with 104 keys, so having a +**40% keyboard** means we have many less keys, 47 in this case. Someone might think why you'd want such features, but I love both of them. I have been using it for at least a couple years and the ortholinear layout feels @@ -24,17 +25,16 @@ much more natural to me. It didn't take too long to adjust and now every key feels at its right place, no more having to use a different finger or to do a weird move to reach some of the keys with the staggered layout. The staggered layout is not uncomfortable, but there are always a couple keys which really -feel out of place for me. -The 40% part is also great, it means that my fingers never have to reach after -the only 4 available rows and thanks to multiple layers and the amazing -[QMK firmware](https://qmk.fm/) I have more functionality than what I'd have on -a full-size keyboard. +feel out of place for me. The 40% part is also great, it means that my fingers +never have to reach after the only 4 available rows and thanks to multiple +layers and the amazing [QMK firmware](https://qmk.fm/) I have more functionality +than what I'd have on a full-size keyboard. -![My Planck Keyboard](/assets/img/content/003/my-planck.png) +![My Planck Keyboard](/img/blog/planck/my-planck.png) -🔝 _Did I mention you also need to buy half Mechanical Switches and Keycaps?_ +💸 _Did I mention you also need to buy half Mechanical Switches and Keycaps?_ -# My current Keymap +## My current Keymap There are a lot of customizations you can do in the QMK Firmware, here are my main layers but there really is much more. The full code of my custom firmware @@ -85,10 +85,10 @@ little macro to send `=>`, pretty useful for writing Javascript. Some symbols like `{ } =` are pretty common in programming, so I placed those in a way where only one hand is required. -Brackets also have a special function, as an example: by tapping the `{}` -key, a single opening bracket `{` will be made, if I instead hold the key, -a macro will send both opening and closing brackets and place the cursor in -the middle by automatically tapping the left arrow key. +Brackets also have a special function, as an example: by tapping the `{}` key, a +single opening bracket `{` will be made, if I instead hold the key, a macro will +send both opening and closing brackets and place the cursor in the middle by +automatically tapping the left arrow key. ### RAISE Layer @@ -113,13 +113,13 @@ are `{$, €}` `{*, ×}` `{<, «}` `{>, »}` `{\, ÷}` and so on... ``` ,-----------------------------------------------------------------------. -|Tsk | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 |CAD | +|Tsk | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | CAD | |-----+-----+-----+-----+-----+-----------+-----+-----+-----+-----+-----| -|Caps | F11 | F12 | F13 |so.com| | | | |.log | |PSCR| +|Caps | F11 | F12 | F13 |stack| | | | |.log | | Prt | |-----+-----+-----+-----+-----+-----------+-----+-----+-----+-----+-----| | |LDSK |RDSK |WSrc |@@@@ |Vol- |Vol+ | | | |PgUp | | |-----+-----+-----+-----+-----+-----------+-----+-----+-----+-----+-----| -| | | | | | Mue |Ret | |Home |PgDn |End | +| | | | | | Mute | Ret | |Home |PgDn | End | `-----------------------------------------------------------------------' ``` @@ -127,12 +127,7 @@ Function keys `F1`-`F15`, `Print-Screen`, Volume controls, Mute button, `PageUp` and `PageDn`, a macro for the **Task Manager**, one for writing my **Email Address** and a couple more to switch to the left/right **Virtual Desktops**. -There is also a macro that if pressed once sends a mouse click, if tapped twice -it will keep sending mouse clicks multiple times a second until interrupted. - -![QMK Firmware](/assets/img/content/003/qmk-fw.png) - -If you don't want an ortholinear keyboard, I'd still suggest checking out the -QMK Firmware and what you can do with it by skimming through its documentation: -https://docs.qmk.fm/#/ -After using it once you won't go back to anything else. +> If you don't want an ortholinear keyboard, I'd still suggest checking out the +> QMK Firmware and what you can do with it by skimming through its +> documentation: https://docs.qmk.fm/#/ After using it once you won't go back to +> anything else. diff --git a/src/pages/b/unfair-gamers-com-a-community-10-years-later.md b/src/content/blog/unfair-gamers-com-a-community-10-years-later.md similarity index 62% rename from src/pages/b/unfair-gamers-com-a-community-10-years-later.md rename to src/content/blog/unfair-gamers-com-a-community-10-years-later.md index f1a1313..7ed24c6 100644 --- a/src/pages/b/unfair-gamers-com-a-community-10-years-later.md +++ b/src/content/blog/unfair-gamers-com-a-community-10-years-later.md @@ -1,13 +1,14 @@ --- -layout: '../../layouts/BlogPost.astro' -collection: blog +# layout: '../../layouts/BlogPost.astro' +# collection: blog issue: 4 author: Daniele Salvagni title: Unfair-Gamers.com - A community 10 years later -publishDate: 2018-07-24 +pubDate: 'Jul 24, 2018' +emoji: 👾 -excerpt: > +description: > Unfair-Gamers was as a gaming, modding and ethical online-game-hacking community. The main reason the community started was to learn and share the knowledge needed to create such tools, for us there was a more interesting @@ -15,18 +16,15 @@ excerpt: > engineering and creation. --- -![Unfair-Gamers Screenshot](/assets/img/content/002/ug-screenshot.png) +> A few weeks ago I was invited to a Whatsapp group called **Unfair-Gamers**, +> the name of an italian community website that I created back in **2009** while +> I still was in my teenage years and known online as `D4.Ny` (🤣). I was very +> happy and surprised to discover that many members of the community were able +> to stick together for this long after the website was closed. This is probably +> what prompted me to write this commemorative post, and also to serve as a +> point of reference for anyone that was involved. -A few weeks ago I was contacted by a group of people that asked me to join a -Whatsapp group called **Unfair-Gamers**, the name of an italian community -website that I created almost **10 years ago** while I still was in my teenage -years and known online as `D4.Ny` (🤣). I was very happy and surprised to -discover that many members of the community were able to stick together for this -long after the website was closed. This is probably what prompted me to write -this commemorative post, and also to serve as a point of reference for anyone -that was involved. - -![Unfair-Gamers](/assets/img/content/002/ug-splash.png) +![Unfair-Gamers](/img/blog/unfair-gamers/ug-splash.png) I would define Unfair-Gamers as a **gaming, modding and ethical game-hacking community**. The main reason the community started was to learn and share the @@ -40,12 +38,15 @@ were a lot of original releases accounting for millions of downloads, the main accomplishment was to produce knowledge in an expanding field where the information was still scarcely available on the web. -The community was most active in the timespan from 2010 to 2013, peaking at +![Unfair-Gamers Screenshot](/img/blog/unfair-gamers/ug-screenshot.png) + +The community was the most active in the timespan from 2010 to 2013, peaking at about **2 million** page views per month, more than 200k posts and 100k users -(of which 3k+ were active and 20k had at least one post, the remaining -registrations were mainly made just to lurk or download and use our releases). +(of which 3k+ I would define as active and more than 20k had at least one post, +the remaining registrations were mainly made just to lurk or download and use +our releases). -![Page Views Analytics](/assets/img/content/002/analytics-01.png) +![Page Views Analytics](/img/blog/unfair-gamers/analytics-01.png) _Peaks in the graph usually correspond to our major releases, Google Analytics was missing for a short period after a website redesign._ @@ -74,7 +75,7 @@ The main tools of the trade were: ### Example 1: Minimap replication _The game memory is being scanned for monsters and their attributes, a first @@ -84,7 +85,7 @@ canvas for demonstration purposes. (The game is Metin2)_ ### Example 2: Long range monster puller _The function responsible for damaging a monster is being called directly, @@ -103,47 +104,70 @@ being there every day to have a chat. A community that somehow still managed to survive until this day. Unfair-Gamers was fully shut down on **March 1st, 2014**, along with its smaller -sister community The Coders Bay. (After all these years, I'm still proud of its -minimal design) - - +sister community The Coders Bay. (After all these years, I have to say that I'm +still proud of its minimal design) -![The Coders Bay](/assets/img/content/002/the-coders-bay.png)] - - +![The Coders Bay](/img/blog/unfair-gamers/the-coders-bay.png) The reasons were mainly due to a shift in interests and priorities of the staff members and content creators, and I had less free time to keep the website -running and constantly releasing/updating game hacks. +running while constantly releasing/updating game hacks. It was also the end of an era of its kind, and as I said I like to think that in a way the community succeded in its intent, with all the information now being -available out there. It was a fun project and also an important phase of my life -to which I will always look back with a smile. +still available out there. It was a fun project and also an important phase of +my life to which I will always look back with a smile. # Bonus content - The top 15 members by post number were, in order: _Ryukizashi_, _ThePILLI_, _GLyTCH_, _Zyrel_, _ionut_baluca_, _D4.Ny_, _xXStephXx_, _vezdebest_, _Sakawa_, _Kingblast_, _MrTiz_, _ActionMan95_, _Sky92_, _Zioborn_, _Madara - Uchiha_. ([Top 100](/assets/img/content/002/users-100.txt)) + Uchiha_. ([Top 100](/img/blog/unfair-gamers/users-100.txt)) - The most viewed posts were Metin2 hacks and bots by _D4.Ny_, Metin2 private server guides by _Kingblast_ and a Dark Orbit bot by _SnFede_. -- A [style revamp](/assets/img/content/002/unreleased-mockup.png) was also in +- A [style revamp](/img/blog/unfair-gamers/unreleased-mockup.png) was also in the works, but I never had the time to complete it. - The green emoticons - used on + used on _The Coders Bay_ can be donwloaded - [here](/assets/img/content/002/cb-emoticons.zip). + [here](/img/blog/unfair-gamers/cb-emoticons.zip). - I was going to release one last bot for Metin2, but my testing account was - banned in the process, after passing undetected for years. I was tired and - didn't want to create a new one. 🪦 + banned in the process, after passing undetected for years. I was too tired to + create a new one. 🪦 + +## Meeting + +In December 2019, a few of us were able to meet in person in Milan. + +
    + Meet img 1 + Meet img 2 +
    _Were you a member of Unfair-Gamers? Leave your story below!_ -
    +
    + + diff --git a/src/content/config.ts b/src/content/config.ts new file mode 100644 index 0000000..f773711 --- /dev/null +++ b/src/content/config.ts @@ -0,0 +1,33 @@ +import { defineCollection, z } from 'astro:content'; + +const blog = defineCollection({ + // Type-check frontmatter using a schema + schema: z.object({ + title: z.string(), + description: z.string(), + // Transform string to Date object + pubDate: z.coerce.date(), + updatedDate: z.coerce.date().optional(), + heroImage: z.string().optional(), + emoji: z.string().optional(), + issue: z.number().optional(), + }), +}); + +const software = defineCollection({ + schema: z.object({ + title: z.string(), + description: z.string(), + order: z.number(), + emoji: z.string().optional(), + }), +}); + +const notes = defineCollection({ + schema: z.object({ + title: z.string(), + description: z.string().optional(), + }), +}); + +export const collections = { blog, software, notes }; diff --git a/src/content/notes/aliases.md b/src/content/notes/aliases.md new file mode 100644 index 0000000..c82dfd1 --- /dev/null +++ b/src/content/notes/aliases.md @@ -0,0 +1,99 @@ +--- +title: aliases +--- + +### Search + +```sh +alias ag='alias | grep ' +alias ff='find . -type f -name' +``` + +### One letter + +```sh +alias c='clear' +alias g='git' +alias h='history' +alias r='source ~/.zshrc' +``` + +### Grep pipe + +```sh +grep_pipe() { + grep "$@" +} +alias G=grep_pipe +``` + +### Common defaults + +```sh +alias rm='rm -i' +alias cp='cp -i' +alias mv='mv -i' + +alias grep='grep -n --color' +alias mkdir='mkdir -pv' +alias ping='ping -c 5' +``` + +### Common aliases + +```sh +alias home='cd ${HOME}' +alias unexport='unset' +``` + +### Navigation + +```sh +alias ..='cd ..' +alias ...='cd ../..' +alias ....='cd ../../..' +alias .....='cd ../../../..' +alias ......='cd ../../../../..' +``` + +### Other + +```sh +alias offrecord='history -d $(history 1)' +``` + +### Python + +```sh +alias py='python3' +alias serve='python3 -m http.server' +``` + +### Node + +```sh +alias rnm='rm -rf node_modules' +alias nlg='npm list -g --depth 0' # global installed +alias nrb='npm run build' +alias nrs='npm run start' +alias nrd='npm run dev' +alias nrt='npm run test' +``` + +### List directory contents + +```sh +alias l='ls -lFh' # size,show type,human readable +alias la='ls -lAFh' # long list,show almost all,show type,human readable +alias ll='ls -la' # long list, show almost all +alias l.='ls -ldh .*' # show hidden files +alias lsn='ls -1' # one column with name of files and directories +``` + +### Image optimizer + +```sh +alias iow='npx @squoosh/cli --webp auto ' +alias ioa='npx @squoosh/cli --avif auto ' +alias iop='npx @squoosh/cli --oxipng auto ' +``` diff --git a/src/content/notes/aws-cli.md b/src/content/notes/aws-cli.md new file mode 100644 index 0000000..acf7f7e --- /dev/null +++ b/src/content/notes/aws-cli.md @@ -0,0 +1,152 @@ +--- +title: aws-cli +--- + +## Profiles + +The following commands are available through the `aws` zsh plugin: + +```sh +aws_profiles # list available profiles +asp [] # set profile (or clear it) +agp # get current profile +asr [] # set region (or clear it) +agr # get current region +``` + +To create a new profile, use the `aws configure --profile ` command. + +Use [Leapp](https://www.leapp.cloud/) to manage multiple AWS profiles easily +with support for browser containers. + +## IAM + +List users in table format + +```sh +aws iam list-users –output table +``` + +List users by ARN + +```sh +aws iam list-users –output json | jq -r .Users[].Arn +``` + +## API Gateway + +List domain names + +```sh +aws apigateway get-domain-names | jq -r ‘.items[ ] | .domainName+” “+.regionalDomainName’ +``` + +## CloudFront + +Create a new invalidation + +```sh +aws cloudfront create-invalidation +``` + +## EC2 + +### EC2 ssh + +```sh +chmod 0400 keypair.pe` +ssh -i keypair.pem ec2-user@ +``` + +## S3 + +Create / delete a bucket + +```sh +aws s3 mb s3://bucket +aws s3 rb s3://bucket --force +``` + +Object operations + +```sh +aws s3 ls +aws s3 ls s3://bucket/folder --recursive --human-readable --summarize + +aws s3 cp s3://bucket/object.json . +aws s3 cp folder s3://bucket/folder --recursive + +aws s3 rm s3://bucket/object.json +aws s3 rm s3://bucket/folder --recursive + +aws s3 sync s3://bucket/folder . +aws s3 sync . s3://bucket/folder --exclude *.tmp +``` + +Move an S3 Bucket to a different location + +```sh +aws s3 sync s3://oldbucket s3://newbucket --source-region us-west-1 --region us-west-2 +``` + +## DynamoDB + +List tables + +```sh +aws dynamodb list-tables | jq -r .TableNames [ ] +``` + +## SAM + +```sh +sam init +sam validate +sam build +sam deploy [--guided] +sam delete +``` + +SAM Accelerate: + +```sh +sam sync -t template.yaml \ + --stack-name \ + --resource-id \ + --region eu-central-1 +``` + +## CloudFormation + +Validate a CloudFormation template before launching it + +```sh +aws cloudformation validate-template --region eu-west-1 --template-url https://s3-eu-west-1.amazonaws.com/ca/ca.cftemplate +``` + +## RDS + +List the available db engines +(`aurora-mysql`,`aurora-postgresql`,`custom-oracle-ee`,`mariadb`,`mysql`,`oracle-ee`,`oracle-ee-cdb`,`oracle-se2`,`oracle-se2-cdb`,`postgres`,`sqlserver-ee`,`sqlserver-se`,`sqlserver-ex`,`sqlserver-web`): + +```sh +aws rds describe-db-engine-versions --region eu-west-1 --output json --query 'DBEngineVersions[*].{Engine:Engine,EngineVersion:EngineVersion,DBEngineDescription:DBEngineDescription}' > db-engines.json +``` + +List the available db instances for a given engine: + +```sh +aws rds describe-orderable-db-instance-options --region eu-west-1 --output json --engine sqlserver-ee --query 'OrderableDBInstanceOptions[*].{Engine:Engine,EngineVersion:EngineVersion, DBInstanceClass:DBInstanceClass}' > db-instances.json +``` + +## SQS + +```sh +aws sqs list-queues | jq -r ‘.QueueUrls[ ]’ +aws sqs create-queue --queue-name public-events.fifo | jq -r .queueURL +aws sqs send-message --queue-url (url) --message-body (message) +aws sqs receive-message --queue-url (url) | jq -r ‘.Messages[ ] | .Body’ +aws sqs delete-message --queue url (url) --receipt-handle (receipt handle) +aws sqs purge-queue --queue-url (url) +aws sqs delete-queue --queue-url (url) +``` diff --git a/src/pages/c/aws.md b/src/content/notes/aws.md similarity index 56% rename from src/pages/c/aws.md rename to src/content/notes/aws.md index 333658a..411de67 100644 --- a/src/pages/c/aws.md +++ b/src/content/notes/aws.md @@ -1,9 +1,8 @@ --- -layout: '../../layouts/CodeSnippet.astro' title: aws --- -# Lambda +## Lambda ### Lambda Log Retention @@ -11,51 +10,34 @@ title: aws Resources: Function: Type: AWS::Serverless::Function - Properties: - CodeUri: . - Runtime: python3.8 - Handler: main.handler - Tracing: Active + Properties: ... - # Explicit log group that refers to the Lambda function LogGroup: Type: AWS::Logs::LogGroup Properties: LogGroupName: !Sub '/aws/lambda/${Function}' - # Explicit retention time RetentionInDays: 7 ``` -### Typescript Lambda +> It looks like this won't be changed any time soon: +> [GitHub Issue](https://github.com/aws/serverless-application-model/issues/257) + +### Typescript Lambda (API Gateway Proxy) + +Typescript boilerplate ```ts import { APIGatewayProxyEvent, APIGatewayProxyResult } from 'aws-lambda'; export const lambdaHandler = async ( - event: APIGatewayProxyEvent + event: APIGatewayProxyEvent, ): Promise => { - if (event.httpMethod !== 'GET') { - throw new Error(`only accepts GET method, you tried: ${event.httpMethod}`); - } - - const id = event.pathParameters.id; - const item = id; // ... get item from DynamoDB - - const response: APIGatewayProxyResult = { - statusCode: 200, - body: JSON.stringify(item) - }; - - // All log statements are written to CloudWatch - console.info( - `response from: ${event.path} - statusCode: ${response.statusCode} - body: ${response.body}` - ); - return response; + // ... }; ``` +SAM CloudFormation Template + ```yaml Resources: GetItemByIdFunction: @@ -67,7 +49,7 @@ Resources: Target: es2020 EntryPoints: - app.ts - External: + External: # to be found in the dependency layer, will not be bundled - '@aws-sdk/client-dynamodb' - '@aws-sdk/lib-dynamodb' Properties: @@ -78,7 +60,7 @@ Resources: SAMPLE_TABLE: !Ref SampleTable Handler: app.lambdaHandler Layers: - - !Ref LayerAwsSdkJsV3 + - !Ref DependencyLayer Policies: - DynamoDBCrudPolicy: TableName: !Ref SampleTable @@ -89,3 +71,24 @@ Resources: Path: /{id} Method: GET ``` + +### EventBridge Event type definition + +Example of an EventBridge event type definition for an S3 Object Created event +(the documentation currently lacks on this topic) + +```ts +import { + EventBridgeEvent, + S3ObjectCreatedNotificationEventDetail, +} from 'aws-lambda'; + +export const handler = async ( + event: EventBridgeEvent< + 'Object Created', + S3ObjectCreatedNotificationEventDetail + >, +): Promise => { + console.log('event: ', JSON.stringify(event, null, 2)); +}; +``` diff --git a/src/pages/c/cron.md b/src/content/notes/cron.md similarity index 96% rename from src/pages/c/cron.md rename to src/content/notes/cron.md index de97126..eb87c50 100644 --- a/src/pages/c/cron.md +++ b/src/content/notes/cron.md @@ -1,5 +1,4 @@ --- -layout: '../../layouts/CodeSnippet.astro' title: cron --- diff --git a/src/pages/c/css.md b/src/content/notes/css.md similarity index 95% rename from src/pages/c/css.md rename to src/content/notes/css.md index 768b4d3..e4f26c5 100644 --- a/src/pages/c/css.md +++ b/src/content/notes/css.md @@ -1,9 +1,8 @@ --- -layout: '../../layouts/CodeSnippet.astro' title: css --- -# Selectors +## Selectors ### Combinators ```css diff --git a/src/content/notes/docker.md b/src/content/notes/docker.md new file mode 100644 index 0000000..1f24238 --- /dev/null +++ b/src/content/notes/docker.md @@ -0,0 +1,82 @@ +--- +title: docker +--- + +CLI Reference - https://docs.docker.com/engine/reference/run/ + +### IMAGE BASICS + + docker build -t . # build a new image from Dockerfile + docker images # list the most recently created images + docker image prune # delete dangling images + docker run -it sh # create and start shell in interactive mode + docker commit # create an image out of a container + +### RUN A CONTAINER + + docker run + docker run -d # run in the background + docker run —name # to give a custom name + +### CONTAINER NETWORKING + + docker run —p 3000:3000 # to publish a port HOST:CONTAINER + docker run —P # to map all ports + docker run --hostname # assign an hostname + docker run --add-host # add a dns entry + docker port # show mapped ports of a container + +### STOPPING & STARTING CONTAINERS + + docker stop + docker start # start a stopped container + +### LISTING CONTAINERS + + docker ps # to list running containers + docker ps -a # to list all containers + +### EXECUTING COMMANDS IN RUNNING CONTAINERS + + docker exec + docker exec -it sh # to start a shell + +### VIEWING THE LOGS + + docker logs + docker logs -f # to follow the log + docker logs —t # to add timestamps + docker logs —n 10 # to view the last 10 lines + +### REMOVING CONTAINERS + + docker container rm + docker rm + docker rm -f # to force the removal + docker container prune # to remove stopped containers + +### VOLUMES + + docker volume ls + docker volume create app-data + docker volume inspect app-data + docker run -v app-data:/app-data ls /app-data + +### COPYING FILES BETWEEN HOST AND CONTAINERS + + docker cp :/app/log.txt . + docker cp secret.txt :/app + +### SHARING SORUCE CODE WITH CONTAINERS + + docker run -v $(pwd):/app + +### MULTI-CONTAINER APPS + + docker-compose build + docker-compose build --no-cache + docker-compose updocker-compose up -d + docker-compose up —build + docker-compose down + docker-compose ps + docker-compose logs diff --git a/src/content/notes/git.md b/src/content/notes/git.md new file mode 100644 index 0000000..0ed9a92 --- /dev/null +++ b/src/content/notes/git.md @@ -0,0 +1,132 @@ +--- +title: git +--- + +## Configuration + +```bash +git config --global user.email "daniele.salvagni@gmail.com" +git config --global user.name "Daniele Salvagni" +git config --global core.editor nano +git config --global help.autocorrect 1 +``` + +## Basic commands + +### Remote + +```bash +git remote add # add git URL as an alias +git fetch # fetch down all the **branches** from that remote +git merge / # merge a remote branch into current branch +git push # transmit local branch to remote repository +git pull # fetch and merge any commits from remote +``` + +### Stash + +```bash +git stash # save modified and staged changes +git stash -u # include untracked files +git stash list # list stack-order of stashed file changes +git stash pop # write working from top of stash stack +git stash drop [id] # discard the changes from top of stack or by [id] + +# alternative to include a message +git stash save "your stash message" +``` + +### Remove an ignored file from git + +This will remove a file from git that has been added to .gitignore while keeping +it in the working directory + +```bash +git rm --cached +``` + +### Listing branches + +```bash +git branch # local branches +git branch -r # remote branches +git branch -a # all branches +git branch -av # all branches with details +``` + +### Tagging + +```bash +git tag -a v1.0.0 -m "The first official version" +git show v1.0.0 +git describe --tags + +git push --tags +git push origin v1.0.0 # same effect +``` + +### Rewrite history + +Apply any commits of current branch ahead of specified one + +```bash +git rebase +``` + +Clear staging area, rewrite working tree from specified commit + +```bash +git reset --hard +``` + +## Advanced commands + +### Backup untracked files + +```bash +git ls-files --others --exclude-standard -z |\ +xargs -0 tar rvf ~/backup-untracked.zip +``` + +### Sync with remote, overwrite local changes + +```bash +git fetch origin && git reset --hard origin/master && git clean -f -d +``` + +### Undo last commit but keep changed files in stage + +```bash +uncommit = reset --soft HEAD~1 +``` + +### Reset a single file + +To reset both the working copy and its state in the Git index to that of HEAD: + +```bash +git checkout HEAD -- file.txt +``` + +### Rebase local branch to remote master + +```bash +git pull --rebase origin master +``` + +or + +```bash +git fetch origin +git rebase origin/master +``` + +### Counting commits + +```bash +git shortlog -s -n +``` + +## Overview + +![Git Overview](/img/notes/git/git-overview.png) diff --git a/src/pages/c/github.md b/src/content/notes/github.md similarity index 96% rename from src/pages/c/github.md rename to src/content/notes/github.md index e7ebe2c..c912a3c 100644 --- a/src/pages/c/github.md +++ b/src/content/notes/github.md @@ -1,5 +1,4 @@ --- -layout: '../../layouts/CodeSnippet.astro' title: github --- diff --git a/src/pages/c/javascript.md b/src/content/notes/js.md similarity index 90% rename from src/pages/c/javascript.md rename to src/content/notes/js.md index 0fa97f4..ed117b9 100644 --- a/src/pages/c/javascript.md +++ b/src/content/notes/js.md @@ -1,6 +1,5 @@ --- -layout: '../../layouts/CodeSnippet.astro' -title: javascript +title: js --- # Promises diff --git a/src/pages/c/jsdoc.md b/src/content/notes/jsdoc.md similarity index 96% rename from src/pages/c/jsdoc.md rename to src/content/notes/jsdoc.md index 7751734..870e22d 100644 --- a/src/pages/c/jsdoc.md +++ b/src/content/notes/jsdoc.md @@ -1,5 +1,4 @@ --- -layout: '../../layouts/CodeSnippet.astro' title: jsdoc --- diff --git a/src/content/notes/linux.md b/src/content/notes/linux.md new file mode 100644 index 0000000..b9e106a --- /dev/null +++ b/src/content/notes/linux.md @@ -0,0 +1,31 @@ +--- +title: linux +--- + +## Disable user + +Disable the user named `guestuser` from logging in, including via `ssh` + + sudo usermod --expiredate 1 guestuser + +## Text search + +Look for text in all files in the current directory recursively + + grep -Hrn . + +## Disk usage + +List all available partitions to mount + + lsblk + +Mount drive the easy way + + udisksctl mount -b /dev/sd[letter][number] + +## Files + +File copier with progress bar + + rsync -vau diff --git a/src/pages/c/macos.md b/src/content/notes/macos.md similarity index 84% rename from src/pages/c/macos.md rename to src/content/notes/macos.md index 67ba6a1..b9d723c 100644 --- a/src/pages/c/macos.md +++ b/src/content/notes/macos.md @@ -1,16 +1,17 @@ --- -layout: '../../layouts/CodeSnippet.astro' title: macos --- -# Apps +## Apps ### In use - **Dropover**: [link](https://dropoverapp.com/) - Drag and drop stash -- **Fig**: [link](https://fig.io) - IDE Style autocomplete for terminals - **Iina**: [link](https://iina.io/) - Modern media player +- **Heynote**: [link](https://heynote.com/) - Scratchpad notes +- **Leapp**: [link](https://www.leapp.cloud/) - AWS profile manager - **Numi**: [link](https://numi.app/) - Notepad-style calculator app +- **Raycast**: [link](https://raycast.com/) - Spotlight alternative - **Rectangle**: [link](https://rectangleapp.com/) - Window snap areas ### Others @@ -20,6 +21,7 @@ title: macos - **Bartender**: [link](https://www.macbartender.com/) - Menu bar manager - **Cleanshot X**: [link](https://cleanshot.com/) - Screenshot and recorder - **Cot Editor**: [link](https://coteditor.com/) - Plain text editor +- **Fig**: [link](https://fig.io) - IDE Style autocomplete for terminals - **Karabiner**: [link](https://karabiner-elements.pqrs.org/) - Keyboard customizer - **Keka**: [link](https://www.keka.io/en/) - File archiver @@ -31,3 +33,7 @@ title: macos - **rcmd**: [link](https://lowtechguys.com/rcmd/) - Fast app switcher - **Transmit**: [link](https://panic.com/transmit/) - File transfer app - **Velja**: [link](https://sindresorhus.com/velja) - Powerful browser picker + +## Settings + +Here be dragons. diff --git a/src/pages/c/oh-my-zsh.md b/src/content/notes/oh-my-zsh.md similarity index 76% rename from src/pages/c/oh-my-zsh.md rename to src/content/notes/oh-my-zsh.md index ec94c6f..2b063ec 100644 --- a/src/pages/c/oh-my-zsh.md +++ b/src/content/notes/oh-my-zsh.md @@ -1,5 +1,4 @@ --- -layout: '../../layouts/CodeSnippet.astro' title: oh-my-zsh --- diff --git a/src/pages/c/python.md b/src/content/notes/python.md similarity index 74% rename from src/pages/c/python.md rename to src/content/notes/python.md index 8aa3f48..a38d6be 100644 --- a/src/pages/c/python.md +++ b/src/content/notes/python.md @@ -1,12 +1,7 @@ --- -layout: '../../layouts/CodeSnippet.astro' title: python --- -# NumPy - - pip install numpy - ### Saving a matrix of random numbers to file ```py diff --git a/src/content/notes/racing.md b/src/content/notes/racing.md new file mode 100644 index 0000000..8b9d5b0 --- /dev/null +++ b/src/content/notes/racing.md @@ -0,0 +1,89 @@ +--- +title: racing +--- + +## Track Notes: GT3 Imola + +![Imola Track](/img/tracks/Imola_2009.svg) + +> Courtesy of +> [Wikipedia - Imola Circuit](https://en.wikipedia.org/wiki/Imola_Circuit) + +The following are some track notes for the Imola circuit to act as a quick +reference for **GT3** racing. Some gears might vary depending on the car. + +## Target lap times + +``` +Pro: 1:39.5 +Pro-Am: 1:42.0 +Am: 1:44.0 +``` + +## Track guide + +### Sector 1 + +**Turn 1 - Variante Bassa**: straight line. + +**Turn 2 - Variante Tamburello**: braking point is just after the orange +emergency exit marker. Shift down to `2nd`, careful with the turtle curb as it +can unsettle the car. + +**Turn 3 - Variante Tamburello**: better to avoid the yellow curbs to be able to +apply throttle earlier in `2nd/3rd` gear. Do not use the exit curb but try to +stay in the middle of the track to prepare for the next turn. + +**Turn 4 - Variante Tamburello**: can be taken full throttle in dry conditions, +potentially shifting up to `4th` gear. The exit has a serrated curb, use it +fully only if dry. Shouldn't worry about track limits here. + +**Turn 5 - Variante Villeneuve**: braking point is at the 50m board. Shift down +to `4th/3rd` gear, careful with the yellow curbs. Sacrifice the exit by keeping +the car on the left. + +**Turn 6 - Variante Villeneuve**: start braking as soon as the car is straight +down to `3rd/2nd` gear, pay attention to the yellow curbs. Serrated curb on the +exit, use it fully in dry conditions without worrying about track limits. + +### Sector 2 + +**Turn 7 - Tosa**: braking point is at the 50m board, down to `2nd/1st` gear +with a late apex at focusing on the exit. Serrated curb on exit should be +avoided in wet conditions. + +**Turn 8**: kink. + +**Turn 9 - Piratella**: braking point is at the 50m board, apex while using the +inside curb in `3rd` gear, just after the two yellow curbs. Serrated curb on +exit, careful with the track limits. + +**Turn 10**: continuation of turn 9, keep the car on the left side. + +**Turn 11 - Acque Minerali**: braking point is at the 50m board, down to `3rd` +gear, turn the car in to just touch the apex in 4th gear. + +**Turn 12 - Acque Minerali**: slow down as soon as possible to `2nd` gear. Try +to take advantage of the compression as the track goes uphill. + +**Turn 13 - Acque Minerali**: on the exit of turn 12, use the serrated curb in +dry conditions. Be careful wiht track limits. + +### Sector 3 + +**Turn 14/15 - Variante Alta**: start braking just before the start of the left +curbing, shifting down to `2nd/1st` gear to thread the car between the sausage +curbs. On exit, do not go past the serrated curb to avoid track limits. + +**Turn 16**: straighten the car on exit as soon as possible to prepare for the +next turn. + +**Turn 17 - Rivazza**: braking zone is downhill and should start as soon as the +car is straight near the 100m board, shifting down to `2nd/1st` gear. No need to +worry about track limits (avoid gravel). + +**Turn 18 - Rivazza**: just before the end of the right curb, shortly tap the +brakes and take the turn in `1st/2nd` gear. Avoid the inside yellow curb while +using the exit serrated curb in dry conditions. + +**Turn 19**: fast kink. diff --git a/src/pages/c/react.md b/src/content/notes/react.md similarity index 90% rename from src/pages/c/react.md rename to src/content/notes/react.md index e639d74..ebc6dd4 100644 --- a/src/pages/c/react.md +++ b/src/content/notes/react.md @@ -1,9 +1,8 @@ --- -layout: '../../layouts/CodeSnippet.astro' title: react --- -# Updating a state object +## Updating a state object ### Through Input diff --git a/src/pages/c/tar.md b/src/content/notes/tar.md similarity index 95% rename from src/pages/c/tar.md rename to src/content/notes/tar.md index efe4a44..473d541 100644 --- a/src/pages/c/tar.md +++ b/src/content/notes/tar.md @@ -1,5 +1,4 @@ --- -layout: '../../layouts/CodeSnippet.astro' title: tar --- diff --git a/src/pages/c/vscode.md b/src/content/notes/vscode.md similarity index 84% rename from src/pages/c/vscode.md rename to src/content/notes/vscode.md index b4f6d5f..017e41e 100644 --- a/src/pages/c/vscode.md +++ b/src/content/notes/vscode.md @@ -1,9 +1,10 @@ --- -layout: '../../layouts/CodeSnippet.astro' title: vscode --- -# Basic editing +## Shortcuts + +### Basic editing ``` ⌥↓ Move line down @@ -18,7 +19,7 @@ title: vscode ⌘/ Toggle line comment ``` -# Multi-cursor and selection +### Multi-cursor and selection ``` ⌥• Insert cursor @@ -27,7 +28,7 @@ title: vscode ⌘U Undo last cursor operation ``` -# Search and replace +### Search and replace ``` ⌘F Find @@ -38,3 +39,7 @@ title: vscode ``` [More shortcuts...](https://code.visualstudio.com/shortcuts/keyboard-shortcuts-macos.pdf) + +## Settings + +Here be dragons. diff --git a/src/content/software/about-this-site.md b/src/content/software/about-this-site.md new file mode 100644 index 0000000..4e1c76f --- /dev/null +++ b/src/content/software/about-this-site.md @@ -0,0 +1,48 @@ +--- +title: 'About this site' +emoji: 🚧 +order: 99 + +description: | + Statically generated with Astro, deployed to AWS. +--- + +This website is statically generated and using **[Astro](https://astro.build/)** +since its 1.0.0-rc.1 version. + +```sh +. +├── public/ +└── src/ + ├── components/ # components to re-use inside pages + ├── content/ # collections of content + ├── layouts/ # page layouts + ├── pages/ # pages exposed as routes (dynamic routes with [brackets]) + └── style/ # global styles +``` + +Every time a commit is pushed, +[GitHub Actions](https://github.com/features/actions) will build and deploy this +website to an [AWS S3](https://aws.amazon.com/s3/) bucket. + +Source code: https://github.com/daniele-salvagni/dan.salvagni.io + +## Old stack + +The stack mentioned above is replacing the following one: + +> [Gulp](http://gulpjs.com/) is used to automate the build process. The base of +> the site generator is [Metalsmith](http://www.metalsmith.io/), the stylesheets +> are compiled from SASS using the [Bourbon](http://bourbon.io/) library and +> [Neat](https://neat.bourbon.io/) for the responsive grid. Templates are +> written with [Handlebars](http://handlebarsjs.com/) and the content in +> Markdown with YAML frontmatter. Comments to the blog posts are retrieved from +> this repository's issue page using GitHub's API and rendered using +> [Vue.js](https://vuejs.org). +> +> After a succesful build the website is automatically deployed by +> [Travis](https://travis-ci.org/) on an [AWS S3](https://aws.amazon.com/s3/) +> bucket. +> +> Last commit with the old stack on Github: +> [49d02f4](https://github.com/daniele-salvagni/dan.salvagni.io/tree/8683abe17b23604994093feea37b9d0b1656da4d) diff --git a/src/pages/s/color-goggles.md b/src/content/software/color-goggles.md similarity index 64% rename from src/pages/s/color-goggles.md rename to src/content/software/color-goggles.md index ce9e81a..d8f8686 100644 --- a/src/pages/s/color-goggles.md +++ b/src/content/software/color-goggles.md @@ -1,74 +1,67 @@ ---- -layout: '../../layouts/SoftPost.astro' -collection: soft -order: 1 - -author: Daniele Salvagni -title: Color Goggles -description: Saturation manager for Intel™ laptops. -publishDate: 2019-12-28 - -excerpt: > - ColorGoggles is an extremely lightweight application that automatically - manages your digital saturation when playing games to enhance visibility. This - is an alternative to VibranceGUI for Intel HD Graphics or dual-graphics - laptops. ---- - -![ColorGoggles](/assets/img/content/colorgoggles.png) - -

    Saturation manager for Intel™ and Dual-Graphics laptops.

    - -
    - - -
    - -ColorGoggles is an extremely lightweight application that automatically manages -your digital saturation (**unlocked up to 320%**) when opening certain games or -software to enhance visibility. - -This is an alternative to VibranceGUI for **Intel HD Graphics** or -**dual-graphics laptops**. The application is absolutely VAC safe, it does use -the same functions as the Intel Control Panel but with the limits removed, many -professional players are also known to tweak their digital saturation. - -Intel did not release any public APIs so I had to make this tool by reverse -engineering the Intel Control Panel and some related driver libraries, contact -me if you have any problems. - -ℹ️ At the moment this app might need an update, Intel changed many things again -and it may have issues with some newer drivers on some devices. - -## Installation instructions - -- **Download** and extract the .zip archive -- Open `C:\Windows\System32` and use the **Search** function to find a file - named `igfxDHLib.dll` (_it sould be in the `DriverStore` subfolder but that's - not always the case_) -- **Copy** of `igfxDHLib.dll` in the same folder as `Color-Goggles.exe` -- **Run** `Color-Goggles.exe` - -There are multiple versions of `igfxDHLib.dll` depending on your drivers version -and device, so you must use your own. If you can't find this file your drivers -are either too old or your device is not supported, there are a couple -discussions about this on GitHub with more information. - -
    - -
    - -You can always find the latest releases (along with the sourcecode) on -**GitHub**: https://github.com/daniele-salvagni/color-goggles/releases - - +--- +title: 'Color Goggles' +emoji: 🌈 +order: 2 + +description: | + Saturation manager for Intel™ and Dual-Graphics laptops, made by reverse engineering. +--- + +![ColorGoggles](/img/cg/colorgoggles.png) + +

    Saturation manager for Intel™ and Dual-Graphics laptops.

    + +
    + + +
    + +ColorGoggles is an extremely lightweight application that automatically manages +your digital saturation (**unlocked up to 320%**) when opening certain games or +software to enhance visibility. + +This is an alternative to VibranceGUI for **Intel HD Graphics** or +**dual-graphics laptops**. The application is absolutely VAC safe, it does use +the same functions as the Intel Control Panel but with the limits removed, many +professional players are also known to tweak their digital saturation. + +Intel did not release any public APIs so I had to make this tool by reverse +engineering the Intel Control Panel and some related driver libraries. + +> **!** At the moment this app might need an update, Intel replaced the Intel Graphics +> Control Pane with a new Command Center which changed many things again, so this tool +> might not work on devices with the latest drivers. + +## Installation instructions + +- **Download** and extract the .zip archive +- Open `C:\Windows\System32` and use the **Search** function to find a file + named `igfxDHLib.dll` (_it sould be in the `DriverStore` subfolder, but that's + not always the case_) +- **Copy** of `igfxDHLib.dll` in the same folder as `Color-Goggles.exe` +- **Run** `Color-Goggles.exe` + +*There are multiple versions of `igfxDHLib.dll` depending on your drivers version +and device, so you must use your own. If you can't find this file your drivers +are either too old or your device is not supported, there are a couple +discussions about this on GitHub with more information.* + +
    + +
    + +You can always find the latest releases (along with the sourcecode) on +**GitHub**: https://github.com/daniele-salvagni/color-goggles/releases + + diff --git a/src/pages/s/grid-generator.md b/src/content/software/grid-generator.md similarity index 67% rename from src/pages/s/grid-generator.md rename to src/content/software/grid-generator.md index 41a9287..6633f89 100644 --- a/src/pages/s/grid-generator.md +++ b/src/content/software/grid-generator.md @@ -1,128 +1,123 @@ ---- -layout: '../../layouts/SoftPost.astro' -collection: soft -order: 2 - -author: Daniele Salvagni -title: Grid Generator -description: Pen input calibration tool with live preview. -publishDate: 2018-07-22 - -excerpt: > - A tool for generating calibration grids for pen input on Windows. Supports any - resolution with any number of calibrations points which will be more densely - distributed towards the edges. ---- - -

    Grid generator for pen input calibration on Windows™ with live preview.

    - -
    - - - - - - -

    - -

    The point distribution will be more dense at the edges and gradually decrease towards the middle. A margin of 10px will be kept around the screen to allow for better accuracy. This tool will generate:

    - -\- A grid of x - points for a - x - px resolution. - -

    The grid will have a total of {{ hpts * vpts }} points. Copy and paste the following string in a Command Prompt to start the calibration:

    - -
    
    -  {{ cmnd }}
    -  
    - -
    -

    During the calibration process you should hold your pen in the same way you would hold it comfortably, it is also important that you try to be as *physically* accurate as possible while disregarding the on-screen indicator of the pen position.

    - -
    - - - - - +--- +title: 'Grid Generator' +emoji: 📐 +order: 3 + +description: | + Pen input calibration tool for Windows with live preview. +--- + +

    Grid generator for pen input calibration on Windows™ with live preview.

    + +
    + + + + + + +

    This tool is for calibrating the pen input on Windows devices. It will generate a grid of points that you will have to tap with your pen.

    + +

    The point distribution will be more dense at the edges and gradually decrease towards the middle. A margin of 10px will be kept around the screen to allow for better accuracy.

    + +

    This will generate a grid of x + points for a + x + px resolution. +

    + +

    The grid will have a total of {{ hpts * vpts }} points. Copy and paste the following string in a Command Prompt to start the calibration:

    + +
    
    +  {{ cmnd }}
    +  
    + +

    During the calibration process you should hold your pen in the same way you would hold it comfortably, it is also important that you try to be as physically accurate as possible while disregarding the on-screen indicator of the pen position.

    + +
    + + + + + diff --git a/src/env.d.ts b/src/env.d.ts index 8c34fb4..acef35f 100644 --- a/src/env.d.ts +++ b/src/env.d.ts @@ -1 +1,2 @@ -/// \ No newline at end of file +/// +/// diff --git a/src/layouts/BasePage.astro b/src/layouts/BasePage.astro new file mode 100644 index 0000000..6cc1016 --- /dev/null +++ b/src/layouts/BasePage.astro @@ -0,0 +1,27 @@ +--- +import BaseHead from '../components/BaseHead.astro'; +import Header from '../components/Header.astro'; +import Footer from '../components/Footer.astro'; + +import { SITE_TITLE, SITE_DESCRIPTION } from '../consts'; + +const { title, description } = Astro.props; +--- + + + + + + + + +
    +
    + +
    +