//nuacht.flounder.online/gemlog

<name>nuacht</name>

<title>mkisofs</title>

<updated>2023-09-20T00:00:00Z</updated>

<id>tag:nuacht.flounder.online,2023-09-20:/gemlog/2023-09-20-mkisofs.gmi</id>

<content type="text/plain"># mkisofs&#xA;To make an ISO of a directory, just use:&#xA;```&#xA;mkisofs -o filename.iso directory/&#xA;```</content>

<link href="//nuacht.flounder.online/gemlog/2023-09-20-mkisofs.gmi" rel="alternate"></link>

<summary type="text/plain"></summary>

<title>Strings in Bash</title>

<updated>2023-07-20T00:00:00Z</updated>

<id>tag:nuacht.flounder.online,2023-07-20:/gemlog/2023-07-20-bash-strings.gmi</id>

<content type="text/plain"># Strings in Bash&#xA;&#xA;```&#xA;$ STR=&#34;0123Linux9&#34;&#xA;$ echo ${STR:4:5}&#xA;Linux&#xA;```&#xA;(from baeldung.com)</content>

<link href="//nuacht.flounder.online/gemlog/2023-07-20-bash-strings.gmi" rel="alternate"></link>

<summary type="text/plain"></summary>

<title>7zip</title>

<updated>2023-07-07T00:00:00Z</updated>

<id>tag:nuacht.flounder.online,2023-07-07:/gemlog/2023-07-07-7zip.gmi</id>

<content type="text/plain"># 7zip&#xA;&#xA;To create:&#xA;```&#xA;7z a secure.7z * -pSECRET&#xA;&#xA;Where:&#xA;7z        : executable&#xA;a         : add to archive&#xA;secure.7z : destination archive&#xA;*         : add all files from current dir to archive&#xA;-pSECRET  : specify the password &#34;SECRET&#34;&#xA;```&#xA;&#xA;To open:&#xA;```&#xA;7z x secure.7z&#xA;```</content>

<link href="//nuacht.flounder.online/gemlog/2023-07-07-7zip.gmi" rel="alternate"></link>

<summary type="text/plain"></summary>

<title>Docker (RPi3B)</title>

<updated>2023-07-02T00:00:00Z</updated>

<id>tag:nuacht.flounder.online,2023-07-02:/gemlog/2023-07-02-docker.gmi</id>

<content type="text/plain"># Docker (RPi3B)&#xA;&#xA;## Install Docker&#xA;curl -sSl https://get.docker.com | sh&#xA;sudo usermod -aG docker pi&#xA;docker (check that we get output).&#xA;&#xA;## Docker Compose&#xA;pip3 install docker-compose&#xA;(log out and back in)&#xA;&#xA;## Install a Docker application&#xA;mkdir -p ./DockerContainers/&lt;app-name&gt;/config:/config&#xA;cd DockerContainers/&lt;app-name&gt;/&#xA;nano docker-compose.yml (and add the config from whatever source shares it online)&#xA;docker-compose up -d&#xA;&#xA;## docker run cannot be issued twice for the same &#34;thing&#34;. docker start is needed subsequently. &#xA;See here for details:&#xA;=&gt; https://stackoverflow.com/questions/31697828/docker-name-is-already-in-use-by-container</content>

<link href="//nuacht.flounder.online/gemlog/2023-07-02-docker.gmi" rel="alternate"></link>

<summary type="text/plain"></summary>

<title>HTTP</title>

<updated>2023-06-05T00:00:00Z</updated>

<id>tag:nuacht.flounder.online,2023-06-05:/gemlog/2023-06-05-HTTP.gmi</id>

<content type="text/plain"># HTTP&#xA;## Redirects&#xA;With just HTML, this method works&#xA;```&#xA;&lt;!DOCTYPE html&gt;&#xA;&lt;html&gt;&#xA;  &lt;head&gt;&#xA;    &lt;meta http-equiv=&#34;refresh&#34; content=&#34;0; url=&#39;http://mosuíomh.ie/&#39;&#34; /&gt;&#xA;  &lt;/head&gt;&#xA;  &lt;body&gt;&#xA;    &lt;p&gt;You will be redirected to mosuíomh.ie now.&lt;/p&gt;&#xA;  &lt;/body&gt;&#xA;&lt;/html&gt;&#xA;```</content>

<link href="//nuacht.flounder.online/gemlog/2023-06-05-HTTP.gmi" rel="alternate"></link>

<summary type="text/plain"></summary>

<title>Gemini Server</title>

<updated>2023-04-27T00:00:00Z</updated>

<id>tag:nuacht.flounder.online,2023-04-27:/gemlog/2023-04-27-gemini-server.gmi</id>

<content type="text/plain"># Gemini Server&#xA;## Download agate (server) binary.&#xA;https://github.com/mbrubeck/agate&#xA;gemini://qwertqwefsday.eu/agate.gmi&#xA;&#xA;## Create&#xA;* A folder for capsule that uses domain name with tld, eg; oro.mo.bhaidin&#xA;* A script to launch agate against your capsule:&#xA;```&#xA;#!/bin/bash&#xA;agate --hostname oro.mo.bhaidin  --content ~/path/to/oro.mo.bhaidin&#xA;```&#xA;&#xA;## Crontab&#xA;Set crontab to launch the script after reboot with:&#xA;```&#xA;@reboot sleep 60; ~/serve/gael.agate&#xA;```&#xA;&gt; Agate creates a .certificates directory will be created containing per-capsule certificates.&#xA;&#xA;&gt; Note: a capsule is a site in gemini lingo.</content>

<link href="//nuacht.flounder.online/gemlog/2023-04-27-gemini-server.gmi" rel="alternate"></link>

<summary type="text/plain"></summary>

<title>Home Server Setup</title>

<updated>2023-04-26T00:00:00Z</updated>

