Compare commits
110 Commits
es/new-com
...
es/edited-
Author | SHA1 | Date | |
---|---|---|---|
0a1ce4a396
|
|||
c24cdee46c
|
|||
2a79a86fd6
|
|||
97bc1980eb
|
|||
cef1103070
|
|||
1332c16841
|
|||
b124d89391
|
|||
0d432e200c
|
|||
5286bb029f | |||
31e25c2578
|
|||
1033b84687
|
|||
b9a95983b9
|
|||
b14a46d48b
|
|||
99b03ea7ba
|
|||
9c6a2a059d | |||
e10c3a1150
|
|||
9e0d2a9d8f
|
|||
576124d42d
|
|||
7b8f47b56b
|
|||
cab56bd859
|
|||
672bfae812
|
|||
ca40973701 | |||
b2d3bd99f3
|
|||
beb1faf3a8
|
|||
088a52aa96
|
|||
941bb5ce9e
|
|||
a628829bec
|
|||
83cd00078f
|
|||
8207535dca
|
|||
2aec5d33b3
|
|||
11f8115735
|
|||
46af6d4de2
|
|||
efdc6364de
|
|||
5260ca987c
|
|||
8f0b1d4952
|
|||
75f0038a37
|
|||
4d64d0ab0b
|
|||
45d26b2f9f
|
|||
cb02d6f586
|
|||
00a84889b0
|
|||
a4e5997b47
|
|||
1b09947ee6
|
|||
282a5319cc
|
|||
5cc3102deb
|
|||
8c1ee6efe9
|
|||
8a96465a20
|
|||
e3d77d6f60
|
|||
49b7a3a8a1
|
|||
c08d6a927f
|
|||
b23760585d
|
|||
95695e1187
|
|||
4a1d52e11b
|
|||
77731aacb8
|
|||
2dd9928654
|
|||
83f0c77d8d
|
|||
6a1760e3a0
|
|||
2a9af4d89e
|
|||
5250eb5b1d
|
|||
c12fe39134
|
|||
78b7b78e0a
|
|||
37e3442b39
|
|||
f7e2098020
|
|||
54d2599ad3
|
|||
ec7575d7f1
|
|||
bdf9f7737a
|
|||
7f584afa21
|
|||
ad3a77fd7a
|
|||
835068bcbe
|
|||
c92d12cdcd
|
|||
b9b1de8722
|
|||
16b0afafd3
|
|||
0824589054
|
|||
68db383c73
|
|||
b10919bfb0
|
|||
3035740ad1
|
|||
e806ff1b35
|
|||
83bef16379
|
|||
a490baacad
|
|||
cbae5a2fee
|
|||
b76454649b
|
|||
fc67f210d9
|
|||
954bcc19b7
|
|||
a6d6b3ba3c
|
|||
157eb700dd
|
|||
8082b78d02
|
|||
740b849f08
|
|||
04dd824362
|
|||
6a28ab60d4
|
|||
538132bee3
|
|||
fd4022d32d
|
|||
295c4c8095
|
|||
f93f8a643e
|
|||
e4fecdc4c8
|
|||
31053a0a29
|
|||
99bedbaffa
|
|||
b942f7a6a9
|
|||
fc730ad0de
|
|||
da12ee2101
|
|||
ef7eac1bb4
|
|||
9690d77b36
|
|||
463c26a0e0
|
|||
054547afd0
|
|||
dd6d1ac0de
|
|||
c96b2fb91c
|
|||
32933f9001
|
|||
70b2233113
|
|||
b45c051914
|
|||
a887380e66
|
|||
3dd852d3b9
|
|||
a6076f691a
|
59
.github/workflows/audit.yml
vendored
Normal file
@ -0,0 +1,59 @@
|
||||
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 "(<nil>)" public/
|
||||
|
||||
- name: Audit - HAHAHUGO
|
||||
if: always()
|
||||
run: |
|
||||
! grep -inorE "hahahugo" public/
|
15
.github/workflows/deploy.yml
vendored
@ -1,6 +1,7 @@
|
||||
name: Deploy
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
@ -25,20 +26,28 @@ jobs:
|
||||
extended: true
|
||||
|
||||
- name: Build
|
||||
run: hugo --i18n-warnings --path-warnings
|
||||
run: hugo --printI18nWarnings --printPathWarnings
|
||||
|
||||
- name: Compress
|
||||
run: |
|
||||
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
|
||||
uses: up9cloud/action-rsync@v1
|
||||
env:
|
||||
HOST: bbaovanc.com
|
||||
HOST: srv.bbaovanc.com
|
||||
USER: droneci
|
||||
PORT: 2222
|
||||
SOURCE: public/
|
||||
MODE: push
|
||||
VERBOSE: true
|
||||
KEY: ${{secrets.DEPLOY_SSH_KEY}}
|
||||
TARGET: /var/www/bbaovanc/public/
|
||||
TARGET: /var/www/bbaovanc.com/public/
|
||||
ARGS: -avPzc --delete-delay --exclude=/.git/ --exclude=/.github/
|
||||
|
16
.github/workflows/pull_request.yml
vendored
@ -27,6 +27,7 @@ jobs:
|
||||
token: ${{ github.token }}
|
||||
env: pr-${{ github.event.number }}
|
||||
ref: ${{ github.head_ref }}
|
||||
no_override: false
|
||||
|
||||
- name: Setup Hugo
|
||||
uses: peaceiris/actions-hugo@v2
|
||||
@ -35,23 +36,31 @@ jobs:
|
||||
extended: true
|
||||
|
||||
- name: Build
|
||||
run: hugo --i18n-warnings --path-warnings --baseURL "https://demo.bbaovanc.com/pull_request/${{ github.event.number }}"
|
||||
run: hugo --printI18nWarnings --printPathWarnings --baseURL "https://demo.bbaovanc.com/pull_request/${{ github.event.number }}"
|
||||
|
||||
- name: Compress
|
||||
run: |
|
||||
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
|
||||
uses: up9cloud/action-rsync@v1
|
||||
env:
|
||||
HOST: bbaovanc.com
|
||||
HOST: srv.bbaovanc.com
|
||||
USER: droneci
|
||||
PORT: 2222
|
||||
SOURCE: public/
|
||||
MODE: push
|
||||
VERBOSE: true
|
||||
KEY: ${{secrets.DEPLOY_SSH_KEY}}
|
||||
TARGET: /var/www/demo/pull_request/${{ github.event.number }}/
|
||||
TARGET: /var/www/demo.bbaovanc.com/pull_request/${{ github.event.number }}/
|
||||
ARGS: -avPzc --delete-delay --exclude=/.git/ --exclude=/.github/
|
||||
|
||||
- name: Finish deployment
|
||||
uses: bobheadxi/deployments@v0.6.0
|
||||
@ -82,4 +91,5 @@ jobs:
|
||||
A preview of this pull request is ready!
|
||||
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}}
|
||||
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
|
||||
|
12
.github/workflows/pull_request_cleanup.yml
vendored
@ -13,15 +13,17 @@ jobs:
|
||||
uses: kielabokkie/ssh-key-and-known-hosts-action@v1
|
||||
with:
|
||||
ssh-private-key: ${{ secrets.DEPLOY_SSH_KEY }}
|
||||
ssh-host: bbaovanc.com
|
||||
ssh-host: srv.bbaovanc.com
|
||||
ssh-port: 2222
|
||||
|
||||
- name: Delete pull request on server
|
||||
run:
|
||||
ssh -p 2222 droneci@bbaovanc.com rm -r /var/www/demo/pull_request/${{ github.event.number }}/
|
||||
ssh -p 2222 droneci@srv.bbaovanc.com rm -r /var/www/demo.bbaovanc.com/pull_request/${{ github.event.number }}/
|
||||
|
||||
- name: Delete deployment
|
||||
uses: strumwolf/delete-deployment-environment@v2
|
||||
- name: Deactivate deployment
|
||||
uses: bobheadxi/deployments@v0.6.0
|
||||
with:
|
||||
step: deactivate-env
|
||||
token: ${{ github.token }}
|
||||
environment: pr-${{ github.event.number }}
|
||||
env: pr-${{ github.event.number }}
|
||||
desc: Deployment was pruned
|
||||
|
5
.gitignore
vendored
@ -14,3 +14,8 @@ hugo.darwin
|
||||
hugo.linux
|
||||
|
||||
# End of https://www.toptal.com/developers/gitignore/api/hugo
|
||||
|
||||
/.hugo_build.lock
|
||||
|
||||
# My private drafts
|
||||
/content/blog/drafts/
|
||||
|
@ -52,10 +52,10 @@ than an entire essay with the same amount of information.
|
||||
|
||||
## Building
|
||||
|
||||
## Automatic deploy previews with Netlify
|
||||
## Automatic deploy previews with GitHub Actions
|
||||
|
||||
Netlify will automatically build each pull request into a public deploy preview,
|
||||
and will link it in a comment.
|
||||
My GitHub Actions workflows will automatically build each pull request into a
|
||||
public deploy preview on demo.bbaovanc.com, and will link it in a comment.
|
||||
|
||||
## Manual (local) building
|
||||
|
||||
|
97
LICENSE
@ -1,4 +1,4 @@
|
||||
Attribution-ShareAlike 4.0 International
|
||||
Attribution 4.0 International
|
||||
|
||||
=======================================================================
|
||||
|
||||
@ -54,18 +54,16 @@ exhaustive, and do not form part of our licenses.
|
||||
|
||||
=======================================================================
|
||||
|
||||
Creative Commons Attribution-ShareAlike 4.0 International Public
|
||||
License
|
||||
Creative Commons Attribution 4.0 International Public License
|
||||
|
||||
By exercising the Licensed Rights (defined below), You accept and agree
|
||||
to be bound by the terms and conditions of this Creative Commons
|
||||
Attribution-ShareAlike 4.0 International Public License ("Public
|
||||
License"). To the extent this Public License may be interpreted as a
|
||||
contract, You are granted the Licensed Rights in consideration of Your
|
||||
acceptance of these terms and conditions, and the Licensor grants You
|
||||
such rights in consideration of benefits the Licensor receives from
|
||||
making the Licensed Material available under these terms and
|
||||
conditions.
|
||||
Attribution 4.0 International Public License ("Public License"). To the
|
||||
extent this Public License may be interpreted as a contract, You are
|
||||
granted the Licensed Rights in consideration of Your acceptance of
|
||||
these terms and conditions, and the Licensor grants You such rights in
|
||||
consideration of benefits the Licensor receives from making the
|
||||
Licensed Material available under these terms and conditions.
|
||||
|
||||
|
||||
Section 1 -- Definitions.
|
||||
@ -84,11 +82,7 @@ Section 1 -- Definitions.
|
||||
and Similar Rights in Your contributions to Adapted Material in
|
||||
accordance with the terms and conditions of this Public License.
|
||||
|
||||
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
|
||||
c. Copyright and Similar Rights means copyright and/or similar rights
|
||||
closely related to copyright including, without limitation,
|
||||
performance, broadcast, sound recording, and Sui Generis Database
|
||||
Rights, without regard to how the rights are labeled or
|
||||
@ -96,33 +90,29 @@ Section 1 -- Definitions.
|
||||
specified in Section 2(b)(1)-(2) are not Copyright and Similar
|
||||
Rights.
|
||||
|
||||
e. Effective Technological Measures means those measures that, in the
|
||||
d. Effective Technological Measures means those measures that, in the
|
||||
absence of proper authority, may not be circumvented under laws
|
||||
fulfilling obligations under Article 11 of the WIPO Copyright
|
||||
Treaty adopted on December 20, 1996, and/or similar international
|
||||
agreements.
|
||||
|
||||
f. Exceptions and Limitations means fair use, fair dealing, and/or
|
||||
e. Exceptions and Limitations means fair use, fair dealing, and/or
|
||||
any other exception or limitation to Copyright and Similar Rights
|
||||
that applies to Your use of the Licensed Material.
|
||||
|
||||
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,
|
||||
f. Licensed Material means the artistic or literary work, database,
|
||||
or other material to which the Licensor applied this Public
|
||||
License.
|
||||
|
||||
i. Licensed Rights means the rights granted to You subject to the
|
||||
g. Licensed Rights means the rights granted to You subject to the
|
||||
terms and conditions of this Public License, which are limited to
|
||||
all Copyright and Similar Rights that apply to Your use of the
|
||||
Licensed Material and that the Licensor has authority to license.
|
||||
|
||||
j. Licensor means the individual(s) or entity(ies) granting rights
|
||||
h. Licensor means the individual(s) or entity(ies) granting rights
|
||||
under this Public License.
|
||||
|
||||
k. Share means to provide material to the public by any means or
|
||||
i. Share means to provide material to the public by any means or
|
||||
process that requires permission under the Licensed Rights, such
|
||||
as reproduction, public display, public performance, distribution,
|
||||
dissemination, communication, or importation, and to make material
|
||||
@ -130,13 +120,13 @@ Section 1 -- Definitions.
|
||||
public may access the material from a place and at a time
|
||||
individually chosen by them.
|
||||
|
||||
l. Sui Generis Database Rights means rights other than copyright
|
||||
j. Sui Generis Database Rights means rights other than copyright
|
||||
resulting from Directive 96/9/EC of the European Parliament and of
|
||||
the Council of 11 March 1996 on the legal protection of databases,
|
||||
as amended and/or succeeded, as well as other essentially
|
||||
equivalent rights anywhere in the world.
|
||||
|
||||
m. You means the individual or entity exercising the Licensed Rights
|
||||
k. You means the individual or entity exercising the Licensed Rights
|
||||
under this Public License. Your has a corresponding meaning.
|
||||
|
||||
|
||||
@ -182,13 +172,7 @@ Section 2 -- Scope.
|
||||
Licensed Rights under the terms and conditions of this
|
||||
Public License.
|
||||
|
||||
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
|
||||
b. No downstream restrictions. You may not offer or impose
|
||||
any additional or different terms or conditions on, or
|
||||
apply any Effective Technological Measures to, the
|
||||
Licensed Material if doing so restricts exercise of the
|
||||
@ -270,24 +254,9 @@ following conditions.
|
||||
information required by Section 3(a)(1)(A) to the extent
|
||||
reasonably practicable.
|
||||
|
||||
b. ShareAlike.
|
||||
|
||||
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.
|
||||
4. If You Share Adapted Material You produce, the Adapter's
|
||||
License You apply must not prevent recipients of the Adapted
|
||||
Material from complying with this Public License.
|
||||
|
||||
|
||||
Section 4 -- Sui Generis Database Rights.
|
||||
@ -302,9 +271,8 @@ apply to Your use of the Licensed Material:
|
||||
b. if You include all or a substantial portion of the database
|
||||
contents in a 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,
|
||||
Rights (but not its individual contents) is Adapted Material; and
|
||||
|
||||
including for purposes of Section 3(b); and
|
||||
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.
|
||||
|
||||
@ -407,21 +375,22 @@ Section 8 -- Interpretation.
|
||||
|
||||
=======================================================================
|
||||
|
||||
Creative Commons is not a party to its public licenses.
|
||||
Notwithstanding, Creative Commons may elect to apply one of its public
|
||||
licenses to material it publishes and in those instances will be
|
||||
considered the “Licensor.” The text of the Creative Commons public
|
||||
licenses is dedicated to the public domain under the CC0 Public Domain
|
||||
Dedication. Except for the limited purpose of indicating that material
|
||||
is shared under a Creative Commons public license or as otherwise
|
||||
permitted by the Creative Commons policies published at
|
||||
Creative Commons is not a party to its public
|
||||
licenses. Notwithstanding, Creative Commons may elect to apply one of
|
||||
its public licenses to material it publishes and in those instances
|
||||
will be considered the “Licensor.” The text of the Creative Commons
|
||||
public licenses is dedicated to the public domain under the CC0 Public
|
||||
Domain Dedication. Except for the limited purpose of indicating that
|
||||
material is shared under a Creative Commons public license or as
|
||||
otherwise permitted by the Creative Commons policies published at
|
||||
creativecommons.org/policies, Creative Commons does not authorize the
|
||||
use of the trademark "Creative Commons" or any other trademark or logo
|
||||
of Creative Commons without its prior written consent including,
|
||||
without limitation, in connection with any unauthorized modifications
|
||||
to any of its public licenses or any other arrangements,
|
||||
understandings, or agreements concerning use of licensed material. For
|
||||
the avoidance of doubt, this paragraph does not form part of the public
|
||||
licenses.
|
||||
the avoidance of doubt, this paragraph does not form part of the
|
||||
public licenses.
|
||||
|
||||
Creative Commons may be contacted at creativecommons.org.
|
||||
|
||||
|
45
config.toml
@ -1,45 +0,0 @@
|
||||
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"
|
53
config.yaml
Normal file
@ -0,0 +1,53 @@
|
||||
baseURL: https://bbaovanc.com
|
||||
theme: bobatheme
|
||||
defaultContentLanguage: en
|
||||
copyright: '© 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
|
@ -3,7 +3,9 @@
|
||||
title: Home
|
||||
|
||||
description: >-
|
||||
This is my website.
|
||||
This is my website, home to my blog and other personal pages. It's powered by
|
||||
my own custom theme named bobatheme, available at
|
||||
https://github.com/BBaoVanC/bobatheme.
|
||||
|
||||
---
|
||||
|
||||
|
@ -1,39 +0,0 @@
|
||||
---
|
||||
|
||||
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
|
@ -1,41 +0,0 @@
|
||||
---
|
||||
|
||||
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.
|
10
content/authors/bbaovanc/_index.md
Normal file
@ -0,0 +1,10 @@
|
||||
---
|
||||
|
||||
title: bbaovanc
|
||||
|
||||
---
|
||||
|
||||
I think you can probably tell from the website URL that I'm the one who owns
|
||||
this website.
|
||||
|
||||
<!--more-->
|
10
content/authors/github-copilot/_index.md
Normal file
@ -0,0 +1,10 @@
|
||||
---
|
||||
|
||||
title: Github Copilot
|
||||
|
||||
---
|
||||
|
||||
More information at https://copilot.github.com/. See [this
|
||||
post](/blog/copilot-post) for how I did it.
|
||||
|
||||
<!--more-->
|
@ -3,6 +3,6 @@
|
||||
title: Blog
|
||||
|
||||
description: >-
|
||||
Mis entradas de blog
|
||||
El hogar de mi blog.
|
||||
|
||||
---
|
||||
|
@ -3,6 +3,6 @@
|
||||
title: Blog
|
||||
|
||||
description: >-
|
||||
My blog posts
|
||||
The home of my blog.
|
||||
|
||||
---
|
||||
|
@ -1,10 +1,13 @@
|
||||
---
|
||||
|
||||
title: Allow non root processes to bind to privileged ports in Linux
|
||||
date: 2021-03-28
|
||||
date: 2021-03-28T21:29:52-05:00
|
||||
toc: true
|
||||
comments: true
|
||||
|
||||
authors:
|
||||
- bbaovanc
|
||||
|
||||
aliases:
|
||||
- posts/allow-non-root-processes-to-bind-to-privileged-ports/
|
||||
|
||||
|
BIN
content/blog/caddy-is-the-best-webserver/caddy-browse.webp
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
content/blog/caddy-is-the-best-webserver/caddy.webp
Normal file
After Width: | Height: | Size: 42 KiB |
228
content/blog/caddy-is-the-best-webserver/index.md
Normal file
@ -0,0 +1,228 @@
|
||||
---
|
||||
|
||||
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)
|
@ -1,10 +1,13 @@
|
||||
---
|
||||
|
||||
title: Checkra1n GUI on other Linux distros
|
||||
date: 2021-03-25
|
||||
date: 2021-03-25T21:19:51-05:00
|
||||
toc: true
|
||||
comments: true
|
||||
|
||||
authors:
|
||||
- bbaovanc
|
||||
|
||||
aliases:
|
||||
- posts/checkra1n-gui-on-other-distros/
|
||||
|
||||
|
337
content/blog/copilot-post/index.md
Normal file
@ -0,0 +1,337 @@
|
||||
---
|
||||
|
||||
# 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])
|
||||
```
|
40
content/blog/edited-in-middle-of-message-discord/index.es.md
Normal file
@ -0,0 +1,40 @@
|
||||
---
|
||||
|
||||
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
|
@ -1,10 +1,13 @@
|
||||
---
|
||||
|
||||
title: Put `(edited)` in the middle of a message in Discord
|
||||
date: 2021-03-25
|
||||
toc: false
|
||||
date: 2021-03-25T18:48:34-05:00
|
||||
toc: true
|
||||
comments: true
|
||||
|
||||
authors:
|
||||
- bbaovanc
|
||||
|
||||
aliases:
|
||||
- posts/edited-in-middle-of-message-discord/
|
||||
|
||||
@ -28,14 +31,37 @@ message.
|
||||
|
||||
## Tutorial
|
||||
|
||||
1. Copy the "right-to-left embedding" character (U+202A) 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)`
|
||||
Before you start, copy the "right-to-left embedding" character
|
||||
([U+202B](https://unicode-explorer.com/c/202B)) to your clipboard.
|
||||
|
||||
*This post was adapted from [gitea:bbaovanc/discord-tricks][1]*
|
||||
### Method 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
|
||||
|
BIN
content/blog/github-copilot-experiments/boba-shop-color.webp
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
content/blog/github-copilot-experiments/boba-shop-size.webp
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
content/blog/github-copilot-experiments/boba-shop.webp
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
content/blog/github-copilot-experiments/cheese-burger-poem.webp
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
content/blog/github-copilot-experiments/dropdown-css.webp
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
content/blog/github-copilot-experiments/girlfriend.webp
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
content/blog/github-copilot-experiments/horrible-code.webp
Normal file
After Width: | Height: | Size: 7.2 KiB |
179
content/blog/github-copilot-experiments/index.md
Normal file
@ -0,0 +1,179 @@
|
||||
---
|
||||
|
||||
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!
|
BIN
content/blog/github-copilot-experiments/python-twinkle-poem.webp
Normal file
After Width: | Height: | Size: 10 KiB |
BIN
content/blog/github-copilot-experiments/rust-poem.webp
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
content/blog/github-copilot-experiments/sing.webp
Normal file
After Width: | Height: | Size: 3.6 KiB |
BIN
content/blog/github-copilot-experiments/what-is-boba.webp
Normal file
After Width: | Height: | Size: 6.3 KiB |
After Width: | Height: | Size: 3.9 KiB |
After Width: | Height: | Size: 10 KiB |
BIN
content/blog/github-copilot-experiments/who-is-steve-jobs.webp
Normal file
After Width: | Height: | Size: 15 KiB |
@ -1,10 +1,13 @@
|
||||
---
|
||||
|
||||
title: Text substitution in Discord using `sed`
|
||||
date: 2021-03-25
|
||||
date: 2021-03-25T18:48:15-05:00
|
||||
toc: false
|
||||
comments: true
|
||||
|
||||
authors:
|
||||
- bbaovanc
|
||||
|
||||
aliases:
|
||||
- /blog/posts/sed-text-substitution-in-discord/
|
||||
- /blog/posts/text-substitution-in-discord-using-sed/
|
||||
|
After Width: | Height: | Size: 30 KiB |
@ -1,20 +1,32 @@
|
||||
---
|
||||
|
||||
title: The redesign of my website
|
||||
date: 2021-10-16
|
||||
date: 2021-10-18T14:03:05-05:00
|
||||
toc: true
|
||||
comments: true
|
||||
|
||||
authors:
|
||||
- bbaovanc
|
||||
|
||||
tags:
|
||||
- announcement
|
||||
- blog
|
||||
- hugo
|
||||
- bobatheme
|
||||
|
||||
resources:
|
||||
- name: feature
|
||||
src: bobatheme.webp
|
||||
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
|
||||
@ -28,11 +40,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
|
||||
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
|
||||
to Hugo. For example: list pages (such as [/blog/](/blog/)) have previews for
|
||||
each article, including featured images or videos for select articles. You can
|
||||
also link to specific headers in an article, and articles have metadata such as
|
||||
word count, reading time, and the git commit that last modified them. My
|
||||
favorite new feature, however, is that bobatheme has icons.
|
||||
to Hugo. For example: list pages (such as [/blog/]({{< ref "/blog/" >}})) have
|
||||
previews for each article, including featured images or videos for select
|
||||
articles. You can also link to specific headers in an article, and articles have
|
||||
metadata such as word count, reading time, and the git commit that last modified
|
||||
them. My favorite new feature, however, is that bobatheme has icons.
|
||||
|
||||
### Icons
|
||||
|
||||
@ -52,12 +64,17 @@ features such as copying code blocks to the clipboard.
|
||||
|
||||
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
|
||||
could use Netlify to automatically build website previews for pull requests.
|
||||
could use Netlify/GitHub Actions to automatically build website previews for
|
||||
pull requests.
|
||||
|
||||
### Netlify
|
||||
### Automatic Pull Request Previews
|
||||
|
||||
Every pull request has its own preview built for it using Netlify, which is
|
||||
linked in a comment.
|
||||
Every pull request has its own preview built for it using GitHub Actions, which
|
||||
is linked in a comment, and shown as a deployment on the pull request.
|
||||
|
||||
{{< figure src="actions-comment" >}}
|
||||
|
||||
{{< figure src="deployment" >}}
|
||||
|
||||
## Translations
|
||||
|
||||
@ -70,16 +87,11 @@ for more information).
|
||||
### Tracking Status
|
||||
|
||||
I'm currently tracking translation status using [GitHub
|
||||
projects](https://github.com/BBaoVanC/bbaovanc.com/projects). Each language has
|
||||
one "progress" project which shows each page's translation status in the
|
||||
language. For example, here's the [Spanish Translation
|
||||
Progress](https://github.com/BBaoVanC/bbaovanc.com/projects/4)
|
||||
|
||||
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`).
|
||||
projects](https://github.com/BBaoVanC/bbaovanc.com/projects). There's 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 label (for example: Spanish is `translate-es`).
|
||||
|
||||
### Contribute translations
|
||||
|
||||
|
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 9.7 KiB |
@ -0,0 +1,63 @@
|
||||
---
|
||||
|
||||
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/" >}}).
|
After Width: | Height: | Size: 25 KiB |
125
content/blog/youtube-url-structures-you-should-know/index.md
Normal file
@ -0,0 +1,125 @@
|
||||
---
|
||||
|
||||
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.
|
After Width: | Height: | Size: 5.9 KiB |
After Width: | Height: | Size: 3.3 KiB |
@ -5,6 +5,9 @@ menu: main
|
||||
toc: false
|
||||
comments: false
|
||||
|
||||
authors:
|
||||
- bbaovanc
|
||||
|
||||
description: >-
|
||||
Want to contact me? Here's how you can.
|
||||
|
||||
|
@ -5,9 +5,12 @@ menu: main
|
||||
toc: false
|
||||
comments: false
|
||||
|
||||
authors:
|
||||
- bbaovanc
|
||||
|
||||
description: >-
|
||||
I have a few cryptocurrency addresses that you can use if you want to donate to
|
||||
me.
|
||||
I have a few cryptocurrency addresses that you can use if you want to donate
|
||||
to me.
|
||||
|
||||
---
|
||||
|
||||
|
@ -5,6 +5,9 @@ menu: main
|
||||
toc: true
|
||||
comments: false
|
||||
|
||||
authors:
|
||||
- bbaovanc
|
||||
|
||||
aliases:
|
||||
- /blog/links/
|
||||
|
||||
|
9
content/series/github-copilot-experiments/_index.md
Normal file
@ -0,0 +1,9 @@
|
||||
---
|
||||
|
||||
title: Github Copilot Experiments
|
||||
|
||||
description: >-
|
||||
Make sure to read the last two posts where I made GitHub Copilot write a blog
|
||||
post itself.
|
||||
|
||||
---
|
4
demo.sh
Executable file
@ -0,0 +1,4 @@
|
||||
#!/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/
|
3
layouts/partials/additional-head.html
Normal file
@ -0,0 +1,3 @@
|
||||
{{ if eq .Site.BaseURL "https://bbaovanc.com" }}
|
||||
<script defer data-domain="bbaovanc.com" src="https://plausible.bbaovanc.com/js/bobalytics.js"></script>
|
||||
{{ end }}
|
@ -1,43 +1,34 @@
|
||||
<hr id="comments-hr">
|
||||
|
||||
<noscript>
|
||||
<style>
|
||||
#comments-hr {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
{{ if ne .Site.BaseURL "https://bbaovanc.com" }}
|
||||
<i>Comment section is not available during development previews.</i>
|
||||
{{ else }}
|
||||
<noscript>
|
||||
<small>
|
||||
<i>Enable JavaScript to see the comment section.</i>
|
||||
</small>
|
||||
</noscript>
|
||||
</noscript>
|
||||
|
||||
{{ $url := .Permalink }}
|
||||
{{ $id := "" }}
|
||||
{{ with .Params.discussionId }}
|
||||
{{ $id = . }}
|
||||
{{ else }}
|
||||
{{ if .IsTranslated }}
|
||||
{{ with index .AllTranslations 0 }}
|
||||
{{ $id = .Permalink }}
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
{{ $id = .Permalink }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ if .IsTranslated }}
|
||||
{{ with index .AllTranslations 0 }}
|
||||
{{ $url = .Permalink }}
|
||||
<script>talkyardServerUrl='{{ .Site.Params.talkyardServerUrl }}';</script>
|
||||
<script async defer src="{{ .Site.Params.talkyardScriptUrl }}"></script>
|
||||
<!-- You can specify a per page discussion id on the next line, if your URLs might change. -->
|
||||
<div class="talkyard-comments" data-discussion-id="{{ $id }}" style="margin-top: 45px;">
|
||||
</div>
|
||||
<div class="comments-footer" style="text-align: right;">
|
||||
<small>
|
||||
<p style="margin: 0;">Comments powered by <a href="https://www.talkyard.io">Talkyard</a>.</p>
|
||||
<p style="margin: 0;">Discussion ID: <code>{{ $id }}</code></p>
|
||||
</small>
|
||||
</div>
|
||||
{{ 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>
|
||||
|
@ -1,4 +0,0 @@
|
||||
[[headers]]
|
||||
for = "/*"
|
||||
[headers.values]
|
||||
Access-Control-Allow-Origin = "*"
|