1051Wget & Multibyte

Making a copy of a website with wget should work like that:

wget -r mywebsite.com

-r recursively crawls the site, default is until level 5.

With filenames with non-latin characters, wget is not happy:

bash Incomplete or invalid multibyte sequence encountered Incomplete or invalid multibyte sequence encountered Incomplete or invalid multibyte sequence encountered Incomplete or invalid multibyte sequence encountered

That seems to be a bug in wget.

Workaround

wget -r --restrict-file-names=nocontrol mywebsite.com

1046Resizing & Compressing Movies with ffmpeg

Resizing Movies with ffmpeg

Scaling down Full HD from 1920x1080 to 960x540:

ffmpeg -i input.mp4 -s 960x540 -c:a copy output.mp4

-i ... input
-s ... scale
-c ... codec

Compressing with H.2645

ffmpeg -i input.mp4 -vcodec libx265 -crf 28 output.mp4

crf ... video quality, lower value means better quality

1044networkQuality

Testing network speed on macOS:

networkQuality

Example output:

Downlink: capacity 24.052 Mbps, responsiveness 321 RPM - Uplink: capacity 0.000
Downlink: capacity 24.052 Mbps, responsiveness 294 RPM - Uplink: capacity 20.669
Downlink: capacity 24.548 Mbps, responsiveness 250 RPM - Uplink: capacity 20.669
Downlink: capacity 24.548 Mbps, responsiveness 248 RPM - Uplink: capacity 17.763
Downlink: capacity 26.099 Mbps, responsiveness 243 RPM - Uplink: capacity 17.763
Downlink: capacity 26.099 Mbps, responsiveness 243 RPM - Uplink: capacity 16.716
Downlink: capacity 26.567 Mbps, responsiveness 240 RPM - Uplink: capacity 16.716
Downlink: capacity 26.567 Mbps, responsiveness 240 RPM - Uplink: capacity 16.632
Downlink: capacity 27.436 Mbps, responsiveness 237 RPM - Uplink: capacity 16.632
Downlink: capacity 27.436 Mbps, responsiveness 235 RPM - Uplink: capacity 15.908
Downlink: capacity 27.120 Mbps, responsiveness 194 RPM - Uplink: capacity 15.908
Downlink: capacity 27.120 Mbps, responsiveness 185 RPM - Uplink: capacity 16.711
Downlink: capacity 25.164 Mbps, responsiveness 156 RPM - Uplink: capacity 16.711
Downlink: capacity 25.164 Mbps, responsiveness 150 RPM - Uplink: capacity 16.939
Downlink: capacity 24.892 Mbps, responsiveness 124 RPM - Uplink: capacity 16.939
Downlink: capacity 24.892 Mbps, responsiveness 118 RPM - Uplink: capacity 17.627
Downlink: capacity 23.011 Mbps, responsiveness 108 RPM - Uplink: capacity 17.627
Downlink: capacity 23.011 Mbps, responsiveness 100 RPM - Uplink: capacity 15.339
Downlink: capacity 22.093 Mbps, responsiveness 87 RPM - Uplink: capacity 15.339
Downlink: capacity 22.093 Mbps, responsiveness 85 RPM - Uplink: capacity 13.592
Downlink: capacity 23.291 Mbps, responsiveness 63 RPM - Uplink: capacity 13.592
Downlink: capacity 23.291 Mbps, responsiveness 63 RPM - Uplink: capacity 14.177
Downlink: capacity 23.291 Mbps, responsiveness 43 RPM - Uplink: capacity 17.627 
==== SUMMARY ====
Uplink capacity: 17.627 Mbps
Downlink capacity: 23.291 Mbps
Responsiveness: Low (43 RPM)
Idle Latency: 19.708 milliseconds

1040Checking a POP3 Connection with OpenSSL

This is mainly used for troubleshooting POP3 connections, to check if the connection/server/password actually works. Also possible to read emails that way, but very ~1995ish. If you really, really want to (re-) experience that experience, check out alpine, the sucessor of pine.

Start connection with OpenSSL:

openssl s_client -connect yourusername.yourmailserver:995

This is non-quiet, resulting in a lot of talkback, most importantly:

    ...
    Start Time: 1693034257
    Timeout   : 7200 (sec)
    Verify return code: 0 (ok)
    Extended master secret: no
    Max Early Data: 0
---
read R BLOCK
+OK Dovecot ready.

+OK Dovecot ready. tells use the mail programme - in this case Dovecot - is ready, waiting for user & password input.

user youremailaddress
+OK
pass yourpassword
+OK Logged in.

The stat command tells you how many message, and how large they are.

stat
+OK 2 9394

Ok, two message, totalling 9394 bytes. To read it, use the retrive command, specifiying the number of the message you want to read.

retr 1

This will display the whole message, including any and all headers.

1038Turing on Directory View in Apache

Situation

Your directory on your Apache Server does not have an index.html and creates a 404 when visited. But there are files in the directory, that should be displayed.

Solution

Create a .htaccess file and add the following line:

Options +Indexes