<id>tag:nuacht.flounder.online,2023-04-26:/gemlog/2023-04-26-home-server-setup.gmi</id>

<content type="text/plain"># Home Server Setup&#xA;After a disk failing I&#39;ve decided to rebuild my server from scratch and document it here. It serves:&#xA;&#xA;## Contents&#xA;- Base System: RPi 3 &amp; SSD dock&#xA;- Connectivity: Samba and SSH&#xA;- Gemini: agate&#xA;- HTTP: lighttpd&#xA;- Scripts&#xA;- Configs&#xA;&#xA;&#xA;## Base System: RPi 3 &amp; SSD dock&#xA;1. I used rpi-imager and selected the image that facilitates USB booting. It&#39;s available in a sub menu. Boot this without other peripherals and it flashes the Pi so that it can boot without the SD card in future.&#xA;&#xA;2. Use rpi-imager again to install the &#34;Lite&#34; version of Raspian. Once selected, click the cog/gear icon and choose to enable SSH since it&#39;s a server system. We don&#39;t need a keyboard, mouse and monitor for this. Set your hostname and other preferences here. Then select your target device; your connected SSD drive and click &#34;Write&#34; to begin writing the operating system to the SSD. Afterwards, you can remove it from your computer, connect it to the Pi and boot the Pi with the ethernet cable connecting it to your router.&#xA;&#xA;From here, you have a base system that you can SSH into and install software on.&#xA;&#xA;## Connectivity: Samba and SSH&#xA;SSH is best in most cases and already configured, but once in a while being able to mount a share is a huge help.&#xA;&#xA;Install samba and set up shares. See //nuacht.flounder.online/gemlog/2022-07-12-samba.gmi for details&#xA;&#xA;## Gemini: agate&#xA;Download the agate binary and run the command against your domain directory. See here for notes, including crontab note to survive reboots: https://nuacht.flounder.online/gemlog/2023-04-27-gemini-server.gmi&#xA;&#xA;## HTTP: lighttpd&#xA;```&#xA;sudo apt install lighttpd&#xA;```&#xA;&gt; This package is becoming harder to find in repositories because it&#39;s so old and unmaintained. There might be better alternatives out there these days.&#xA;```&#xA;nano /etc/lighttpd/lighttpd.conf&#xA;```&#xA;Update this file to point to where your content is actually stored. Mine is ~/&lt;path-to-site&gt;/&#xA;&#xA;It runs after booting automatically but if you need to restart it (maybe to pick up config changes), just issue:&#xA;```&#xA;service lighttpd restart&#xA;```&#xA;&#xA;Some expected files are symlinked. Should those need to be recreated, do:&#xA;```&#xA;for f in *.abc; do ln -sf $(pwd)/$f ~/path/to/destination/; done&#xA;```&#xA;&#xA;## Scripts: &#xA;### crontab&#xA;User crontabs are stored in /var/spool/cron/crontabs. Check your backups here to retrieve old values.&#xA;### CDXL converter&#xA;### tmux&#xA;Full tmux entry here https://nuacht.flounder.online/gemlog/2022-07-13-tmux.gmi&#xA;### also restore:&#xA;~/.bashrc&#xA;&#xA;### Script Dependencies&#xA;lynx(?)&#xA;libxml2-utils&#xA;certificates for Freeshell.de so files can be transferred without interaction&#xA;&#xA;## Config files to restore via scp(may overwrite work done above)&#xA;/etc/lighttpd/lighttpd.conf&#xA;~/.certificates (belonging to agate)&#xA;~/.nanorc should contain:&#xA;```&#xA;set softwrap&#xA;set positionlog&#xA;```&#xA;&#xA;## One-off commands to run&#xA;Disable annoying message with:&#xA;```&#xA;sudo raspi-config nonint do_wifi_country XX&#xA;```&#xA;&#xA;</content>

<link href="//nuacht.flounder.online/gemlog/2023-04-26-home-server-setup.gmi" rel="alternate"></link>

<summary type="text/plain"></summary>

<title>Error mounting /dev/sdb2 wrong fs type, bad option, bad superblock on /dev/sdb2, missing codepage or helper program, or other error</title>

<updated>2023-04-24T00:00:00Z</updated>

<id>tag:nuacht.flounder.online,2023-04-24:/gemlog/2023-04-24-error-mounting.gmi</id>

<content type="text/plain"># Error mounting /dev/sdb2 wrong fs type, bad option, bad superblock on /dev/sdb2, missing codepage or helper program, or other error&#xA;&#xA;Running dmesg showed a &#34;bad geometry&#34; error:&#xA;```&#xA;kern  :warn  : [ +35.991538] EXT4-fs (sdb2): bad geometry: block count 29239414 exceeds size of device (29239413 blocks)&#xA;```&#xA;&#xA;To fix, on the unmounted partition: &#xA;```&#xA;e2fsck -f /dev/XXX&#xA;resize2fs /dev/XXX&#xA;```</content>

<link href="//nuacht.flounder.online/gemlog/2023-04-24-error-mounting.gmi" rel="alternate"></link>

<summary type="text/plain"></summary>

<title>mutt</title>

<updated>2023-03-22T00:00:00Z</updated>

<id>tag:nuacht.flounder.online,2023-03-22:/gemlog/2023-03-22-mutt.gmi</id>

<content type="text/plain"># mutt&#xA;&#xA;## Compose new and send&#xA;```&#xA;Q - query address book to find contact &#xA;m - new mail (manual e-mail address entry)&#xA;(save and exit editor when message has been written)&#xA;a - attach file?&#xA;y - send message&#xA;```&#xA;&#xA;## Reply to a message&#xA;```&#xA;r - reply&#xA;(save and exit editor when message has been written)&#xA;a - attach file?&#xA;y - send message&#xA;```</content>

