Day: September 26, 2021

TODO: Using foobar2000 to verify music file integrity

Using foobar2000 to verify music file integrity

Couldn't found install component feature in MacOS version.

Download File Integrity Verifier

Download component from following location

File Integrity Verifier

Install component

Install component using following steps

  • Open the foobar2000 preferences dialog (click "File | Preferences" or use the CTRL+P keyboard shortcut).
  • Select the Components page.
  • Either click the Install... button and locate the component archive, or simply drag it on to the list.
  • Click OK ...
  • Restart.

Testing

Tested on following formats

  • flac

Cons

  • Failed to test on dff format.

TODO

Test

Replace audio in a video file

Replace audio in a video file

When downloaded video file, there could be a reason requires replace audio due to different language, etc.

Extract audio from a video file

For example, extract audio from with_audio.mp4 and save audio as file output-audio.acc

ffmpeg -i with_audio.mp4 -map 0:a:0 -c copy output-audio.aac
ffmpeg -i with_audio.mp4 -vn -acodec copy output-audio.aac

Merge video and audio into one file

Following command give two inputs, first one is video file (index 0), second one is audio file (index 1). The first -map means getting first input (index 0) as video in first output (out_index 0), and the second -map means getting second input (index 1) as audio in first output (out_index 0).

ffmpeg -i without_audio.mp4 -i output-audio.aac -c:v copy -map 0:v:0 -map 1:a:0 new.mp4

Install self generated CA certificate into Linux OS

Install self generated CA certificate into Linux OS

To trust self generated CA from client system, following steps can be used.

Retrieve CA certificate from server

Copy from CA certificate using browser

Click on lock icron beside address bar of browser, then view certificates.

Copy from server,

The self generated CA certificate normally can be found in server, such as xxxx.ca.crt.

Run command to retrieve from service

Following command will print out CA certificate, remove unnecessary lines, such as DONE, if any.

Note: I haven't validated the certificate retrieved using this method.

openssl s_client -showcerts -connect [server_address]:[port] < /dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p'

Install CA certificate

Copy CA certificate into /usr/local/share/ca-certificates directory, such as xxxx.ca.crt, then run update-ca-certificates command to update system CA, then restart impacted service.

cp <xxxx.ca.crt> /usr/local/share/ca-certificates
update-ca-certificates
systemctl restart <service>

Note: the certificate file name must be .crt

Test CA

Run following command, should return 0 (ok) as below.

openssl s_client -connect server_address:443 -CApath /etc/ssl/certs

...
Verify return code: 0 (ok)

Configure trust self generated CA certificate of docker registry

Configure trust self generated CA certificate of docker registry

When self generated CA certificate has not been trusted by docker client, following error occurres

... x509: certificate signed by unknown authority

Install CA certificate for docker only

Docker can install registry CA as /etc/docker/certs.d/<registry[:port]>/ca.crt. For example,

/etc/docker/certs.d/my-registry.example.com:5000/ca.crt

Note: If port is 443, it should be omitted. Otherwise, it won't work.

Install CA certificate into system folder

To install self generated CA certificate for operating system, follow the page below.

Install self generated CA certificate into Linux OS

Restart docker service to take effect

The restart docker service after CA certificate installed.

systemctl restart docker

Increase client_max_body_size in NGINX for docker registry

Increase client_max_body_size in NGINX for docker registry

Error "413 Request Entity Too Large" occurred when push image to docker registry.

To fix this issue, add client_max_body_size in NGINX configuration file for docker registry as below, then restart NGINX.

server {
    listen 443;
    server_name hub.bx.net docker.bx.net registry.bx.net dockerhub.bx.net;

    location /v2/ {
        proxy_pass https://registry.my_bridge/v2/;
        proxy_set_header  Authorization $http_authorization;
        proxy_pass_header Authorization;
    }

    client_max_body_size 100M;
}

Backup docker container using shell script

j# Backup docker container using shell script

Backup

Using following shell script to backup docker container with date tag

#!/bin/bash
# backup-docker.sh <container_name> <registry_path>

container=$1            # <container_name>
repo_prefix=$2          # <registry>/<prefix>
registry=${repo_prefix//\/*/}

repo_name=$repo_prefix/`hostname`/$container
repo_path=$repo_name:`date +%Y%m%d`

docker commit $container $repo_path
docker login $registry
docker push $repo_path

Note: If following certification error occurred, follow the page below to install ceritficate.

Configure trust self generated ca certificate of docker registry

List repo

Using following shell command to list repo list in docker registry

curl https://bianxi:$PASSWORD@${registry}/v2/_catalog

Sample output

{"repositories":["bianxi/dnsmasq","bianxi/heart/dnsmasq"]}

List tags

Using follwing shell command to list tags for one repo in docker registry

echo curl https://bianxi:$PASSWORD@${registry}/v2/${repo}/tags/list

Sample output

{"name":"bianxi/heart/dnsmasq","tags":["20210620","20210621","20210622","20210623","20210624","20210625","20210626","20210627"]}

Get digest for tag

Get digest by pull image

docker pull registry.bx.net/bianxi/heart/dnsmasq:20210624

Sample output

20210624: Pulling from bianxi/heart/dnsmasq
...
22b5d63ad977: Already exists
8e2e66517d7e: Pull complete
Digest: sha256:7535af1f65524f9200b901fc31b9c779819e45c0502ef99605666842a319908f

Verify digest

curl https://bianxi:$PASSWORD@registry.bx.net/v2/bianxi/heart/dnsmasq/manifests/sha256:xxxxxxxxxxxxxxxx
curl -v --silent -H "Accept: application/vnd.docker.distribution.manifest.v2+json" -X GET https://bianxi:$PASSWORD@registry.bx.net/v2/bianxi/heart/dnsmasq/manifests/20210624 2>&1 | grep Docker-Content-Digest | awk '{print ($3)}'

Delete local repo

docker rmi registry.bx.net/bianxi/heart/dnsmasq:<tag>

Delete tag

curl -X DELETE https://bianxi:$PASSWORD@registry.bx.net/v2/bianxi/heart/dnsmasq/manifests/sha256:xxxxxxxxxxxxxxxx

Run garbage-collect

docker exec registry bin/registry garbage-collect --delete-untagged /etc/docker/registry/config.yml

Restart registry if necessary

docker restart registry

Create your website with blocks

Create your website with blocks

This is an example page from WordPress.

Add block patterns

Block patterns are pre-designed groups of blocks. To add one, select the Add Block button [+] in the toolbar at the top of the editor. Switch to the Patterns tab underneath the search bar, and choose a pattern.

Frame your images

Twenty Twenty-One includes stylish borders for your content. With an Image block selected, open the "Styles" panel within the Editor sidebar. Select the "Frame" block style to activate it.

Overlap columns

Twenty Twenty-One also includes an overlap style for column blocks. With a Columns block selected, open the "Styles" panel within the Editor sidebar. Choose the "Overlap" block style to try it out.

“Roses Trémières” by Berthe Morisot
“In the Bois de Boulogne” by Berthe Morisot
“Young Woman in Mauve” by Berthe Morisot