This only works, if AllowOverride Options is set to true in your Apache Settings.

1033How to kill a screen

Mac, Terminal

Open screen with log flag, address & baud rate

screen -L /dev/tty.usbmodem14101 9600

End the session with: ^a - k (press control+a, release, then press k)

Screenshots to follow

1030Concatenating Videos with ffmpeg

Concatenating videos with the Quicktime Player requires unnecessary decoding/encoding, with takes time and computational resources.

Solution: Concatente Files von FFMPEG

https://trac.ffmpeg.org/wiki/Concatenate

Using ffmpeg

  1. Create a list: mylist.txt

    file '/path/to/file1.mp4'
    file '/path/to/file2.mp4'
    file '/path/to/file3.mp4'
  2. Run ffmpeg ffmpeg -f concat -i mylist.txt -c copy output.mp4

Troubleshooting

[concat @ 0x7fc407904080] Unsafe file name '2008-08-05 21_38_08.mov' mylist.txt: Operation not permitted

Filenames should not have spaces, escape them with \.

1028Setting up GitHub Command-Line Access

This is a short, condensed instruction how to set-up command-line access to github.com. Written is response to onboard new FabAcademy students - and get them started with MkDocs.

This guides is for macOS 12 or higher. My Mac uses macOS Ventura 13.0.01.

Step 1: Creating a new SSH Key

Go to the .ssh directory.

$ cd ~/.ssh

Made new key:

$ ssh-keygen -t ed25519 -C "your_email@example.com"
  • Don't just copy, put in your email. I also added a password.
  • Also, don't copy the $, just the ssh-keygen -t ed25519 -C "your_email@example.com" part. But with your email.

You can name your key. For this example, we call it id_github_test.

Step 2: Adding SSH Key to ssh-agent.

$ eval "$(ssh-agent -s)"

Step 3: Adding Key Info to config

Open .ssh/config in your favourite text editor. If you want to stay at the command line, use nano.

Add the following:

Host *.github.com
  AddKeysToAgent yes
  UseKeychain yes
  IdentityFile ~/.ssh/id_github_test

Step 4: Adding the Key to ssh-agent

Adding private key to ssh-agent

$ ssh-add --apple-use-keychain ~/.ssh/id_github_test

This add the new key to the Apple Keychain.

If you used a passphrase when you created the key, you will be asked for it now.

Enter passphrase for /Users/georg/.ssh/id_github_test: 
Identity added: /Users/georg/.ssh/id_github_test (your_email@example.com)

Step 5: Adding Public Key to github.com

  • Log into Github
  • Profile > Settings > SSH and GPG Keys
  • Click 'New SSH Key'

Copy and paster your public key, in this example case, id_github_test.pub.

The tutorial on Github suggest to copy the public key using a command:

$ pbcopy < ~/.ssh/id_github_test.pub      

pbcopy - for paste board copy is the terminal interface to the macOS' Copy & Paste. pbcopy < read the content of a file into the copy memory. After running pbcopy you can press Command-V to paste the text.

  • Paste the copied SSH Public Key.

Step 5.1: Two-Factor Authentication at GitHub.com

I setup Two-Factor Authentication at GitHub.com, I had to confirm the addition of a new key via my mobile GitHub App. Your mileage might vary.

Step 6: Testing the connection

$ ssh -T git@github.com
Hi trembl! You've successfully authenticated, 
but GitHub does not provide shell access.

Ok, great! It worked!

Now you can clone, add, commit, push and pull!

Sources:

1027SSH Key Permissions too open

This warning is pretty self- explanatory:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0644 for '/Users/georg/.ssh/my_rsa_key' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.

Solution

Limit the key to read/write access by the user only:

chmod 600 ~/.ssh/my_rsa_key

It's also possible to make it only readable by the user, but then you need to chmod every time you want to update/change it.

chmod 400 ~/.ssh/my_rsa_key

Sources: StackOverflow

1025hugo Shortcuts

Quick run through hugo Installation & Update on macOS.

Install hugo

brew install hugo

Check Version

hugo version

hugo v0.109.0+extended darwin/amd64 BuildDate=unknown

Upgrade hugo

brew upgrade hugo
Warning: hugo 0.109.0 already installed

Create New Site

hugo new site my-new-hugo-site
cd my-new-hugo-site
git init
git submodule add https://github.com/theNewDynamic/gohugo-theme-ananke themes/ananke
echo "theme = 'ananke'" >> config.toml

hugo does not come with an in-built theme, therefore we need to clone the anake theme into themes/ananke. More hugo themes. Clone and update config.toml.

Serve Site

hugo server

Build Site

Just hugo, nothing else.

hugo
Start building sites … 
hugo v0.109.0+extended darwin/amd64 BuildDate=unknown
INFO 2022/12/26 19:37:15 syncing static files to /

                   | EN  
-------------------+-----
  Pages            | 10  
  Paginator pages  |  0  
  Non-page files   |  0  
  Static files     |  1  
  Processed images |  0  
  Aliases          |  1  
  Sitemaps         |  1  
  Cleaned          |  0  

Total in 154 ms