<link href="//nuacht.flounder.online/gemlog/2023-03-22-mutt.gmi" rel="alternate"></link>

<summary type="text/plain"></summary>

<title>aliases</title>

<updated>2023-03-19T00:00:00Z</updated>

<id>tag:nuacht.flounder.online,2023-03-19:/gemlog/2023-03-19-alias.gmi</id>

<content type="text/plain"># aliases&#xA;&#xA;In .bashrc, you can say something like&#xA;```&#xA;alias l=&#39;ls --color=auto&#39;&#xA;```&#xA;and you can then just type &#39;l&#39; followed by return to run the ls command.&#xA;&#xA;&#xA;For something more advanced, you can have an alias call a script to check a conditition before allowing the command to run. This is helpful in my git sandbox where the index.html file is sometimes a dummy file, since it faces the internet. I don&#39;t want to check that in by accident - I want to swap the dummy for the real one before git ever executes anything.&#xA;&#xA;So my alias for git now calls a script to handle all of this. Typing git from a bash terminal, or any terminal that uses .bashrc will do this:&#xA;```&#xA;alias git=&#39;/home/pi/bin/gitcheck.sh&#39;&#xA;```&#xA;&#xA;Then the script itself checks the contents of index.html for the contents that are in the real file. If they are there, it also checks that the file size is above 100k, since this is also a property of the real file. The dummy file is tiny in comparison. I&#39;m then confident to let git do it&#39;s thing, which I do by calling it with the $ parameters to include up to five arguments. I assume five is enough:&#xA;```&#xA;#!/bin/bash&#xA;&#xA;# git should not check in our dummy index.html to the optimumhealth.ie repo&#xA;# so if it  doesn&#39;t contain text we know should be there,  it&#39;s the dummy and we abort&#xA;res=$(  grep -i &#34;optimum health&#34; /home/pi/http/oh.ie/index.html | wc -w  )&#xA;if [ $res == 0 ]; then &#xA;  echo &#34;You can&#39;t use git while the wrong index.html is in place&#34;; exit; &#xA;elif [ $(wc -c &lt; /home/pi/http/oh.ie/index.html) &gt; 100000 ]; then&#xA;  echo &#34;Index is large and contains our keywords. Note: git limited to 5 arguments by bin/gitcheck.sh&#34;;&#xA;  git $1 $2 $3 $4 $5;&#xA;fi&#xA;bin/gitcheck.sh (END)&#xA;```&#xA;&#xA;Now when I try to run a git command with the dumming index file in place, it saves me:&#xA;```&#xA;You can&#39;t use git while the wrong index.html is in place&#xA;```&#xA;&#xA;But when the correct index file is in place, it allows the git commands to be executed:&#xA;```&#xA;$ git status&#xA;Index is large and contains our keywords. Note: git limited to 5 arguments by bin/gitcheck.sh&#xA;On branch main&#xA;Your branch is up to date with &#39;origin/main&#39;.&#xA;&#xA;...&#xA;&#xA;no changes added to commit (use &#34;git add&#34; and/or &#34;git commit -a&#34;)&#xA;&#xA;```</content>

<link href="//nuacht.flounder.online/gemlog/2023-03-19-alias.gmi" rel="alternate"></link>

<summary type="text/plain"></summary>

<title>static website using Grav</title>

<updated>2023-03-14T00:00:00Z</updated>

<id>tag:nuacht.flounder.online,2023-03-14:/gemlog/2023-03-14-static-website-from-grav.gmi</id>

<content type="text/plain"># static website using Grav&#xA;&#xA;Grav is a very good and fast CMS system. It´s minimalistic with no database and is based on markdown. There are just three page types;&#xA;&#xA;* Standard page&#xA;* Modular page (composite of other pages / blocks)&#xA;* Blog pages&#xA;&#xA;Since I either self-host or use gitlab, I´m not interested in the webserver / PHP side of things. In fact, I´d prefer to omit them completely since the current gitlab setup works so seamlessly.&#xA;&#xA;## Solution&#xA;1) Use Grav locally to create or update the site&#xA;2) Use HTTraQt to clone the site to pure HTML files and sync _those_ to gitlab&#xA;3) Tóg leathlá ...</content>

<link href="//nuacht.flounder.online/gemlog/2023-03-14-static-website-from-grav.gmi" rel="alternate"></link>

<summary type="text/plain"></summary>

<title>tar</title>

<updated>2023-02-28T00:00:00Z</updated>

<id>tag:nuacht.flounder.online,2023-02-28:/gemlog/2023-02-28-tar.gmi</id>

<content type="text/plain"># tar&#xA;&#xA;## create archive&#xA;tar cf &lt;filename.tar&gt; &lt;file1&gt; &lt;file2&gt; ...&#xA;&#xA;## extract archive&#xA;tar xf &lt;filename.tar&gt;</content>

<link href="//nuacht.flounder.online/gemlog/2023-02-28-tar.gmi" rel="alternate"></link>

<summary type="text/plain"></summary>

<title>git</title>

<updated>2023-02-26T00:00:00Z</updated>

<id>tag:nuacht.flounder.online,2023-02-26:/gemlog/2023-02-26-git.gmi</id>

