3 Commits

Author SHA1 Message Date
2e9ef56e17 Use YAML front matter 2021-10-24 18:08:49 -05:00
b0e305dd78 Translate new comment system again post 2021-10-24 18:08:48 -05:00
9176c207a4 Translate first new comment system post 2021-10-24 18:08:48 -05:00
58 changed files with 288 additions and 1323 deletions

View File

@ -1,59 +0,0 @@
name: Audit
on:
push:
jobs:
audit:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
fetch-depth: 0
ref: ${{github.event.pull_request.head.ref}}
repository: ${{github.event.pull_request.head.repo.full_name}}
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: latest
extended: true
- name: Build
run: |
HUGO_MINIFY_TDEWOLFF_HTML_KEEPCOMMENTS=true HUGO_ENABLEMISSINGTRANSLATIONPLACEHOLDERS=true hugo --printI18nWarnings --printPathWarnings
# For the following steps, see
# https://discourse.gohugo.io/t/audit-your-published-site-for-problems/35184
- name: Audit - raw HTML
if: always()
run: |
! grep -inorE "<\!-- raw HTML omitted -->" public/
- name: Audit - ZgotmplZ (unsafe URL content)
if: always()
run: |
! grep -inorE "ZgotmplZ" public/
#- name: Audit - missing translations
# if: always()
# run: |
# ! grep -inorE "\[i18n\]" public/
- name: Audit - nil values in printf
if: always()
run: |
! grep -inorE "\(<nil>\)" public/
- name: Audit - nil values in printf without safeHTML
if: always()
run: |
! grep -inorE "(&lt;nil&gt;)" public/
- name: Audit - HAHAHUGO
if: always()
run: |
! grep -inorE "hahahugo" public/

View File

@ -1,7 +1,6 @@
name: Deploy name: Deploy
on: on:
workflow_dispatch:
push: push:
branches: branches:
- master - master
@ -26,28 +25,20 @@ jobs:
extended: true extended: true
- name: Build - name: Build
run: hugo --printI18nWarnings --printPathWarnings run: hugo --i18n-warnings --path-warnings
- name: Compress - name: Compress
run: | run: |
time sudo ./compress.sh time sudo ./compress.sh
- name: Setup SSH
uses: kielabokkie/ssh-key-and-known-hosts-action@v1
with:
ssh-private-key: ${{ secrets.DEPLOY_SSH_KEY }}
ssh-host: srv.bbaovanc.com
ssh-port: 2222
- name: Upload - name: Upload
uses: up9cloud/action-rsync@v1 uses: up9cloud/action-rsync@v1
env: env:
HOST: srv.bbaovanc.com HOST: bbaovanc.com
USER: droneci USER: droneci
PORT: 2222 PORT: 2222
SOURCE: public/ SOURCE: public/
MODE: push MODE: push
VERBOSE: true VERBOSE: true
KEY: ${{secrets.DEPLOY_SSH_KEY}} KEY: ${{secrets.DEPLOY_SSH_KEY}}
TARGET: /var/www/bbaovanc.com/public/ TARGET: /var/www/bbaovanc/public/
ARGS: -avPzc --delete-delay --exclude=/.git/ --exclude=/.github/

View File

@ -27,7 +27,6 @@ jobs:
token: ${{ github.token }} token: ${{ github.token }}
env: pr-${{ github.event.number }} env: pr-${{ github.event.number }}
ref: ${{ github.head_ref }} ref: ${{ github.head_ref }}
no_override: false
- name: Setup Hugo - name: Setup Hugo
uses: peaceiris/actions-hugo@v2 uses: peaceiris/actions-hugo@v2
@ -36,31 +35,23 @@ jobs:
extended: true extended: true
- name: Build - name: Build
run: hugo --printI18nWarnings --printPathWarnings --baseURL "https://demo.bbaovanc.com/pull_request/${{ github.event.number }}" run: hugo --i18n-warnings --path-warnings --baseURL "https://demo.bbaovanc.com/pull_request/${{ github.event.number }}"
- name: Compress - name: Compress
run: | run: |
time sudo ./compress.sh time sudo ./compress.sh
- name: Setup SSH
uses: kielabokkie/ssh-key-and-known-hosts-action@v1
with:
ssh-private-key: ${{ secrets.DEPLOY_SSH_KEY }}
ssh-host: srv.bbaovanc.com
ssh-port: 2222
- name: Upload - name: Upload
uses: up9cloud/action-rsync@v1 uses: up9cloud/action-rsync@v1
env: env:
HOST: srv.bbaovanc.com HOST: bbaovanc.com
USER: droneci USER: droneci
PORT: 2222 PORT: 2222
SOURCE: public/ SOURCE: public/
MODE: push MODE: push
VERBOSE: true VERBOSE: true
KEY: ${{secrets.DEPLOY_SSH_KEY}} KEY: ${{secrets.DEPLOY_SSH_KEY}}
TARGET: /var/www/demo.bbaovanc.com/pull_request/${{ github.event.number }}/ TARGET: /var/www/demo/pull_request/${{ github.event.number }}/
ARGS: -avPzc --delete-delay --exclude=/.git/ --exclude=/.github/
- name: Finish deployment - name: Finish deployment
uses: bobheadxi/deployments@v0.6.0 uses: bobheadxi/deployments@v0.6.0
@ -91,5 +82,4 @@ jobs:
A preview of this pull request is ready! A preview of this pull request is ready!
See it at https://demo.bbaovanc.com/pull_request/${{ github.event.number }}/ See it at https://demo.bbaovanc.com/pull_request/${{ github.event.number }}/
View the deploy log at https://github.com/BBaoVanC/bbaovanc.com/actions/runs/${{ github.run_id}} View the deploy log at https://github.com/BBaoVanC/bbaovanc.com/actions/runs/${{ github.run_id}}
Please note that currently the comment system is only operational on real deploys on bbaovanc.com. If you see an error, it's probably not your fault.
edit-mode: replace edit-mode: replace

View File

@ -13,17 +13,15 @@ jobs:
uses: kielabokkie/ssh-key-and-known-hosts-action@v1 uses: kielabokkie/ssh-key-and-known-hosts-action@v1
with: with:
ssh-private-key: ${{ secrets.DEPLOY_SSH_KEY }} ssh-private-key: ${{ secrets.DEPLOY_SSH_KEY }}
ssh-host: srv.bbaovanc.com ssh-host: bbaovanc.com
ssh-port: 2222 ssh-port: 2222
- name: Delete pull request on server - name: Delete pull request on server
run: run:
ssh -p 2222 droneci@srv.bbaovanc.com rm -r /var/www/demo.bbaovanc.com/pull_request/${{ github.event.number }}/ ssh -p 2222 droneci@bbaovanc.com rm -r /var/www/demo/pull_request/${{ github.event.number }}/
- name: Deactivate deployment - name: Delete deployment
uses: bobheadxi/deployments@v0.6.0 uses: strumwolf/delete-deployment-environment@v2
with: with:
step: deactivate-env
token: ${{ github.token }} token: ${{ github.token }}
env: pr-${{ github.event.number }} environment: pr-${{ github.event.number }}
desc: Deployment was pruned

5
.gitignore vendored
View File

@ -14,8 +14,3 @@ hugo.darwin
hugo.linux hugo.linux
# End of https://www.toptal.com/developers/gitignore/api/hugo # End of https://www.toptal.com/developers/gitignore/api/hugo
/.hugo_build.lock
# My private drafts
/content/blog/drafts/

View File

@ -52,10 +52,10 @@ than an entire essay with the same amount of information.
## Building ## Building
## Automatic deploy previews with GitHub Actions ## Automatic deploy previews with Netlify
My GitHub Actions workflows will automatically build each pull request into a Netlify will automatically build each pull request into a public deploy preview,
public deploy preview on demo.bbaovanc.com, and will link it in a comment. and will link it in a comment.
## Manual (local) building ## Manual (local) building

101
LICENSE
View File

