Thursday, March 31, 2022

mac auto login and lock

auto lock mac after auto login 

cat autolock.sh 

#!/bin/bash

/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend

exit 0


For BigSur and monterey, CGSession is not available any more.

#!/bin/zsh

osascript -e 'tell app "System Events" to key code 12 using {control down, command down}'

https://apple.stackexchange.com/questions/406616/replacement-for-cgsession-suspend 



Tuesday, March 22, 2022

Use MKVToolNix to edit audio track

 My son loves watching Naruto Shippuden. However, Netflix only has the first 10 seasons, while Hulu only accepts US IP (and payment). The resouce on the website are mostly Japanese audio or Chinese audio (with Chinese subtitle). The target is to get the English audio (with or without English subtitle).

1. Download and MKVToolNix install https://mkvtoolnix.download/downloads.html#macosx

2. Download Naruto Shippuden mp4 (with English audio) from

https://animedao.to/anime/naruto-shippuden-dubbed/

3. Extract mka audio file from the mp4 (using MKVToolNix)

4. Add the English Audio into the Japanese MKV (see the screenshot)

MKVToolNix conversion is pretty fast, however, it's hard to batch download Naruto Shippuden mp4 as it has some protection. The online play is annoying as it has inappropriate ads, also the video quality is not as good as the MKV (89M vs 200M)



Sunday, March 6, 2022

Windows 11 time issue

 I installed Windows 11 VM from Parallel Desktop, everything is OK but sometimes the time is not accurate, and it causes the scheduled tasks can't run at the specified time. My Mac is on Toronto timezone while the VM has to be on Beijing Timezone.

Parallel Desktop technically support suggests to disable time sync from PD (Time: Do not sync), but I still see the issue.

The workaround:

Update HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Config

MinPollInterval and MinPollInterval.

I updated both to 8, (2 power of 8 = 256 seconds), and run "w32tm /config /update" to update.

(Windows Time service needs to auto start)

Now I can see the time is sync at 12:14:07,12:18:23,12:22:39...

NtpClient SpecialPollInterval setting doesn't work for me, maybe need some other flag settings to make it work.

https://docs.microsoft.com/en-us/troubleshoot/windows-server/identity/specialpollinterval-polling-interval-time-service-not-correct

https://docs.microsoft.com/en-us/troubleshoot/windows-server/identity/w32time-sync-specialpollinterval-ignored