<content type="text/plain"># git &#xA;&#xA;## git clone &lt;url&gt;&#xA;Copy a git repository to local machine&#xA;&#xA;## git clone --branch &lt;branchname&gt; &lt;remote-repo-url&gt;&#xA;Clone a branch instead&#xA;&#xA;## git add &lt;filename&gt;&#xA;Choose files to be uploaded / commited&#xA;&#xA;## git add -A&#xA;Instead of choosing, just include all changes automatically, please&#xA;&#xA;## git commit -m &#34;&lt;message&gt;&#34;&#xA;Add note to the commit&#xA;&#xA;## git push&#xA;Send / commit the files to the repository&#xA;&#xA;## git branch -a&#xA;List all git branches&#xA;&#xA;## git diff HEAD@{1}&#xA;Where n=1, diff existing code with previous commit. If n=2, compare with two commits ago.&#xA;&#xA;## undo a git add&#xA;git reset &lt;file&gt; or &lt;directory&gt;&#xA;&#xA;# Initial Setup&#xA;Instructions: https://docs.gitlab.com/ee/user/ssh.html&#xA;&#xA;Client side:&#xA;1. ssh-keygen -t ed25519 -C &#34;private key for gitlab&#34;&#xA;2. (set a filename)&#xA;3. upload contents of .pub key to https://gitlab.com/-/profile/keys&#xA;4. add an entry to ~/.ssh/config with the following:&#xA;```&#xA;Host gitlab.com&#xA;  Hostname altssh.gitlab.com&#xA;  User git&#xA;  Port 443&#xA;  PreferredAuthentications publickey&#xA;  IdentityFile ~/.ssh/gitlab.ophe.oh &#xA;  #(assuming gitlab.ophe.oh is the name set in step 2)&#xA;```&#xA;5. Run this command to test: ssh -T git@gitlab.com&#xA;&#xA;## errors&#xA;```&#xA;git@gitlab.com: Permission denied (publickey).&#xA;fatal: Could not read from remote repository.&#xA;&#xA;Please make sure you have the correct access rights&#xA;and the repository exists.&#xA;```&#xA;Running these two commands fixes this for me:&#xA;```&#xA;eval `ssh-agent -s`&#xA;ssh-add ~/.ssh/gitlab_id_rsa&#xA;```&#xA;But, this was required every time after login so what actually fixed it permanently was to apt install keychain, and then append this to .bashrc:&#xA;```&#xA;eval $(keychain -q)&#xA;```&#xA;&#xA;## SSH key expiry&#xA;For this I generated a new key:&#xA;```&#xA;ssh-keygen -t rsa -b 4096 -C &#34;&lt;identifier or email-address&gt;&#34;&#xA;```&#xA;I added the public key contents to gitlab settings-&gt;SSH keys.&#xA;Then tested with ssh -T git@gitlab.com.&#xA;&#xA;The next step was necessary but possibly only because of a previous error:&#xA;```&#xA;git remote remove origin&#xA;git remote add origin git@gitlab.com:&lt;project&gt;/repo.git&#xA;```</content>

<link href="//nuacht.flounder.online/gemlog/2023-02-26-git.gmi" rel="alternate"></link>

<summary type="text/plain"></summary>

<title>bluetooth from the terminal</title>

<updated>2022-09-30T00:00:00Z</updated>

<id>tag:nuacht.flounder.online,2022-09-30:/gemlog/2022-09-30-bluetooth.gmi</id>

<content type="text/plain"># bluetooth from the terminal&#xA;Key commands:&#xA;```&#xA;devices / paired-devices&#xA;pair&#xA;connect&#xA;## list devices&#xA;Use &#39;paired-devices&#39; or &#39;devices&#39; depending on desired specifity.&#xA;```&#xA;# paired-devices&#xA;Device 52:82:1E:6E:51:A3 Flyingtiger307 &#xA;Device AC:6A:34:9A:DE:11 Hang Up&#xA;Device FC:66:2F:E0:E8:3B iFónín 12&#xA;```&#xA;&#xA;Then connect to your choice. For Hang Up device, that would be:&#xA;```&#xA;connect AC:6A:34:9A:DE:11&#xA;```</content>

<link href="//nuacht.flounder.online/gemlog/2022-09-30-bluetooth.gmi" rel="alternate"></link>

<summary type="text/plain"></summary>

<title>SSH</title>

<updated>2022-09-21T00:00:00Z</updated>

<id>tag:nuacht.flounder.online,2022-09-21:/gemlog/2022-09-21-ssh.gmi</id>

<content type="text/plain"># SSH&#xA;&#xA;## Allow client to ssh into server with cert instead of password&#xA;On the client machine:&#xA;~/.ssh/config should contain something like this&#xA;```&#xA;Host myhost&#xA;  HostName myhost.com&#xA;  User me&#xA;  IdentityFile ~/.ssh/id_rsa (or whatever your is called)&#xA;```&#xA;&#xA;Then&#xA;```&#xA;ssh-keygen&#xA;```&#xA;Press Enter on password prompt twice to create a passwordless cert (not recommended, but fine for hobby use).&#xA;&#xA;Then copy your public key to the server:&#xA;```&#xA;ssh-copy-id pi@freebsd.local&#xA;```&#xA;&#xA;Nó need to log into the server if you already know the password.&#xA;Now you can ssh in and won´t be prompted for password (You may have to enter password the first time).&#xA;&#xA;## list remote directory contents&#xA;```&#xA;ssh user@host ls -l /some/directory&#xA;```</content>

<link href="//nuacht.flounder.online/gemlog/2022-09-21-ssh.gmi" rel="alternate"></link>

<summary type="text/plain"></summary>

<title>Cannot set LC_ALL to default locale: No such file or directory</title>

<updated>2022-09-21T00:00:00Z</updated>

<id>tag:nuacht.flounder.online,2022-09-21:/gemlog/2022-09-21-locale-error.gmi</id>

<content type="text/plain"># Cannot set LC_ALL to default locale: No such file or directory&#xA;&#xA;This error appeared every time a new application was installed via apt get. Solution:&#xA;&#xA;```&#xA;    export LC_ALL=&#34;C.UTF-8&#34;&#xA;    sudo dpkg-reconfigure locales&#xA;```</content>

<link href="//nuacht.flounder.online/gemlog/2022-09-21-locale-error.gmi" rel="alternate"></link>

<summary type="text/plain"></summary>

<title>processes</title>

<updated>2022-09-13T00:00:00Z</updated>