@ -1,4 +1,4 @@
Attribution 4.0 International Attribution-ShareAlike 4.0 International
======================================================================= =======================================================================
@ -33,7 +33,7 @@ exhaustive, and do not form part of our licenses.
material not subject to the license. This includes other CC- material not subject to the license. This includes other CC-
licensed material, or material used under an exception or licensed material, or material used under an exception or
limitation to copyright. More considerations for licensors: limitation to copyright. More considerations for licensors:
wiki.creativecommons.org/Considerations_for_licensors wiki.creativecommons.org/Considerations_for_licensors
Considerations for the public: By using one of our public Considerations for the public: By using one of our public
licenses, a licensor grants the public permission to use the licenses, a licensor grants the public permission to use the
@ -50,20 +50,22 @@ exhaustive, and do not form part of our licenses.
Although not required by our licenses, you are encouraged to Although not required by our licenses, you are encouraged to
respect those requests where reasonable. More considerations respect those requests where reasonable. More considerations
for the public: for the public:
wiki.creativecommons.org/Considerations_for_licensees wiki.creativecommons.org/Considerations_for_licensees
======================================================================= =======================================================================
Creative Commons Attribution 4.0 International Public License Creative Commons Attribution-ShareAlike 4.0 International Public
License
By exercising the Licensed Rights (defined below), You accept and agree By exercising the Licensed Rights (defined below), You accept and agree
to be bound by the terms and conditions of this Creative Commons to be bound by the terms and conditions of this Creative Commons
Attribution 4.0 International Public License ("Public License"). To the Attribution-ShareAlike 4.0 International Public License ("Public
extent this Public License may be interpreted as a contract, You are License"). To the extent this Public License may be interpreted as a
granted the Licensed Rights in consideration of Your acceptance of contract, You are granted the Licensed Rights in consideration of Your
these terms and conditions, and the Licensor grants You such rights in acceptance of these terms and conditions, and the Licensor grants You
consideration of benefits the Licensor receives from making the such rights in consideration of benefits the Licensor receives from
Licensed Material available under these terms and conditions. making the Licensed Material available under these terms and
conditions.
Section 1 -- Definitions. Section 1 -- Definitions.
@ -82,7 +84,11 @@ Section 1 -- Definitions.
and Similar Rights in Your contributions to Adapted Material in and Similar Rights in Your contributions to Adapted Material in
accordance with the terms and conditions of this Public License. accordance with the terms and conditions of this Public License.
c. Copyright and Similar Rights means copyright and/or similar rights c. BY-SA Compatible License means a license listed at
creativecommons.org/compatiblelicenses, approved by Creative
Commons as essentially the equivalent of this Public License.
d. Copyright and Similar Rights means copyright and/or similar rights
closely related to copyright including, without limitation, closely related to copyright including, without limitation,
performance, broadcast, sound recording, and Sui Generis Database performance, broadcast, sound recording, and Sui Generis Database
Rights, without regard to how the rights are labeled or Rights, without regard to how the rights are labeled or
@ -90,29 +96,33 @@ Section 1 -- Definitions.
specified in Section 2(b)(1)-(2) are not Copyright and Similar specified in Section 2(b)(1)-(2) are not Copyright and Similar
Rights. Rights.
d. Effective Technological Measures means those measures that, in the e. Effective Technological Measures means those measures that, in the
absence of proper authority, may not be circumvented under laws absence of proper authority, may not be circumvented under laws
fulfilling obligations under Article 11 of the WIPO Copyright fulfilling obligations under Article 11 of the WIPO Copyright
Treaty adopted on December 20, 1996, and/or similar international Treaty adopted on December 20, 1996, and/or similar international
agreements. agreements.
e. Exceptions and Limitations means fair use, fair dealing, and/or f. Exceptions and Limitations means fair use, fair dealing, and/or
any other exception or limitation to Copyright and Similar Rights any other exception or limitation to Copyright and Similar Rights
that applies to Your use of the Licensed Material. that applies to Your use of the Licensed Material.
f. Licensed Material means the artistic or literary work, database, g. License Elements means the license attributes listed in the name
of a Creative Commons Public License. The License Elements of this
Public License are Attribution and ShareAlike.
h. Licensed Material means the artistic or literary work, database,
or other material to which the Licensor applied this Public or other material to which the Licensor applied this Public
License. License.
g. Licensed Rights means the rights granted to You subject to the i. Licensed Rights means the rights granted to You subject to the
terms and conditions of this Public License, which are limited to terms and conditions of this Public License, which are limited to
all Copyright and Similar Rights that apply to Your use of the all Copyright and Similar Rights that apply to Your use of the
Licensed Material and that the Licensor has authority to license. Licensed Material and that the Licensor has authority to license.
h. Licensor means the individual(s) or entity(ies) granting rights j. Licensor means the individual(s) or entity(ies) granting rights
under this Public License. under this Public License.
i. Share means to provide material to the public by any means or k. Share means to provide material to the public by any means or
process that requires permission under the Licensed Rights, such process that requires permission under the Licensed Rights, such
as reproduction, public display, public performance, distribution, as reproduction, public display, public performance, distribution,
dissemination, communication, or importation, and to make material dissemination, communication, or importation, and to make material
@ -120,13 +130,13 @@ Section 1 -- Definitions.
public may access the material from a place and at a time public may access the material from a place and at a time
individually chosen by them. individually chosen by them.
j. Sui Generis Database Rights means rights other than copyright l. Sui Generis Database Rights means rights other than copyright
resulting from Directive 96/9/EC of the European Parliament and of resulting from Directive 96/9/EC of the European Parliament and of
the Council of 11 March 1996 on the legal protection of databases, the Council of 11 March 1996 on the legal protection of databases,
as amended and/or succeeded, as well as other essentially as amended and/or succeeded, as well as other essentially
equivalent rights anywhere in the world. equivalent rights anywhere in the world.
k. You means the individual or entity exercising the Licensed Rights m. You means the individual or entity exercising the Licensed Rights
under this Public License. Your has a corresponding meaning. under this Public License. Your has a corresponding meaning.
@ -172,7 +182,13 @@ Section 2 -- Scope.
Licensed Rights under the terms and conditions of this Licensed Rights under the terms and conditions of this
Public License. Public License.
b. No downstream restrictions. You may not offer or impose b. Additional offer from the Licensor -- Adapted Material.
Every recipient of Adapted Material from You
automatically receives an offer from the Licensor to
exercise the Licensed Rights in the Adapted Material
under the conditions of the Adapter's License You apply.
c. No downstream restrictions. You may not offer or impose
any additional or different terms or conditions on, or any additional or different terms or conditions on, or
apply any Effective Technological Measures to, the apply any Effective Technological Measures to, the
Licensed Material if doing so restricts exercise of the Licensed Material if doing so restricts exercise of the
@ -254,9 +270,24 @@ following conditions.
information required by Section 3(a)(1)(A) to the extent information required by Section 3(a)(1)(A) to the extent
reasonably practicable. reasonably practicable.
4. If You Share Adapted Material You produce, the Adapter's b. ShareAlike.
License You apply must not prevent recipients of the Adapted
Material from complying with this Public License. In addition to the conditions in Section 3(a), if You Share
Adapted Material You produce, the following conditions also apply.
1. The Adapter's License You apply must be a Creative Commons
license with the same License Elements, this version or
later, or a BY-SA Compatible License.
2. You must include the text of, or the URI or hyperlink to, the
Adapter's License You apply. You may satisfy this condition
in any reasonable manner based on the medium, means, and
context in which You Share Adapted Material.
3. You may not offer or impose any additional or different terms
or conditions on, or apply any Effective Technological
Measures to, Adapted Material that restrict exercise of the
rights granted under the Adapter's License You apply.
Section 4 -- Sui Generis Database Rights. Section 4 -- Sui Generis Database Rights.
@ -271,8 +302,9 @@ apply to Your use of the Licensed Material:
b. if You include all or a substantial portion of the database b. if You include all or a substantial portion of the database
contents in a database in which You have Sui Generis Database contents in a database in which You have Sui Generis Database
Rights, then the database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database
Rights (but not its individual contents) is Adapted Material; and Rights (but not its individual contents) is Adapted Material,
including for purposes of Section 3(b); and
c. You must comply with the conditions in Section 3(a) if You Share c. You must comply with the conditions in Section 3(a) if You Share
all or a substantial portion of the contents of the database. all or a substantial portion of the contents of the database.
@ -375,22 +407,21 @@ Section 8 -- Interpretation.
======================================================================= =======================================================================
Creative Commons is not a party to its public Creative Commons is not a party to its public licenses.
licenses. Notwithstanding, Creative Commons may elect to apply one of Notwithstanding, Creative Commons may elect to apply one of its public
its public licenses to material it publishes and in those instances licenses to material it publishes and in those instances will be
will be considered the “Licensor.” The text of the Creative Commons considered the “Licensor.” The text of the Creative Commons public
public licenses is dedicated to the public domain under the CC0 Public licenses is dedicated to the public domain under the CC0 Public Domain
Domain Dedication. Except for the limited purpose of indicating that Dedication. Except for the limited purpose of indicating that material
material is shared under a Creative Commons public license or as is shared under a Creative Commons public license or as otherwise
otherwise permitted by the Creative Commons policies published at permitted by the Creative Commons policies published at
creativecommons.org/policies, Creative Commons does not authorize the creativecommons.org/policies, Creative Commons does not authorize the
use of the trademark "Creative Commons" or any other trademark or logo use of the trademark "Creative Commons" or any other trademark or logo
of Creative Commons without its prior written consent including, of Creative Commons without its prior written consent including,
without limitation, in connection with any unauthorized modifications without limitation, in connection with any unauthorized modifications
to any of its public licenses or any other arrangements, to any of its public licenses or any other arrangements,
understandings, or agreements concerning use of licensed material. For understandings, or agreements concerning use of licensed material. For
the avoidance of doubt, this paragraph does not form part of the the avoidance of doubt, this paragraph does not form part of the public
public licenses. licenses.
Creative Commons may be contacted at creativecommons.org. Creative Commons may be contacted at creativecommons.org.

45
config.toml Normal file
View File

@ -0,0 +1,45 @@
baseURL = "https://bbaovanc.com"
theme = "bobatheme"
defaultContentLanguage = "en"
copyright = '<a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">CC BY-SA 4.0</a>'
sectionPagesMenu = "main"
enableRobotsTXT = true
paginate = 5
enableGitInfo = true
[author]
name = "bbaovanc"
email = "bbaovanc@bbaovanc.com"
[markup]
[markup.highlight]
noClasses = false
lineNos = true
[params]
# these are for the OpenGraph/Twitter embeds in Hugo
description = "My personal website"
# these are for favicons in bobatheme
faviconICO = "favicon.ico"
faviconPNG = "favicon.png"
# show word count and/or reading time (enabled by default)
wordcount = true
readingtime = true
# used for last update
repoURL = "https://github.com/BBaoVanC/bbaovanc.com"
[languages]
[languages.en]
languageName = "English"
title = "bbaovanc's Website"
weight = 1
[languages.es]
languageName = "Español"
title = "sitio web de bbaovanc"
weight = 2
[languages.es.params]
description = "Mi sitio web personal"

View File

@ -1,53 +0,0 @@
baseURL: https://bbaovanc.com
theme: bobatheme
defaultContentLanguage: en
copyright: '&copy; 2021 bbaovanc <a rel="license" href="https://creativecommons.org/licenses/by/4.0/">CC BY 4.0</a>'
sectionPagesMenu: main
enableRobotsTXT: true
paginate: 10
enableGitInfo: true
taxonomies:
_merge: deep
author:
name: bbaovanc
markup: # this just keeps the bobatheme markup styling
_merge: deep
params:
# these are for the OpenGraph/Twitter embeds in Hugo
description: My personal website
# these are for favicons in bobatheme (unset by default)
faviconICO: favicon.ico
faviconPNG: favicon.png
# show reading time (enabled by default)
readingtime: true
# used for "View source" (unset by default)
gitFileURL: https://github.com/BBaoVanC/bbaovanc.com/blob/master
gitFileIcon: code
talkyardServerUrl: "https://talkyard.bbaovanc.com"
talkyardScriptUrl: "https://talkyard.bbaovanc.com/-/talkyard-comments.min.js"
# see https://gohugo.io/about/hugo-and-gdpr/#all-privacy-settings
# you probably want to keep this default
privacy:
_merge: deep
languages:
en:
languageName: English
title: bbaovanc's Website
weight: 1
es:
languageName: Español
title: sitio web de bbaovanc
weight: 2
params:
description: Mi sitio web personal

View File

@ -3,9 +3,7 @@
title: Home title: Home
description: >- description: >-
This is my website, home to my blog and other personal pages. It's powered by This is my website.
my own custom theme named bobatheme, available at
https://github.com/BBaoVanC/bobatheme.
--- ---

View File

@ -0,0 +1,39 @@
---
title: Nueva sistema de comentarios (otra vez)
date: 2021-04-17
toc: true
tags:
- announcement
- hugo
- blog
---
Decidí cambiar mi sistema de comentarios de Isso a
[Commento](https://www.commento.io/).
<!--more-->
## Isso vs Commento
Sé que sólo ser seís días desde añadí Isso, pero decidí cambiar a una sistema de
comentarios mejor. Isso se supone que ser sencillo, lo que significa que falta
muchas herramientas. Commento tiene un montón de herramientas, tal como
comentarios fijados, detección de spam, cerrar cadenas, notificaciones en correo
electrónico (no podía hacerlo funcionar en Isso), y un diseño más lindo. También
podía implementar algunos [custom CSS rules][1], que ayudan parecer lindo en la
tema de mi blog. También es compatible con SSO, así que puedo admitir registro
con GitHub, y quizás GitLab.
## Sumario del primero posteo
Si no has leído el [Nueva sistema de comentarios](../new-comment-system) posteo,
aquí es la información más importante. Hay un sección de comentarios en el fondo
de cada posteo donde puedes ver y publicar comentarios. Puedes comentar
anónimamente, o crear una cuenta para mostrar tu nombre de usario y recibir
notificaciones en correo electrónico. También puedes votar y responder a otras
comentarios.
[1]: https://git.bbaovanc.com/bbaovanc.com/blog/src/commit/478e15218313a33216d361de387b3bd878cd0ba6/assets/css/comments.css

View File

@ -0,0 +1,41 @@
---
title: Nueva sistema de comentarios
date: 2021-04-11
toc: true
tags:
- announcement
- hugo
- blog
---
Añadí una nueva sistema de comentarios a mi blog usando
[Isso](https://posativ.org/isso/).
<!--more-->
## Sobre
Instalé una sistema de comentarios que se llama
[Isso](https://posativ.org/isso/) en mi blog hoy. En el fondo de cada entrada de
blog, hay un sección de comentarios. Puedes comentar anónimamente, o mostrar tu
nombre, dirección de correo electrónico, y/o sito web, que será mostrado a otras
personas que están leyendo tu comentario. No pienso que nadie va a maltratar la
sistema de comentarios porque mi sitio web es tan pequeña.
## Problemas conocidas
### Editar y eliminar no funciona
La sistema se supone que dejarte editar y eliminar tus comentarios 15 minutos
después de enviarlos, pero no funciona ahora. La solicitud sólo responde un
error de 403 (prohibido).
### Texto blanco enfrente de un fondo blanco en vista preliminar
Esto es una problema de CSS. También pasaba cuando editando y escribiendo un
comentario, pero lo edité así que la caja de texto tiene texto negro. Yo pienso
que una solución mejor es usar un fondo negro en el formulario comentario, pero
arreglaré luego.

View File

@ -1,10 +0,0 @@
---
title: bbaovanc
---
I think you can probably tell from the website URL that I'm the one who owns
this website.
<!--more-->

View File

@ -1,10 +0,0 @@
---
title: Github Copilot
---
More information at https://copilot.github.com/. See [this
post](/blog/copilot-post) for how I did it.
<!--more-->

View File

@ -3,6 +3,6 @@
title: Blog title: Blog
description: >- description: >-
El hogar de mi blog. Mis entradas de blog
--- ---

View File

@ -3,6 +3,6 @@
title: Blog title: Blog
description: >- description: >-
The home of my blog. My blog posts
--- ---

View File

@ -1,13 +1,10 @@
--- ---
title: Allow non root processes to bind to privileged ports in Linux title: Allow non root processes to bind to privileged ports in Linux
date: 2021-03-28T21:29:52-05:00 date: 2021-03-28
toc: true toc: true
comments: true comments: true
authors:
- bbaovanc
aliases: aliases:
- posts/allow-non-root-processes-to-bind-to-privileged-ports/ - posts/allow-non-root-processes-to-bind-to-privileged-ports/

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

View File

@ -1,228 +0,0 @@
---
title: Caddy is literally the best webserver
date: 2021-11-13T00:43:35-06:00
toc: true
comments: true
authors:
- bbaovanc
tags:
- linux
- webserver
- caddy
resources:
- name: feature
src: caddy.webp
title: >-
Image source:
[Caddy](https://caddyserver.com/resources/images/caddy-logo.svg)
- name: caddy-browse
src: caddy-browse.webp
title: >-
Caddy's gorgeous directory list page.
---
After switching from NGINX to Caddy on all of my websites, I have come to the
conclusion that Caddy is the best webserver in existence. With automatic HTTPS,
a simple configuration file, and more, Caddy is just the best webserver overall
for general use.
<!--more-->
## Built-in automatic HTTPS
Caddy can fetch certificates from Let's Encrypt and ZeroSSL out of the box.
HTTPS is enabled by default for eligible domains[^1], unless you explicitly tell
it not to.
### Incredible cipher security
Caddy has incredible defaults for TLS/SSL ciphers. Any site you host on Caddy
gets a perfect score from [Qualys SSL Labs](https://www.ssllabs.com/ssltest/)
out of the box.[^2]
## Dead simple configuration files: Caddy vs NGINX
Caddy's configuration file format is the easiest out of all the main webserver.
The best way for me to demonstrate this simplicity is to compare it to one of
the most popular webservers: [NGINX](https://www.nginx.com/).
### Serving some static files
The most essential feature you can use a webserver for.
#### Caddy
```caddyfile
example.com {
root * /var/www/example.com
file_server
}
```
#### NGINX
```nginx
server {
listen 80;
server_name example.com;
index index.html index.txt;
root /var/www/example.com;
location / {
try_files $uri $uri/ =404;
}
}
```
As you can see, the Caddy config is a lot simpler than the NGINX one. But wait,
there's more! This NGINX config is unencrypted HTTP only, but the Caddy one will
automatically request a certificate from Let's Encrypt, enable HTTPS, and even
redirect unencrypted HTTP to HTTPS.
From now on, for the sake of simplicity, I'll be ignoring HTTPS for the NGINX
configs.
### PHP (PrivateBin)
The Caddy config for this example is the same as the [one used for
bin.boba.best](https://git.boba.best/configs/caddy/src/commit/cd00151fbdd784979a8a181980cc36061be68c7d/conf.d/bin.boba.best).
I've stripped it down a bit by removing the [custom error
pages](https://git.boba.best/configs/caddy/src/commit/cd00151fbdd784979a8a181980cc36061be68c7d/Caddyfile#L15-L24),
[HSTS](https://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security), [zstd
compression](https://github.com/facebook/zstd), and logging.
#### Caddy
```caddyfile
bin.boba.best {
encode gzip
root * /var/www/bin.boba.best
php_fastcgi unix//run/php/php-fpm.sock
file_server
}
```
#### NGINX
```nginx
server {
listen 80;
server_name bin.boba.best;
index index.html index.txt index.php;
root /var/www/bin.boba.best;
gzip on;
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php-fpm.sock;
}
}
```
### Reverse proxy + static files (Gitea)
This last example is based on
[git.bbaovanc.com](https://git.bbaovanc.com/configs/caddy/src/commit/57c9f0011eae92ef5fa2992d99f01b0956802d64/conf.d/git.bbaovanc.com).
Just like the last example, I've stripped off the custom error pages, HSTS, zstd
compression, and logging.
#### Caddy
```caddyfile
git.bbaovanc.com {
encode gzip
handle_path /_/static/assets/* {
root * /var/www/git.bbaovanc.com/public
file_server
}
handle {
reverse_proxy localhost:81 {
header_up X-Real-IP {remote_host}
}
}
}
```
#### NGINX
```nginx
server {
listen 80;
server_name git.bbaovanc.com;
gzip on;
location /_/static/assets {
alias /var/www/git.bbaovanc.com/public/;
}
location / {
proxy_pass http://localhost:81;
proxy_set_header X-Real-IP $remote_addr;
}
```
Although in this case the NGINX config was slightly shorter, I find the Caddy
one a lot more clear and easy to understand. With NGINX, I find it weird how
adding a trailing slash or not defines whether the prefix (`/_/static/assets` in
this case) is stripped before searching the filesystem. In Caddy, you can use
the `handle_path` directive, instead of just a regular `handle` directive.
You can read more about how `handle` and `handle_path` work in Caddy on the
[Caddy docs](https://caddyserver.com/docs/caddyfile/directives/handle).
## The smaller details
These features might not matter to you, but this is my blog, and I care about
them, so I'll be including them.
### Go templates
Caddy is written in Go and supports [Go
templates](https://pkg.go.dev/text/template). This means you can make simple
dynamic content while only using Caddy!
In fact, the [official Caddy website](https://caddyserver.com) is generated
entirely using Caddy's and Go templates![^3]
#### Error pages using HTTP Cats
I use [this
snippet](https://git.bbaovanc.com/configs/caddy/src/commit/57c9f0011eae92ef5fa2992d99f01b0956802d64/Caddyfile#L8-L15)
on both bbaovanc.com and boba.best to make custom error pages using images from
[HTTP Cats](https://http.cat). It uses Caddy's template support to generate some
simple HTML to show the error code, name, and cat image.
### Beautiful autoindex file browser
Apache and NGINX both have an optional "autoindex" feature which generates a
list of files in a directory when there's no page there. However, it looks very
ugly. Caddy, on the other hand, still has a simple index page, but looks a
thousand times better.
Coincidentally, it matches the theme of my website very well, so I have to put a
border around the image.
{{< figure src="caddy-browse" >}}
[^1]: The rules for what domains have automatic HTTPS by default are
[here](https://caddyserver.com/docs/automatic-https#hostname-requirements)
[^2]: SSL Labs caps the score to an A if HSTS isn't enabled. After enabling it,
then you get a perfect A+ score. See
https://www.ssllabs.com/ssltest/analyze.html?d=bbaovanc.com&latest
([archived](https://archive.today/4JJDN)) for an example (bbaovanc.com).
[^3]: See more info [on the Caddy docs](https://caddyserver.com/docs/caddyfile/directives/templates#examples)

View File

@ -1,13 +1,10 @@
--- ---
title: Checkra1n GUI on other Linux distros title: Checkra1n GUI on other Linux distros
date: 2021-03-25T21:19:51-05:00 date: 2021-03-25
toc: true toc: true
comments: true comments: true
authors:
- bbaovanc
aliases: aliases:
- posts/checkra1n-gui-on-other-distros/ - posts/checkra1n-gui-on-other-distros/

View File

@ -1,337 +0,0 @@
---
# this is the title it generated. not even joking
title: Copilot
date: 2021-11-07T16:17:15-06:00
toc: true
comments: true
authors:
- GitHub Copilot
- bbaovanc
tags:
- github-copilot
series:
- GitHub Copilot Experiments
---
Did you know that Copilot is a command line interface for Copilot? It's a tool
for creating and managing Copilot projects.
<!--more-->
{{< aside >}}
## What is this post?
I used [GitHub Copilot](https://copilot.github.com/) to write everything. All I
did myself (being a human) was write a couple words and let it finish it off.
I'll put any text that I wrote myself in an "aside" box, like you can see on
this paragraph.
{{< /aside >}}
## What is Copilot?
Copilot is a [Cloud Native
Computing](https://en.wikipedia.org/wiki/Cloud_computing). It's used for
managing the lifecycle of your application. It's also used as a tool for
creating and managing Copilot projects.
## What is this?
This is an article about [GitHub Copilot]() and the Copilot CLI. It's a tool for
creating and managing Copilot projects. I wrote it to help me learn the [GitHub
Copilot API]() and to learn how to use the CLI. You can read more about the API
[here](https://developer.github.com/v4/explorer/). Next time you want to learn
more about Copilot, check out the [GitHub Copilot
docs](https://developer.github.com/apps/copilot/).
## Why is this?
Because I'm a developer and I like to learn new things. This is a tool I wrote
to learn how the Copilot API works. It's a tool for creating and managing
Copilot projects. I wrote it to help me learn the [GitHub Copilot API]() and to
learn how to use the CLI. You can read more about the API
[here](https://developer.github.com/v4/explorer/). Next time you want to learn
more about Copilot, check out the [GitHub Copilot
docs](https://developer.github.com/apps/copilot/). It's a tool for creating and
managing Copilot projects. I wrote it to help me learn the [GitHub Copilot
API]() and to learn how to use the CLI. You can read more about the API
[here](https://developer.github.com/v4/explorer/). Next time you want to learn
more about Copilot, check out the [GitHub Copilot
docs](https://developer.github.com/apps/copilot/).
## How did I write this?
I used [Hugo](https://gohugo.io/) to write this article. It's a static site
generator that makes it easy to create and manage a blog. GitHub Copilot is what
I use to create and manage Copilot projects.
## How do I use this?
Here's how you use this. You can read more about the CLI
[here](https://developer.github.com/apps/copilot/). You can read more about the
API [here](https://developer.github.com/v4/explorer/). Next time you want to
learn more about Copilot, check out the [GitHub Copilot
docs](https://developer.github.com/apps/copilot/). It's a tool for creating and
managing Copilot projects. I wrote it to help me learn the [GitHub Copilot
API]() and to learn how to use the CLI. You can read more about the API
[here](https://developer.github.com/v4/explorer/). Next time you want to learn
more about Copilot, check out the [GitHub Copilot
docs](https://developer.github.com/apps/copilot/). Did you know that Copilot is
a command line interface for Copilot? It's a tool for creating and managing
Copilot projects. It's not a tool for creating and managing Copilot projects.
It's a tool for creating and managing Copilot projects. I wrote it to help me
learn the [GitHub Copilot API]() and to learn how to use the CLI. You can read
more about the API [here](https://developer.github.com/v4/explorer/). Next time
you want to learn more about Copilot, check out the [GitHub Copilot
docs](https://developer.github.com/apps/copilot/).
## What do I need to know?
* You need a GitHub account
* You need to have a GitHub Copilot API key
* You need to have a GitHub Copilot CLI
* You need to have a GitHub Copilot project
## How do I create a project?
1. Create a project on [GitHub
Copilot](https://developer.github.com/apps/copilot/).
2. Create a project on [GitHub
Copilot](https://developer.github.com/apps/copilot/).
3. Create a project on [GitHub
Copilot](https://developer.github.com/apps/copilot/).
## How do I delete a project?
1. Delete a project on [GitHub
Copilot](https://developer.github.com/apps/copilot/).
2. Delete a project on [GitHub
Copilot](https://developer.github.com/apps/copilot/).
3. Delete a project on [GitHub
Copilot](https://developer.github.com/apps/copilot/).
## I want to create a project, but I don't have an API key.
Well, you need an API key. You can create one on [GitHub
Copilot](https://developer.github.com/apps/copilot/). You can create one on
[GitHub Copilot](https://developer.github.com/apps/copilot/). You can create one
on [GitHub Copilot](https://developer.github.com/apps/copilot/). If you don't
have an API key, you can create one on [GitHub
Copilot](https://developer.github.com/apps/copilot/). Sorry about that. You can
create one on [GitHub Copilot](https://developer.github.com/apps/copilot/).
## I want to create a project, but I don't have a CLI.
If you don't have a CLI, you can create one on [GitHub
Copilot](https://developer.github.com/apps/copilot/). Unfortunately, you can't
create one on [GitHub Copilot](https://developer.github.com/apps/copilot/). You
can create one on [GitHub Copilot](https://developer.github.com/apps/copilot/).
{{< aside >}}
The following made me laugh:
{{< /aside >}}
## It keeps saying the same thing.
1. It keeps saying the same thing.
2. It keeps saying the same thing.
3. It keeps saying the same thing.
```js
var password = process.env.GITHUB_API_KEY;
```
Did you know that Copilot is a command line interface for Copilot? It's a tool
for creating and managing Copilot projects. It keeps saying the same thing. You
can create one on [GitHub Copilot](https://developer.github.com/apps/copilot/).
## Code blocks
{{< aside >}}
These next subsections are written by GitHub Copilot. All I did was write the
section headers, start the code block, and type some comments to get it started.
I have no idea if the code actually works (or even does anything at all), so
test it at your own risk!
{{< /aside >}}
### Copilot
```python
import os
import json
import requests
# Get the API key from the environment
api_key = os.environ.get('GITHUB_API_KEY')
# Get the project name from the environment
project_name = os.environ.get('GITHUB_PROJECT_NAME')
# Get the project description from the environment
project_description = os.environ.get('GITHUB_PROJECT_DESCRIPTION')
# Get the project homepage from the environment
project_homepage = os.environ.get('GITHUB_PROJECT_HOMEPAGE')
# Get the project repository from the environment
project_repository = os.environ.get('GITHUB_PROJECT_REPOSITORY')
# Get the project organization from the environment
project_organization = os.environ.get('GITHUB_PROJECT_ORGANIZATION')
# Get the project visibility from the environment
project_visibility = os.environ.get('GITHUB_PROJECT_VISIBILITY')
# Get the project topics from the environment
project_topics = os.environ.get('GITHUB_PROJECT_TOPICS')
# Get the project languages from the environment
project_languages = os.environ.get('GITHUB_PROJECT_LANGUAGES')
# Get the project license from the environment
project_license = os.environ.get('GITHUB_PROJECT_LICENSE')
# Get the project documentation from the environment
project_documentation = os.environ.get('GITHUB_PROJECT_DOCUMENTATION')
# Create the project
response = requests.post(
'https://api.github.com/orgs/{}/projects'.format(project_organization),
headers={
'Authorization': 'token {}'.format(api_key),
'Content-Type': 'application/json',
},
data=json.dumps({
'name': project_name,
'body': project_description,
'homepage': project_homepage,
'repository_url': project_repository,
'visibility': project_visibility,
'topics': project_topics,
'languages': project_languages,
'license_template': project_license,
'documentation_url': project_documentation,
}),
)
```
### A basic Discord bot
```python
import discord
import os
import json
import requests
# the token of the bot
token = os.environ.get('DISCORD_BOT_TOKEN')
# the name of the bot
name = os.environ.get('DISCORD_BOT_NAME')
# command handler
async def handle_command(message):
# get the command
command = message.content.split()[0]
# get the arguments
args = message.content.split()[1:]
# get the author
author = message.author
# get the author's id
author_id = message.author.id
# create the response
response = '{}'.format(author.mention)
# if the command is `ping`
if command == 'ping':
# respond with pong
response = 'pong'
# if the command is `hello`
if command == 'hello':
# respond with hello
response = 'hello'
# if the command is `help`
if command == 'help':
# respond with help
response = 'help'
# send the response
await client.send_message(message.channel, response)
```
### A basic Minecraft bot
```python
import minecraft
import os
import json
import requests
# run the Minecraft bot
client = minecraft.Minecraft.create()
# build a house
def build_house(x, y, z):
# build a house
client.setBlock(x, y, z, 1)
client.setBlock(x, y + 1, z, 1)
client.setBlock(x, y + 2, z, 1)
client.setBlock(x, y + 3, z, 1)
client.setBlock(x, y + 4, z, 1)
client.setBlock(x, y + 5, z, 1)
client.setBlock(x, y + 6, z, 1)
client.setBlock(x, y + 7, z, 1)
client.setBlock(x, y + 8, z, 1)
client.setBlock(x, y + 9, z, 1)
client.setBlock(x, y + 10, z, 1)
client.setBlock(x, y + 11, z, 1)
client.setBlock(x, y + 12, z, 1)
client.setBlock(x, y + 13, z, 1)
client.setBlock(x, y + 14, z, 1)
client.setBlock(x, y + 15, z, 1)
client.setBlock(x, y + 16, z, 1)
client.setBlock(x, y + 17, z, 1)
client.setBlock(x, y + 18, z, 1)
client.setBlock(x, y + 19, z, 1)
client.setBlock(x, y + 20, z, 1)
client.setBlock(x, y + 21, z, 1)
client.setBlock(x, y + 22, z, 1)
client.setBlock(x, y + 23, z, 1)
# build a door
client.setBlock(x - 1, y + 1, z, 64)
client.setBlock(x - 1, y + 2, z, 64)
client.setBlock(x - 1, y + 3, z, 64)
client.setBlock(x - 1, y + 4, z, 64)
client.setBlock(x - 1, y + 5, z, 64)
client.setBlock(x - 1, y + 6, z, 64)
# build a window
client.setBlock(x - 1, y + 10, z, 64)
client.setBlock(x - 1, y + 11, z, 64)
client.setBlock(x - 1, y + 12, z, 64)
client.setBlock(x - 1, y + 13, z, 64)
```
### A random program
```js
var x = Math.random() * 10;
var y = Math.random() * 10;
var z = Math.random() * 10;
// do something with the coordinates
console.log(x, y, z);
```
### Find the last digit of pi
{{< aside >}}
This next one is actually genius.
{{< /aside >}}
```python
import math
# find the last digit of pi
def last_digit_of_pi():
return int(str(math.pi)[-1])
```

View File

@ -1,40 +0,0 @@
---
title: Poner `(edited)` en medio de un mensaje de Discord
date: 2021-03-25T18:48:34-05:00
toc: false
comments: true
authors:
- bbaovanc
tags:
- tutorial
- discord
- discord-tricks
resources:
- name: feature
src: example.webp
title: Imagen ejemplo
---
Usando (a bit of trickery) con el carácter [RLE -- right to left embedding],
puedes poner el texto `(edited)` dentro del mensaje.
<!--more-->
## Tutorial
1. Copie el carácter [RLE -- same as above] (U+202A) a tu portapapeles.
2. Edite el mensaje anterior
3. Elimina todo el texto
4. Pega la carácter
5. Escribe el texto que quieres a la derecha de `(edited)`
6. Pulsa espacio y pega la carácter
7. Escribe el texto que quieres a la izquierda de `(edited)`
*Esto entrada de blog fue adaptado de [gitea:bbaovanc/discord-tricks][1]*
[1]: https://git.bbaovanc.com/bbaovanc/discord-tricks

View File

@ -1,13 +1,10 @@
--- ---
title: Put `(edited)` in the middle of a message in Discord title: Put `(edited)` in the middle of a message in Discord
date: 2021-03-25T18:48:34-05:00 date: 2021-03-25
toc: true toc: false
comments: true comments: true
authors:
- bbaovanc
aliases: aliases:
- posts/edited-in-middle-of-message-discord/ - posts/edited-in-middle-of-message-discord/
@ -31,37 +28,14 @@ message.
## Tutorial ## Tutorial
Before you start, copy the "right-to-left embedding" character 1. Copy the "right-to-left embedding" character (U+202A) to your clipboard.
([U+202B](https://unicode-explorer.com/c/202B)) to your clipboard. 2. Open editing box of a message
3. Delete all text inside
4. Paste the character
5. Type the text you want on the right of `(edited)`
6. Press space and paste the character
7. Type the text you want on the left of `(edited)`
### Method 1 *This post was adapted from [gitea:bbaovanc/discord-tricks][1]*
This method allows you to create a placeholder message, and then replace it with
a new message with the `(edited)` text inside it all at once.
1. Send a message with some random text since you have to edit an existing
message for the trick to work.
2. Start editing the message you just created and delete all the text inside
3. Type the text you want on the left of `(edited)`.
4. Type a space, then paste the character twice, and type another space.
5. Type the text you want on the right of `(edited)`.
6. Save the message.
You can also start at step 3 instead, send the message, and then edit the
message afterwards to add the `(edited)` text.
### Method 2
This method allows you to add `(edited)` to the end of an existing message, and
then add even more text to the right of that.
1. Send a message containing the text you want on the left of `(edited)`.
2. Start editing the message you just created
3. At the end of the message, type a space, then paste the character twice, and
type another space.
4. Type the text you want on the right of `(edited)`.
5. Save the message.
*This post was adapted from [bbaovanc/discord-tricks][1]*
[1]: https://git.bbaovanc.com/bbaovanc/discord-tricks [1]: https://git.bbaovanc.com/bbaovanc/discord-tricks

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.2 KiB

View File

@ -1,179 +0,0 @@
---
title: GitHub Copilot experiments
date: 2021-11-06T23:56:47-05:00
toc: true
comments: true
authors:
- bbaovanc
tags:
- github-copilot
series:
- GitHub Copilot Experiments
resources:
- name: feature
src: boba-shop.webp
title: GitHub Copilot tends to repeat stuff.
- name: rust-poem
src: rust-poem.webp
- name: python-twinkle-poem
src: python-twinkle-poem.webp
- name: horrible-code
src: horrible-code.webp
- name: dropdown-css
src: dropdown-css.webp
- name: boba-shop # same as feature
src: boba-shop.webp
- name: boba-shop-size
src: boba-shop-size.webp
- name: boba-shop-color
src: boba-shop-color.webp
- name: girlfriend
src: girlfriend.webp
- name: cheese-burger-poem
src: cheese-burger-poem.webp
- name: sing
src: sing.webp
- name: what-is-boba
src: what-is-boba.webp
- name: what-is-github-copilot
src: what-is-github-copilot.webp
- name: what-is-the-purpose-of-this-file
src: what-is-the-purpose-of-this-file.webp
- name: who-is-steve-jobs
src: who-is-steve-jobs.webp
---
I decided to play around with GitHub Copilot. Here's some of the code that I
got as a result.
<!--more-->
## Poems
First, I tried to get Copilot to write me a poem in Rust. It didn't really work.
{{< figure src="rust-poem" >}}
So, I tried Python instead.
{{< figure src="python-twinkle-poem" >}}
This is where I realized that Copilot was doing a little more than just
repeating code it had seen before verbatim.
Before this testing, my understanding was that Copilot was sort of like a search
engine. It looked at the context and found a piece of code from GitHub that
matched the functionality you wanted. This was the reason I had such a negative
opinion about it. I saw it as a way to easily violate copyleft licenses such as
GPLv3.
Anyways, back to more testing.
## Horrible code
I decided to ask it to generate some horrible code for me. Unfortunately, it
didn't quite do what I wanted.
{{< figure src="horrible-code" >}}
## Solving problems in bobatheme
I decided to consult Copilot on how to make a nice CSS dropdown, which I need
for the language picker in bobatheme.
{{< figure src="dropdown-css" >}}
Maybe I'll have to test it out.
## Making a boba shop
Now, I asked Copilot for help on creating a new
[boba](https://en.wikipedia.org/wiki/Bubble_tea) shop, which got a little
spammy.
{{< figure src="boba-shop" >}}
{{< figure src="boba-shop-size" >}}
## More random code
I got some ideas of important questions to ask Copilot thanks to the
conversations going on in Discord.
{{< figure src="girlfriend" >}}
Turns out the API endpoint in that code is real, and returns a (presumably)
nonexistent person.
## Another poem
I decided to generate one more poem, this time naming the function something
different in hopes of getting a different result.
{{< figure src="cheese-burger-poem" >}}
It was a success! And the output of the program:
```text
Mary had a little lamb.
Its fleece was white as snow.
And everywhere that Mary went.
..........
Cheese Burger
```
## A song
I decided to try and get it to sing a song.
{{< figure src="sing" >}}
According to Google Translate, here's what that says:
```python
def sing():
print("""
You are my little pig
I love you
You are my little pig
I love you
""")
```
## GitHub Copilot as an encyclopedia
I decided to ask Copilot a few random questions to test its encyclopedia
abilities.
{{< figure src="what-is-boba" >}}
{{< figure src="what-is-github-copilot" >}}
{{< figure src="who-is-steve-jobs" >}}
I had run out of questions to ask, so I just started the comment with a generic
"what is" and let Copilot finish the question and answer.
{{< figure src="what-is-the-purpose-of-this-file" >}}
That last line came out of nowhere!

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

View File

@ -1,13 +1,10 @@
--- ---
title: Text substitution in Discord using `sed` title: Text substitution in Discord using `sed`
date: 2021-03-25T18:48:15-05:00 date: 2021-03-25
toc: false toc: false
comments: true comments: true
authors:
- bbaovanc
aliases: aliases:
- /blog/posts/sed-text-substitution-in-discord/ - /blog/posts/sed-text-substitution-in-discord/
- /blog/posts/text-substitution-in-discord-using-sed/ - /blog/posts/text-substitution-in-discord-using-sed/

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

View File

@ -1,32 +1,20 @@
--- ---
title: The redesign of my website title: The redesign of my website
date: 2021-10-18T14:03:05-05:00 date: 2021-10-16
toc: true toc: true
comments: true comments: true
authors:
- bbaovanc
tags: tags:
- announcement - announcement
- blog - blog
- hugo - hugo
- bobatheme
resources: resources:
- name: feature - name: feature
src: bobatheme.webp src: bobatheme.webp
title: Homepage on bbaovanc.com, using bobatheme. title: Homepage on bbaovanc.com, using bobatheme.
- name: actions-comment
src: github-actions-deploy-comment.webp
title: Comment from GitHub Actions that links to the pull request preview.
- name: deployment
src: pull-request-deployment.webp
title: GitHub deployments are created for the previews as well.
--- ---
For the past three weeks I've been designing and perfecting a new theme for my For the past three weeks I've been designing and perfecting a new theme for my
@ -40,11 +28,11 @@ I've switched to a new theme. Visually, it's similar to
[hugo-bearblog](https://github.com/janraasch/hugo-bearblog) which was the theme [hugo-bearblog](https://github.com/janraasch/hugo-bearblog) which was the theme
I had previously. Bearblog does a great job for being simple and very light, but I had previously. Bearblog does a great job for being simple and very light, but
it's not featureful enough for me. bobatheme has a lot of fancy features thanks it's not featureful enough for me. bobatheme has a lot of fancy features thanks
to Hugo. For example: list pages (such as [/blog/]({{< ref "/blog/" >}})) have to Hugo. For example: list pages (such as [/blog/](/blog/)) have previews for
previews for each article, including featured images or videos for select each article, including featured images or videos for select articles. You can
articles. You can also link to specific headers in an article, and articles have also link to specific headers in an article, and articles have metadata such as
metadata such as word count, reading time, and the git commit that last modified word count, reading time, and the git commit that last modified them. My
them. My favorite new feature, however, is that bobatheme has icons. favorite new feature, however, is that bobatheme has icons.
### Icons ### Icons
@ -64,17 +52,12 @@ features such as copying code blocks to the clipboard.
My website's source code was previously on git.bbaovanc.com, but I migrated it My website's source code was previously on git.bbaovanc.com, but I migrated it
to [a new repository on GitHub](https://github.com/BBaoVanC/bbaovanc.com) so I to [a new repository on GitHub](https://github.com/BBaoVanC/bbaovanc.com) so I
could use Netlify/GitHub Actions to automatically build website previews for could use Netlify to automatically build website previews for pull requests.
pull requests.
### Automatic Pull Request Previews ### Netlify
Every pull request has its own preview built for it using GitHub Actions, which Every pull request has its own preview built for it using Netlify, which is
is linked in a comment, and shown as a deployment on the pull request. linked in a comment.
{{< figure src="actions-comment" >}}
{{< figure src="deployment" >}}
## Translations ## Translations
@ -87,11 +70,16 @@ for more information).
### Tracking Status ### Tracking Status
I'm currently tracking translation status using [GitHub I'm currently tracking translation status using [GitHub
projects](https://github.com/BBaoVanC/bbaovanc.com/projects). There's a projects](https://github.com/BBaoVanC/bbaovanc.com/projects). Each language has
[Translation Pull Requests](https://github.com/BBaoVanC/bbaovanc.com/projects/1) one "progress" project which shows each page's translation status in the
project which tracks the review status of translation pull requests in all language. For example, here's the [Spanish Translation
languages. If you want to look at pull requests for a specific language, you can Progress](https://github.com/BBaoVanC/bbaovanc.com/projects/4)
filter by the label (for example: Spanish is `translate-es`).
There's also a [Translation Pull
Requests](https://github.com/BBaoVanC/bbaovanc.com/projects/1) project which
tracks the review status of translation pull requests in all languages. If you
want to look at pull requests for a specific language, you can filter by the
translation label (for example: Spanish is `translate-es`).
### Contribute translations ### Contribute translations

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.7 KiB

View File

@ -1,63 +0,0 @@
---
title: Using Github Copilot to write a blog post
date: 2021-11-07T16:17:15-06:00
toc: true
comments: true
authors:
- bbaovanc
tags:
- github-copilot
- blog
series:
- GitHub Copilot Experiments
# this will be shown for the article in list pages and in the page metadata
# it can be either an image or video (this might change in the future, however)
resources:
- name: feature
src: copilot-blog-post.webp
title: GitHub Copilot helps me write a blog post.
- name: print-a-news-article
src: print-a-news-article.webp
---
I found out that GitHub Copilot can write in Markdown, so I decided to get it to
write a blog post for me. Here's how I did it.
<!--more-->
## Preface
I recommend you read my [other blog post about Copilot]({{< ref
"/blog/github-copilot-experiments/index.md" >}}) where I showed a bunch of
examples of code I generated using Copilot. Near the end of it, I started to
experiment asking some questions to it, rather than using it to generate code.
That turned out to be a great idea, and led to the creation of this blog post.
## Writing English with Copilot
After using Copilot as an encyclopedia, I got an idea. What if I used GitHub
Copilot to generate ideas?
{{< figure src="print-a-news-article" >}}
I decided to take it a step further and set the language to Markdown. I started
writing out the basic structure of a blog post on my website and let it
autocomplete.
{{< figure src="feature" >}}
I'm not quite sure who Kurt A. Smith is, why Copilot chose April Fools 2020 for
the date, or why it was so adamant on writing a blog post about itself. What I
do know is that I would be able to write a blog post. All I had to do was type a
word or two, and Copilot turned it into a couple sentences.
## The finished product
The actual blog post written by Copilot is available [here]({{< ref "../copilot-post/" >}}).

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

View File

@ -1,125 +0,0 @@
---
title: Youtube URL structures you should know
date: 2021-10-30T21:20:38-05:00
toc: true
comments: true
authors:
- bbaovanc
tags:
- youtube
- url-structures
resources:
- name: feature
src: youtube-url.webp
title: YouTube URL
- name: mdn-url-parameters
src: mdn-url-parameters@x2.png
title: >-
[What is a
URL?](https://developer.mozilla.org/en-US/docs/Learn/Common_questions/What_is_a_URL#parameters)
by [Mozilla
Contributors](https://developer.mozilla.org/en-US/docs/MDN/About/contributors.txt)
is licensed under [CC-BY-SA
2.5](https://creativecommons.org/licenses/by-sa/2.5/)
---
Knowing the basic structure and parameters in a YouTube URL can come in handy on
the occasion you need it. Here's how to find the video ID, link to a specific
timestamp, and more.
<!--more-->
## What is youtu.be?
YouTube has its own domain for [URL
shortening](https://en.wikipedia.org/wiki/URL_shortening): `youtu.be`. It's
roughly equivalent to `youtube.com/watch`.
## Query parameter basics
Query parameters can be added to a URL just by suffixing it with something like
`?key=value&something=else`. That example sets `key` to `value` and `something`
to `else`. Note how the first parameter is prefixed with `?`, and then the
following parameters are separated with `&`.
{{< figure src="mdn-url-parameters" >}}
See the [page on the Mozilla Developer
Docs](https://developer.mozilla.org/en-US/docs/Learn/Common_questions/What_is_a_URL)
for more information on the anatomy of a URL.
## Linking to a video
Here's the video I'll be using as an example:
{{< youtube F6va6tg62qg >}}
I embedded that video on my website with this code:[^1]
```text
{{</* youtube F6va6tg62qg */>}}
```
The argument there (`F6va6tg62qg`) is the video ID, which is the unique
identifier for the video. Here's how the YouTube URLs for that video look:
- https://www.youtube.com/watch?v=F6va6tg62qg
- https://youtu.be/F6va6tg62qg
Take note that on `youtube.com`, the video ID is provided as a [query
parameter](#query-parameter-basics), and on `youtu.be`, it's just provided as
the path of the URL.
## Linking a specific timestamp
You can add the `t=` parameter to the URL to have it automatically seek to a
specific timestamp when opened. The value can be expressed in hours, minutes,
and seconds (using `h`, `m`, and `s` respectively). Here's how that looks:
- https://www.youtube.com/watch?v=F6va6tg62qg&t=14s
- https://youtu.be/F6va6tg62qg?t=14s
Unfortunately my example video isn't long enough to show hours or minutes, so
here's a different one:
- https://www.youtube.com/watch?v=dQw4w9WgXcQ&t=3m14s
- https://youtu.be/dQw4w9WgXcQ?t=3m14s
Those link 3 minutes and 14 seconds into the video. Notice how the `youtube.com`
link prefixes the `t=` parameter with an `&` since it's the second parameter.
The `youtu.be` link just uses a `?` because it's the first (and only) parameter.
## Playlists
The `list=` parameter contains the ID of the playlist you're watching the video
from, if any. Otherwise, the parameter is omitted. Here's how that looks:
- https://www.youtube.com/watch?v=47dtFZ8CFo8&list=PLwxnUUM01nt2nMh9DPq09e6fIDbumybgt
- https://youtu.be/47dtFZ8CFo8?list=PLwxnUUM01nt2nMh9DPq09e6fIDbumybgt
There, the playlist ID was `PLwxnUUM01nt2nMh9DPq09e6fIDbumybgt`. You can link to
the playlist itself with a format like:
```text
https://youtube.com/playlist?list=[playlist_id]
```
For example, the direct link to the playlist in the two example links I used is:
- https://youtube.com/playlist?list=PLwxnUUM01nt2nMh9DPq09e6fIDbumybgt
As far as I know, it's not possible to link to a playlist using `youtu.be`.
## Further reading
[This Stack Exchange answer](https://webapps.stackexchange.com/a/9881) is a good
reference for some other YouTube parameters.
[^1]: I use a static site generator called [Hugo](https://gohugo.io) for my
website.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

View File

@ -5,9 +5,6 @@ menu: main
toc: false toc: false
comments: false comments: false
authors:
- bbaovanc
description: >- description: >-
Want to contact me? Here's how you can. Want to contact me? Here's how you can.

View File

@ -5,12 +5,9 @@ menu: main
toc: false toc: false
comments: false comments: false
authors:
- bbaovanc
description: >- description: >-
I have a few cryptocurrency addresses that you can use if you want to donate I have a few cryptocurrency addresses that you can use if you want to donate to
to me. me.
--- ---

View File

@ -5,9 +5,6 @@ menu: main
toc: true toc: true
comments: false comments: false
authors:
- bbaovanc
aliases: aliases:
- /blog/links/ - /blog/links/

View File

@ -1,9 +0,0 @@
---
title: Github Copilot Experiments
description: >-
Make sure to read the last two posts where I made GitHub Copilot write a blog
post itself.
---

View File

@ -1,4 +0,0 @@
#!/bin/sh -x
rm -rf public/
HUGO_ENABLEMISSINGTRANSLATIONPLACEHOLDERS=true hugo -D --baseURL "https://demo.bbaovanc.com/test/$1"
rsync -avPzc --delete-delay public/ bbaosrv:/var/www/demo.bbaovanc.com/test/$1/

View File

@ -1,3 +0,0 @@
{{ if eq .Site.BaseURL "https://bbaovanc.com" }}
<script defer data-domain="bbaovanc.com" src="https://plausible.bbaovanc.com/js/bobalytics.js"></script>
{{ end }}

View File

@ -1,34 +1,43 @@
{{ if ne .Site.BaseURL "https://bbaovanc.com" }} <hr id="comments-hr">
<i>Comment section is not available during development previews.</i>
{{ else }}
<noscript>
<small>
<i>Enable JavaScript to see the comment section.</i>
</small>
</noscript>
{{ $id := "" }} <noscript>
{{ with .Params.discussionId }} <style>
{{ $id = . }} #comments-hr {
{{ else }} display: none;
{{ if .IsTranslated }} }
{{ with index .AllTranslations 0 }} </style>
{{ $id = .Permalink }}
{{ end }}
{{ else }}
{{ $id = .Permalink }}
{{ end }}
{{ end }}
<script>talkyardServerUrl='{{ .Site.Params.talkyardServerUrl }}';</script> <small>
<script async defer src="{{ .Site.Params.talkyardScriptUrl }}"></script> <i>Enable JavaScript to see the comment section.</i>
<!-- You can specify a per page discussion id on the next line, if your URLs might change. --> </small>
<div class="talkyard-comments" data-discussion-id="{{ $id }}" style="margin-top: 45px;"> </noscript>
</div>
<div class="comments-footer" style="text-align: right;"> {{ $url := .Permalink }}
<small>
<p style="margin: 0;">Comments powered by <a href="https://www.talkyard.io">Talkyard</a>.</p> {{ if .IsTranslated }}
<p style="margin: 0;">Discussion ID: <code>{{ $id }}</code></p> {{ with index .AllTranslations 0 }}
</small> {{ $url = .Permalink }}
</div>
{{ end }} {{ end }}
{{ end }}
<script>
var remark_config = {
host: "https://remark.boba.best",
site_id: "bbaovanc.com",
components: [
"embed",
//"last-comments",
//"counter",
],
url: "{{ $url }}", // make this permalink the main language so all languages have the same comments
max_shown_comments: 10,
theme: "dark",
page_title: "{{ .Title }}",
locale: "{{ .Language.Lang }}",
show_email_subscription: true,
simple_view: false,
};
</script>
<script>!function(e,n){for(var o=0;o<e.length;o++){var r=n.createElement("script"),c=".js",d=n.head||n.body;"noModule"in r?(r.type="module",c=".mjs"):r.async=!0,r.defer=!0,r.src=remark_config.host+"/web/"+e[o]+c,d.appendChild(r)}}(remark_config.components||["embed"],document);</script>
<div id="remark42"></div>

4
netlify.toml Normal file
View File

@ -0,0 +1,4 @@
[[headers]]
for = "/*"
[headers.values]
Access-Control-Allow-Origin = "*"