Monday, August 29, 2022


I never knew….
If you cannot continue in Chrome because of an ERR_CERT_INVALID error, even after pressing Advanced: there’s a secret passphrase built into the error page. Just make sure the page is selected (click anywhere on the background), and type `thisisunsafe`

Sunday, July 24, 2022

ffmpeg reminder

Personal reminder:

Download latest:
Run ffmpeg -i MyMovie.mkv and look for stream info, e.g.:

Stream #0:0: Video: h264 (High), yuv420p(tv, bt709/unknown/unknown, progressive), 1920x800, SAR 1:1 DAR 12:5, 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
Stream #0:1(dut): Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s
      title           : Dutch
Stream #0:2(dut): Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s
      title           : Flemish
Stream #0:3(eng): Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s
      title           : English
Stream #0:4(dut): Subtitle: subrip (default) (forced)
Stream #0:5(dut): Subtitle: subrip
Stream #0:6(eng): Subtitle: subrip

Say, I would like to have the video with the Flemish audio and all the subtitles (since they don’t take that much space)

ffmpeg -i MyMovie_2160p.mkv -vf scale=640:-2 -ac 2 -af "pan=stereo|FL=FC+0.30*FL+0.30*BL|FR=FC+0.30*FR+0.30*BR" -map 0:v:0 -map 0:a:1 -map 0:s MyMovie_640p_2ch.mkv
-vf scale=640:-2	= video filter: 640p, -2 means keep aspect ratio for vertical pixels
-ac 2			= (convert to) 2 audio channels
-af "pan=......		= audio filter: copy multichannel audio without losing center channel (dialogs)
-map 0:v:0		= copy first (0) video stream
-map 0:a:1		= copy second (1) audio stream (Start from 0. So 0 would be Dutch, 1 Flemish, 2 English)
-map 0:s		= copy all subtitles 
but if you have non-convertible subtitles (bitmapped), then first map the desired sub and copy, e.g.: -map 0:s:3 -c:s copy

Monday, July 11, 2022

ser2net p1 adapter yaml config

Because i didn’t make a backup. For next time’s reference:

connection: &p1usb
  accepter: tcp,10001
  enable: on
  connector: serialdev,/dev/ttyUSB0,local,115200n81

Older ser2net, shipped with debian buster with ‘just’ a .conf file is easy:

10001:telnet:600:/dev/ttyUSB0:115200 8DATABITS NONE 1STOPBIT banner

Thursday, July 7, 2022

pfSense Multi VLAN DNS (host) overrides

pfSense’s DNS resolver has the ability to do host overrides from the gui, but these are global overrides.
Unbound (the underlaying DNS resolver) has the ability to create DNS views to do different things based on source addresses.
It is located under Services - DNS Resolver - General - Custom options. It is a free format field.


access-control-view: vlan15activedirectory
access-control-view: vlan16guest

name: "vlan15activedirectory"
local-zone: "" static
# adding the host as a zone results in NXDomain lookup

name: "vlan16guest"
local-data: " 90 IN A"
# adding a specific host and map it to a specific ip

More info: … ring/tags-views.html

Friday, March 18, 2022

Run powershell specific function from task scheduler

Executable is powershell.exe. Arguments:

-command "& { . "c:\location\to\script.ps1"; my_function_name }"

Powershell speed hacks

Powershell can be painfully slow when dealing with larger arrays, reading files and listing large directories. Here are some workarounds.


$myarray = @()
foreach ($x in $y) {
  $myarray += $x

Much faster is working with an arraylist:

$myarray = [System.Collections.ArrayList]@()
foreach ($x in $y) {
  $null = $procarray.Add($x)

Reading files

get-content $filename



Listing large directories

$items = get-item "\\server\share\*.csv" | sort LastWriteTime

The fastest workaround i’ve been able to find is actually using a dos prompt. Use dir switches for sorting purposes.
Note: dir returns just text, while get-items returns objects with all sorts of properties. It depends on your use case whether this hack is actually usable or not.

$items = cmd /r dir "\\server\share\*.csv" /OD /B