<id>tag:nuacht.flounder.online,2022-09-13:/gemlog/2022-09-13-Linux-processes.gmi</id>

<content type="text/plain"># processes&#xA;&#xA;## Pause and resume process&#xA;```&#xA;kill -STOP ${PID}&#xA;kill -CONT ${PID}&#xA;```</content>

<link href="//nuacht.flounder.online/gemlog/2022-09-13-Linux-processes.gmi" rel="alternate"></link>

<summary type="text/plain"></summary>

<title>ffmpeg</title>

<updated>2022-09-13T00:00:00Z</updated>

<id>tag:nuacht.flounder.online,2022-09-13:/gemlog/2022-09-13-ffmpeg.gmi</id>

<content type="text/plain"># ffmpeg&#xA;&#xA;## combine segments&#xA;```&#xA;$ cat mylist.txt&#xA;file &#39;/path/to/file1&#39;&#xA;file &#39;/path/to/file2&#39;&#xA;file &#39;/path/to/file3&#39;&#xA;    &#xA;$ ffmpeg -f concat -safe 0 -i mylist.txt -c copy output.mp4&#xA;```&#xA;&#xA;## add optional subtitles &#xA;```&#xA;ffmpeg -i infile.mp4 -i infile.srt -c copy -c:s mov_text outfile.mp4&#xA;```&#xA;&#xA;## time-shift subtitle file&#xA;```&#xA;ffmpeg -itsoffset 0.7 -i original.vtt adjusted.srt&#xA;```&#xA;&#xA;## combine video and audio without reencoding&#xA;```&#xA;ffmpeg -i video.mp4 -i audio.wav -c:v copy -c:a copy output.mp4&#xA;```&#xA;&#xA;## convert losslessly (v fast)&#xA;```&#xA;ffmpeg -i example.mkv -c copy example.mp4&#xA;```&#xA;&#xA;## convert flac to mp3. High quality&#xA;```&#xA;ffmpeg -i $f -b:a 320K $f.mp3&#xA;```&#xA;&#xA;## make file streamable&#xA;```&#xA;ffmpeg -i INPUT.mp4 -c copy -movflags faststart STREAMABLE_OUTPUT.mp4&#xA;```&#xA;or&#xA;```&#xA;ffmpeg -i &lt;input&gt; -c:v libx264 -crf 23 -c:a aac -movflags faststart output.mp4&#xA;```&#xA;&#xA;## remove a specific audio stream track&#xA;```&#xA;ffmpeg -i input -map 0 -map -0:a:2 -c copy output&#xA;     * -map 0 selects all streams from the input.&#xA;     * -map -0:a:2 then deselects audio stream 3. The stream index starts counting from 0, so audio stream 10 would be 0:a:9.&#xA;```&#xA;&#xA;## video not displaying in browser (only audio). Fix:&#xA;```&#xA;ffmpeg -i input.mp4 -c:v libx264 -preset slow -crf 20 -c:a aac -b:a 160k -vf format=yuv420p -movflags +faststart output.mp4&#xA;```&#xA;&#xA;## progress output only&#xA;```&#xA;ffmpeg -loglevel 0 -stats -i input.mp4 output.mp4&#xA;```&#xA;&#xA;## limit speed&#xA;```&#xA;-readrate 1&#xA;```&#xA;Where 1 appears as &#34;speed=1x&#34; on the stats output. It&#39;s worth checking first what speed your system achieves by default (10x in my current case) and choosing a relatively limited value (-readrate 6 in my current case) to keep the system cool and quiet.&#xA;&#xA;## trim first 5 seconds from video&#xA;```&#xA;ffmpeg -i input.mp4 -ss 5 -vcodec copy -acodec copy output.mp4&#xA;&#xA;```</content>

<link href="//nuacht.flounder.online/gemlog/2022-09-13-ffmpeg.gmi" rel="alternate"></link>

<summary type="text/plain"></summary>

<title>DNS</title>

<updated>2022-09-13T00:00:00Z</updated>

<id>tag:nuacht.flounder.online,2022-09-13:/gemlog/2022-09-13-dns.gmi</id>

<content type="text/plain"># DNS&#xA;&#xA;## Multiple Servers for One Domain&#xA;It&#39;s easy to have different servers share one domain name. Give each subdomain it&#39;s own DNS entry pointing to the relevant server.&#xA;&#xA;## DNS problem with Vodafone router&#xA;Using ping/ssh against qualified names like freebsd.local were failing. The clue to the solution is in the name of the router: Vodafone.station. They&#39;re using .station instead of .local.&#xA;&#xA;Successfully connected with:&#xA;```&#xA;ssh &lt;user&gt;@freebsd.station&#xA;```</content>

<link href="//nuacht.flounder.online/gemlog/2022-09-13-dns.gmi" rel="alternate"></link>

<summary type="text/plain"></summary>

<title>curl and wget</title>

<updated>2022-09-13T00:00:00Z</updated>

<id>tag:nuacht.flounder.online,2022-09-13:/gemlog/2022-09-13-curl-and-wget.gmi</id>

<content type="text/plain"># curl and wget&#xA;&#xA;## Get HTTP headers only&#xA;```&#xA;curl -L -I domain.com&#xA;```</content>

<link href="//nuacht.flounder.online/gemlog/2022-09-13-curl-and-wget.gmi" rel="alternate"></link>

<summary type="text/plain"></summary>

<title>printf to update same line</title>

<updated>2022-09-13T00:00:00Z</updated>

<id>tag:nuacht.flounder.online,2022-09-13:/gemlog/2022-09-13-bash-output.gmi</id>

<content type="text/plain"># printf to update same line&#xA;&#xA;## Update output on same line&#xA;```&#xA;printf &#34;\rMy static $myvars composed text&#34;&#xA;```</content>

<link href="//nuacht.flounder.online/gemlog/2022-09-13-bash-output.gmi" rel="alternate"></link>

<summary type="text/plain"></summary>

<title>convert mp4 to HAM video on Ubuntu</title>

<updated>2022-08-28T00:00:00Z</updated>

<id>tag:nuacht.flounder.online,2022-08-28:/gemlog/2022-08-28-hvconvert on linux.gmi</id>

<content type="text/plain"># convert mp4 to HAM video on Ubuntu&#xA;&#xA;There is a script to convert mp4 files to .hv. It ran on 32-bit linux and won&#39;t work by default on 64-bit linux. Below are the steps I took to get it working on Ubuntu 22.04. &#xA;&#xA;## Install hvconvert&#xA;```&#xA;wget 1.node1.de/hvconvert.tgz&#xA;tar zxvf hvconvert.tgz &#xA;```&#xA;&#xA;The above fetches and extracts the conversion program. But hvconvert depends on some things we need to set up. &#xA;&#xA;## Prepare environment&#xA;You&#39;ll get an error about avconv not being found. It&#39;s functionality has since been merged into ffmpeg, so we can fake it like so:&#xA;```&#xA;sudo ln -s /usr/bin/ffmpeg /usr/bin/avconv&#xA;```&#xA;&#xA;I also did the following. It&#39;s possible they aren&#39;t all necessary but since it&#39;s how I got things working I&#39;m giving the steps as I did them.:&#xA;&#xA;```&#xA;sudo dpkg --add-architecture i386&#xA;sudo apt install libc6:i386&#xA;sudo apt install libncurses5:i386&#xA;sudo apt install libstdc++6:i386&#xA;sudo apt install lib32z1&#xA;```&#xA;&#xA;## Get remaining 32-bit libraries&#xA;These weren&#39;t available in the default Ubuntu repo. But I downloaded a small (50MB) ISO of Slitaz Linux which has the following libraries:&#xA;&#xA;*libX11.so.6&#xA;*libXext.so.6&#xA;*libXpm.so.4&#xA;*libXrandr.so.2&#xA;*libXrender.so.1&#xA;*libxcb.so.1&#xA;*libXau.so.6&#xA;*libXdmcp.so.6&#xA;&#xA;They need to be copied to /lib/i386-linux-gnu/ on your Ubuntu machine. Download them here:&#xA;=&gt; https://archive.org/download/32-bit-libs-for-hvconvert/32-bit-libs-for-hvconvert.tar.gz&#xA;&#xA;Finally, just run the program. I have an mp4 ready to test.&#xA;&#xA;```&#xA;cd hvconvert&#xA;./hvconvert.sh 10sec.mp4&#xA;```&#xA;&#xA;This works for me. Best of luck with it.&#xA;&#xA;## Alternative&#xA;Prior to this, as a quick hack I was using Virtualbox to boot the Slitaz.iso liveCD. I would run the wget and tar commands as above and use wget to download any mp4 files I wanted to convert. Then I would use scp to send the result to the host machine like so:&#xA;&#xA;```&#xA;scp output.hv gunther@192.168.1.16:/home/gunther/Movies&#xA;```&#xA;&#xA;Obviously, you would use your own IP address and destination path etc.&#xA;&#xA;Since this is a LiveCD, I saved the state/snapshot with Virtualbox so I could return to it at any time. However, I prefer the other method so I can remove Virtualbox.&#xA;</content>

<link href="//nuacht.flounder.online/gemlog/2022-08-28-hvconvert%20on%20linux.gmi" rel="alternate"></link>

<summary type="text/plain"></summary>

<title>list installed packages by size</title>

<updated>2022-08-18T00:00:00Z</updated>

<id>tag:nuacht.flounder.online,2022-08-18:/gemlog/2022-08-18-List-installed-packages.gmi</id>

<content type="text/plain"># list installed packages by size&#xA;&#xA;```&#xA;dpkg-query -W --showformat=&#39;${Installed-Size}\t${Package}\n&#39; | sort -k1,1n&#xA;```&#xA;&#xA;Note: uninstalled packages still listed or packages that have left config files behind. To strictly list installed packages:&#xA;```&#xA;dpkg-query -W --showformat=&#39;${Installed-Size}\t${Package}\t${Status}\n&#39; | sort -k1,1n | grep installed&#xA;```</content>

<link href="//nuacht.flounder.online/gemlog/2022-08-18-List-installed-packages.gmi" rel="alternate"></link>

<summary type="text/plain"></summary>

<title>shrink a Virtual Box disk image (dynamic)</title>

<updated>2022-08-17T00:00:00Z</updated>

<id>tag:nuacht.flounder.online,2022-08-17:/gemlog/2022-08-17-shrink-virtualbox-disk.gmi</id>

<content type="text/plain"># shrink a Virtual Box disk image (dynamic)&#xA;&#xA;## In the Virtual machine itself&#xA;```&#xA;sudo apt install zerofree &#xA;```&#xA;boot into emergency mode with GRUB by pressing &#39;e&#39; and appending the line beginning with &#39;linux&#39; with the text &#xA;```&#xA;systemd.unit=emergency.target&#xA;```&#xA;F10 to boot. Log in as root and then run:&#xA;```&#xA;mount -o remount,ro / #makes the partition read-only, which zerofree requires&#xA;```&#xA;Then run: &#xA;```&#xA;zerofree -v /dev/sda1 #(or whatever you want to target)&#xA;```&#xA;Exit. Shutdown the VM and open a terminal in the host OS.&#xA;&#xA;## In the host OS terminal&#xA;&#xA;```&#xA;$ vboxmanage list hdds #see all virtual disks and identify the one you want&#xA;$ vboxmanage modifymedium disk ./VirtualBox/MyDebian/MyDebian.vdi --compact #substituting the path for the disk you want to target&#xA;```&#xA;&#xA;Done.&#xA;</content>

<link href="//nuacht.flounder.online/gemlog/2022-08-17-shrink-virtualbox-disk.gmi" rel="alternate"></link>

<summary type="text/plain"></summary>

<title>remove spaces from filenames</title>

<updated>2022-08-04T00:00:00Z</updated>

<id>tag:nuacht.flounder.online,2022-08-04:/gemlog/2022-08-04-bash-remove-filename-spaces.gmi</id>

<content type="text/plain"># remove spaces from filenames&#xA;in bash with&#xA;&#xA;```&#xA;for f in *\ *; do mv &#34;$f&#34; &#34;${f// /_}&#34;; done&#xA;```&#xA;&#xA;The above operates on all files in a directory.</content>

<link href="//nuacht.flounder.online/gemlog/2022-08-04-bash-remove-filename-spaces.gmi" rel="alternate"></link>

<summary type="text/plain"></summary>

<title>tmux</title>

<updated>2022-07-13T00:00:00Z</updated>

<id>tag:nuacht.flounder.online,2022-07-13:/gemlog/2022-07-13-tmux.gmi</id>

<content type="text/plain"># tmux&#xA;&#xA;## Common Commands&#xA;tmux new -s &lt;session-name&gt;&#x9;&#x9;to start a new named session&#xA;Ctrl b, d&#x9;                                 to detach from session&#xA;Ctrl b, w                                  list windows (interactive)&#xA;&#xA;## Full Reference&#xA;```&#xA;Session Control (from the command line)&#xA;tmux&#x9;&#x9;&#x9;&#x9;&#x9;Start a new session&#xA;tmux new -s &lt;session-name&gt;&#x9;&#x9;Start a new session with the name chosen&#xA;tmux ls&#x9;&#x9;&#x9;&#x9;&#x9;List all sessions&#xA;tmux attach -t &lt;target-session&gt;&#x9;&#x9;Re-attach a detached session&#xA;tmux attach -d -t &lt;target-session&gt;&#x9;Re-attach a detached session (and detach it from elsewhere)&#xA;tmux kill-session -t &lt;target-session&gt;   Delete session&#xA;&#xA;Pane Control&#xA;Ctrl b, &#34;&#x9;Split pane horizontally&#xA;Ctrl b, %&#x9;Split pane vertically&#xA;Ctrl b, o&#x9;Next pane&#xA;Ctrl b, ;&#x9;Previous pane&#xA;Ctrl b, q&#x9;Show pane numbers&#xA;Ctrl b, z&#x9;Toggle pane zoom&#xA;Ctrl b, !&#x9;Convert pane into a window&#xA;Ctrl b, x&#x9;Kill current pane&#xA;Ctrl b, Ctrl O&#x9;Swap panes&#xA;Ctrl b, t&#x9;Display clock&#xA;Ctrl b, q&#x9;Transpose two letters (delete and paste)&#xA;Ctrl b, {&#x9;Move to the previous pane&#xA;Ctrl b, }&#x9;Move to the next pane&#xA;Ctrl b, Space&#x9;Toggle between pane layouts&#xA;Ctrl b, ↑&#x9;Resize pane (make taller)&#xA;Ctrl b, ↓&#x9;Resize pane (make smaller)&#xA;Ctrl b, ←&#x9;Resize pane (make wider)&#xA;Ctrl b, →&#x9;Resize pane (make narrower)&#xA;&#xA;Window Control&#xA;Ctrl b, c&#x9;Create new window&#xA;Ctrl b, d&#x9;Detach from session&#xA;Ctrl b, ,&#x9;Rename current window&#xA;Ctrl b, &amp;&#x9;Close current window&#xA;Ctrl b, w&#x9;List windows&#xA;Ctrl b, p&#x9;Previous window&#xA;Ctrl b, n&#x9;Next window&#xA;&#xA;Copy-Mode (vi)&#xA;Ctrl b, [&#x9;Enter copy mode&#xA;Ctrl b, G&#x9;Bottom of history&#xA;Ctrl b, g&#x9;Top of history&#xA;Ctrl b, Enter&#x9;Copy selection&#xA;Ctrl b, p&#x9;Paste selection&#xA;Ctrl b, k&#x9;Cursor Up&#xA;Ctrl b, j&#x9;Cursor Down&#xA;Ctrl b, h&#x9;Cursor Left&#xA;Ctrl b, l&#x9;Cursor Right&#xA;```</content>

<link href="//nuacht.flounder.online/gemlog/2022-07-13-tmux.gmi" rel="alternate"></link>

<summary type="text/plain"></summary>

<title>samba</title>

<updated>2022-07-12T00:00:00Z</updated>

<id>tag:nuacht.flounder.online,2022-07-12:/gemlog/2022-07-12-samba.gmi</id>

<content type="text/plain"># samba&#xA;&#xA;This creates our household share that doesn&#39;t require login. Risky, but in our case all data stored here are unconfidential duplicate midea that we can afford to lose but would like easy shared access to.&#xA;&#xA;```&#xA;apt install samba samba-common-bin&#xA;&#xA;nano /etc/samba/smb.conf&#xA;&#xA;[Share]&#xA;path = /home/pi/share&#xA;browseable = yes&#xA;writable = yes&#xA;read only = no&#xA;force user = nobody&#xA;guest ok = yes&#xA;directory mask = 0777&#xA;create mask = 0777&#xA;```&#xA;&#xA;then&#xA;&#xA;```&#xA;service smbd restart &#xA;(or)&#xA;sudo systemctl restart smbd&#xA;```&#xA;&#xA;Also,&#xA;```&#xA;chmod 777 /home/pi/share&#xA;```&#xA;to allow guests to have write permissions. Check existing permissions with&#xA;```&#xA;stat -c &#39;%a&#39; /home/pi/share&#xA;```&#xA;&#xA;This is wide open to anyone in the network to read and write to. In our case, it just hosts duplicates of family media for quick access on the projector laptop.&#xA;&#xA;For more serious use, create restricted shares, masks and users in the .conf file. &#xA;For more info on create and directory mask see http://www.bodenzord.com/archives/53&#xA;&#xA;# Adding users&#xA;(Almost forgot). &#xA;sudo adduser joe&#xA;sudo smbpasswd -a joe&#xA;&#xA;&#xA;## Update&#xA;The chmod 777 trick was required not only to allow guests, but for some reason even registered users. This is not good security so instead here is a suggestion found online and written by &#xA;=&gt; https://unix.stackexchange.com/users/116972/yaegashi yaegashi&#xA;&#xA;I recommend to create a dedicated user for that share and specify it in force user(see docs).&#xA;&#xA;Create a user (shareuser for example) and set the owner of everything in the share folder to that user:&#xA;&#xA;adduser --system shareuser&#xA;chown -R shareuser /path/to/share&#xA;Then add force user and permission mask settings in smb.conf:&#xA;&#xA;[myshare]&#xA;path = /path/to/share&#xA;writeable = yes&#xA;browseable = yes&#xA;public = yes&#xA;create mask = 0644&#xA;directory mask = 0755&#xA;force user = shareuser&#xA;Note that guest ok is a synonym for public.&#xA;&#xA;//end of update / footnote&#xA;</content>

<link href="//nuacht.flounder.online/gemlog/2022-07-12-samba.gmi" rel="alternate"></link>

<summary type="text/plain"></summary>

<title>sed</title>

<updated>2022-07-11T00:00:00Z</updated>

<id>tag:nuacht.flounder.online,2022-07-11:/gemlog/2022-07-11-sed.gmi</id>

<content type="text/plain"># sed &#xA;&#xA;## Remove control chars&#xA;For some reason, sed wasn&#39;t matching my string variable against another text body which contained the same text. Turns out there were control characters from another encoding type at the end of the string: M-BM-.&#xA;&#xA;cat $var didn&#39;t show them, but cat -A $var did. Solution:&#xA;&#xA;```&#xA;$ sed &#39;s/Ctrl+Shift+ua0 (which looks like)&#xA;$ sed &#39;s/̲/̲u̲a̲0̲ (to be completed as usual)&#xA;$ sed &#39;s/ / /g&#39; mytext.txt&#xA;```&#xA;&#xA;I got this answer from https://askubuntu.com/questions/357248/how-to-remove-special-m-bm-character-with-sed&#xA;&#xA;## Delete from start up to and including match:&#xA;```&#xA;sed &#39;1,/^WHATEVER$/d&#39;&#xA;sed &#34;1,/$my_match/d&#34;&#xA;```&#xA;&#xA;## Delete from match to end, including match:&#xA;```&#xA;sed &#39;/TAGS/,$d&#39;&#xA;```&#xA;&#xA;## Delete range (lines 3 to 5 here)&#xA;sed &#39;3,5d&#39; file.txt&#xA;## Remove duplicate blank lines (but preserve at least one blank line)&#xA;&#39;$!N; /^\(.*\)\n\1$/!P; D&#39; file.txt&#xA;&#xA;## Print selected lines (line 5 only in this case)&#xA;```&#xA;sed -n &#39;5,5p&#39; file.txt&#xA;```&#xA;&#xA;## Get lines before match&#xA;```&#xA;sed -n &#39;/_HEADER_/q;p&#39; index.template&#xA;```&#xA;&#xA;## Get lines after match&#xA;```&#xA;sed -e &#39;1,/_HEADER_/ d&#39; index.template&#xA;```&#xA;&#xA;## Wrap HTML element around something&#xA;```&#xA;sed &#39;s|www\.[^ ]*|&lt;a href=&#34;&amp;&#34;&gt;&amp;&lt;/a&gt;|g&#39; &lt;newtext.txt &gt;newtext.html&#xA;```&#xA;would wrap &lt;a href....&gt;&lt;/a&gt; around urls starting with www, for example.&#xA;&#xA;## Rename files in current dir so that spaces are removed&#xA;```&#xA;for f in *\ *; do mv &#34;$f&#34; &#34;${f// /_}&#34;; done&#xA;```</content>

<link href="//nuacht.flounder.online/gemlog/2022-07-11-sed.gmi" rel="alternate"></link>

<summary type="text/plain"></summary>

<title>nano</title>

<updated>2022-07-07T00:00:00Z</updated>

<id>tag:nuacht.flounder.online,2022-07-07:/gemlog/2022-07-07-nano.gmi</id>

<content type="text/plain"># nano &#xA;&#xA;Open nano and jump to a line number 13:&#xA;```&#xA;nano +13 file.sh&#xA;```&#xA;&#xA;add mouse support, line numbers and $oft word wrap:&#xA;```&#xA;nano -lm$ +13 file.sh&#xA;```&#xA;&#xA;Make permanent in config file&#xA;```&#xA;~/.nanorc&#xA;&#xA;set linenumbers &#xA;set autoindent&#xA;set mouse&#xA;set softwrap&#xA;set titlecolor green,black&#xA;set statuscolor cyan&#xA;set keycolor magenta&#xA;set functioncolor cyan&#xA;set numbercolor cyan&#xA;```</content>

<link href="//nuacht.flounder.online/gemlog/2022-07-07-nano.gmi" rel="alternate"></link>

<summary type="text/plain"></summary>

Proxy Information
Original URL
gemini://nuacht.flounder.online/gemlog/atom.xml
Status Code
Success (20)
Meta
application/atom+xml
Capsule Response Time
830.261447 milliseconds
Gemini-to-HTML Time
3.449848 milliseconds

This content has been proxied by September (ba2dc).