Friday, September 13, 2024

circuit breaker numbers

 How to read the numbers on a miniature circuit breaker (MCB) -
https://www.electricaltechnology.org/2015/08/how-to-read-mcb-nameplate-data-rating.html

First letter in the rating stands for the type of curve.
B curve for sensitive electronics - short circuit rating of 3-5 times the standard rated current
C curve for motors - 5-10 times
D curve for highly inductive / capacitive loads - 10-20 times.

Numerical part indicates safe current. And we should use a load 80% of this rating. Like 16A load --> 20A breaker.

Example:

C60H <-- product number
B25    <-- B curve 25A breaker.

Thursday, September 12, 2024

revisiting dvd backups

Someone had been gifted a box set of 16 DVDs, but they were unable to play them due to region restrictions. They asked me for help. So, revisited DVD Decrypter after more than 15 years. Still works fine on Windows, except that with Win10, while exiting, it gives a few error dialog boxes, 'Failed to set data for '' ' and so on. 

On Linux, DVD Decrypter under Wine is supposed to work with SCSI emulation, but I was unable to get it to recognize the DVD drive - the links in ~/.wine/dosdevices  f:: and f: are being automatically assigned correctly to link to the device /dev/sr0 in my case and the mount point respectively, so probably the need is to go to nt40 mode. But my .wine directory did not have a config file, as mentioned in the howto section at

https://appdb.winehq.org/objectManager.php?sClass=version&iId=2587

and even creating a config file did not solve the issue. Probably someone who knows more about wine can get it to work. There are also other options as mentioned in the old wiki page at

https://help.ubuntu.com/community/RestrictedFormats/RippingDVDs

But my purpose was served by dvdbackup. Handbrake also worked, but I wanted a decrypted copy which I would encode later, so I used dvdbackup instead.

sudo apt install libdvdcss2

sudo apt install handbrake

sudo apt install dvdbackup 

mkdir new12

cd new12

 dvdbackup -i /dev/sr0 -M -v

and in another window, 

 watch du -sh new12

to see the progress as the GBs get added.

The macbook's DVD drive worked fine, as also the Windows desktop's drive. But the Lenovo laptop's DVD drive seemed to be more sensitive to scratches. The macbook's drive was probably the best. Decrypting and writing to hard drive was probably limited by DVD drive's speed, around 4x, taking 20-25 minutes per disc.

Encoding with handbrake directly from DVD on the macbook was going at approx 23 fps for the "Fast 576p" encoding method, while on the newer Samsung Galaxy Book2, handbrake encoding with the decrypted files on hard disk was going at 130 fps for "Fast 576p" and 250 fps for "Very fast 576p" - and so I went for the latter, reasonable quality. With such speeds, each disc would get encoded in under 10 minutes.


 

Tuesday, September 10, 2024

handbrake etc for DVD to hard disk

On Linux, writing a DVD's contents to hard disk (ripping a video DVD) - https://www.howtogeek.com/102886/how-to-decrypt-dvds-with-hardbrake-so-you-can-rip-them/

handbrake with libdvdcss2 installed worked, but takes time.

dvdbackup works

watch -n 10 du -sh nameofdirectory

for use with dvdbackup -M -i /dev/sr0

Apparently dvd decrypter works with Macrovision also

dvd decrypter with wine - https://ubuntuforums.org/showthread.php?t=27369

Note: https://hnsws.blogspot.com/2024/09/dvddecrypter-on-wine-etc-did-not-work.html

Sunday, September 08, 2024

revive corrupt sdcard for raspberry pi

According to the section on reviving corrupt SD cards in this page,

https://thelinuxcode.com/format-sd-card-raspberry-pi/

I tried out F3 to check for corruption.


https://medium.com/@drawn_stories/how-to-find-if-your-thumb-drive-sd-card-is-fake-with-f3-linux-tutorial-f0109bef63ea

sudo apt install f3

(I didn't need to use lsblk since I knew the sdcard was /dev/sdc for me.)

(instead of sudo umount, I used GParted to repartition to a single Fat32 partition first, and then unmounted within GParted.)

sudo f3probe --destructive --time-ops /dev/sdc

reported that everything was fine, finished in around 2 minutes.

Then, disconnected and re-connected to mount the drive, and then

f3write /media/myusername/mymountpoint

showed it would take 50 minutes for this 32 GB drive. Again, no errors.Then, 

f3read /media/myusername/mymountpoint

Also no errors. Took around 20-25 minutes. 

Then, tried cloning the working sdcard image again, into this sdcard which had failed last time

gunzip -c my-root-boot.image.gz | dd of=/dev/sdc conv=noerror status=progress

This took a bit over three hours.

31914983424 bytes (32 GB, 30 GiB) copied, 11300.6 s, 2.8 MB/s

(3.13 hours)

Completed successfully.

 



 


Saturday, September 07, 2024

deleting a Microsoft account linked to an Azure free trial

After a month of the free trial, an email reminded me to upgrade to 'pay as you go' and add a payment method (credit card) to continue to use the free services for a year. I did so. But I did not have much use for the free trial - I had tested it out for downloading from 1and1's cloud platform IONOS which some collaborators had used, and which was timing out using BSNL fiber due to downloading at around 30 Mbps. Similarly, Google Drive shared files also would time out after an hour or so.

I had found that the workaround of using rclone was a better and easier alternative to (a) create a free trial (b) create a VM (c) download on the VM (d) download from the VM to my local machine. 

So, when I got an email from Microsoft saying that all Azure logins would need multi-factor authentication (MFA), I thought I would just delete the Azure free trial subscription and the associated microsoft account.

For this, 

and Microsoft account -
 
Just going to the 'close account' link in the above support page, first tried after 'Cancel'ling the Azure subscription. Apparently, that is not enough. 30 minutes after we 'cancel' the subscription, a 'Delete' subscription button become active - we have to 'Delete' the subscription.
 
It is only after we delete the azure subscription that we can exit the tenant - had to delete tenant and not exit the tenant because this account was the sole user and hence the 'Global Administrator' for this tenant - before it allowed to close microsoft account -
https://learn.microsoft.com/en-us/entra/identity/users/directory-delete-howto
 
After the 'delete microsoft account' page completed, it just dropped me into login.live.com which asks me to log in - no confirmation page that the account has been marked for deletion etc.

If I try to log in with the account marked for deletion, it says that this account is marked for deletion, and logging in will unmark it for deletion, so we need to choose 'Cancel'.  
 
So, in short, the steps were:
1. Cancel the subscription from Azure portal
2. Wait 30+ minutes, then delete the subscription from Azure portal
3. Wait for a few minutes for their servers to update, then delete the tenant from Entra Admin Centre
4. (Wait a few minutes for their servers to update?), then delete the microsoft account from the link on the support page.
 
 

Monday, September 02, 2024

raspberry pi not booting, error writing to SD card when reflashing with dd

One of the Raspberry Pis we use for video play-out in the waiting area was not booting. Simplest test was to use the other Pi's SD card and try booting with that one - worked. So, wanted to image that mini SD card to the one which was not booting. 

https://www.cyberciti.biz/faq/unix-linux-dd-create-make-disk-image-commands/
sudo dd if=/dev/sdc conv=sync,noerror bs=64K | gzip -c > my-root.image.gz
took around 45 minutes -
32 GB SD card with 5.5 GB used with df -h, due to gz it became 7.7 GB

Could monitor through watch -
https://www.baeldung.com/linux/dd-monitor-progress

watch -d ls -alh my-root.image.gz

But when trying to write back to the sdcard which was not booting (file system tests showed no errors after 'repairing'), 

sudo su -
# gunzip -c my-root-boot.image.gz | dd of=/dev/sdc status=progress

But after 10 minutes or so,

dd: writing to '/dev/sdc': Input/output error

https://superuser.com/questions/35349/dd-clone-hard-drive-input-output-error-though-chkdsk-says-ok

Tried conv=noerror -

gunzip -c my-root-boot.image.gz | dd of=/dev/sdc conv=noerror status=progress

Still the same error.

Then tried writing the disk image to another (64 GB) mini-sdcard which happened to be here. That worked without errors, and the R Pi booted up fine. So, maybe there are some physical errors, we might need to reformat (full format) and copy the files back (instead of cloning.)

Wednesday, August 28, 2024

displaying info about whether a package is installed or not on Linux command line

Earlier, I had used apt show for info on whether a package is installed or not. Another way - more concise - is to use apt-cache policy - 

$ apt-cache policy unattended-upgrades
unattended-upgrades:
  Installed: 2.3ubuntu0.3
  Candidate: 2.3ubuntu0.3
  Version table:
 *** 2.3ubuntu0.3 500
        500 http://azure.archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages
        100 /var/lib/dpkg/status
     2.3 500
        500 http://azure.archive.ubuntu.com/ubuntu focal/main amd64 Packages

Sunday, August 25, 2024

show seek bar when paused - Android mp3 player app

There was a requirement for displaying the seek bar during playback and when paused, for mp3 files playing locally from a Nord CE4 Android phone. Trying out various players, it was not VLC, not simple music player, not the built-in media player - Files by Google alone shows seek bar for audio. The additional problem of "audio stopping when screen turned off" also seems to be fixed after installing this.

Friday, August 23, 2024

Azure - Transition from Azure classic administrator roles to RBAC roles

There was an email from Microsoft, asking admins to transition from Azure classic administrator roles to RBAC roles. 

I checked the "classic admin roles" for all our Microsoft tenants - found that those users who had classic admin roles have already been assigned 'Owner' RBAC roles, so probably nothing further needs to be done.

Thursday, August 22, 2024

Microsoft Azure - enable MFA - multi-factor authentication

Microsoft has sent an email asking Azure admins to enable MFA - multi-factor authentication - for all users of the Azure portal (and Entra, and Intune admin panels).

https://learn.microsoft.com/en-us/entra/identity/authentication/concept-mandatory-multifactor-authentication

But in the document above, they don't give a direct link to enable MFA, nor a direct link to enforce MFA. Probably because there are multiple ways to do it.

After a lot of searches, found the following. First we have to add sign-in methods for the MFA, then we can enable MFA.

Going to portal.azure.com
Home > Users > (my username) > Manage > Authentication methods
came to

https://mysignins.microsoft.com/security-info
 

Here, we can choose "Add sign in method" to add SMS, phone call, Microsoft Authenticator app or "Other authenticator app" like Google Authenticator which uses TOTP (time-based one-time password).

Then to enable or enforce 2FA (two-factor authentication) for admin users, we can go to portal.azure.com
(Just a note: Azure Entra ID is the new name for Azure Active Directory for translating from old tutorials.)

Users > Per user MFA (button on top of the page) > (which redirects to the page https://account.activedirectory.windowsazure.com/usermanagement/multifactorverification.aspx?tenantId=theRelevantTenantID for "legacy experience")

choose the relevant username, and then choose the "Enable" link on the right-hand pane. Confirm that you want to enable MFA for that user, then you are done.

If not "legacy experience", then the per user MFA page has a different look - with buttons to enable, disable or enforce MFA for the selected users, and also User MFA settings:


 

Monday, August 19, 2024

raspberry pi LibreElec Kodi playout issues and solution

Doing playout using Kodi and LibreElec, we had issues of disk corruption when using a FAT32 USB flash drive for the content - the first time we play a playlist there would be no issues, but when we go back to the beginning of the playlist using the page-down key, or using x to stop playback and open the playlist again, there would be random jumps during subsequent playout. 

Tried various workarounds like using a different USB flash drive, shutting down and restarting the Pi between shows (takes 5 minutes), "safely remove" the drive and re-plug it in between shows.

For a more durable solution, tried
(a) adding a powered USB hub for the Lexicon Alpha sound device
(b) using a USB drive formatted with NTFS instead of FAT32

With this configuration, the Pi seems to recognize the Lexicon Alpha without having to plug it in after the Pi boots up as noted in the previous post, and the playlist playout also doesn't skip. So, perhaps both these points helped.

Sunday, August 18, 2024

finding old files and disk space used - with Linux command line

 Following 

https://askubuntu.com/questions/413529/delete-files-older-than-one-year-on-linux

 and 

https://stackoverflow.com/questions/17419337/calculate-total-used-disk-space-by-files-older-than-180-days-using-find

 sudo su -

cd /the/relevant/directory

 find . -type f  -printf '%s\n' | wc -l  # for just the total number of files

find . -type f -mtime +365 -printf '%s\n' | wc -l  # for the number of files older than a year

find . -type f -mtime +365 -printf '%s\n' | awk '{total=total+$1}END{print total/(1024*1024*1024)}' # total disk space used by files older than 365 days, in GB

Saturday, August 17, 2024

using Wiz remote for fade in and out of lights

Using a Wiz remote and Wiz LED lamps and LED strips in the cove for fade-in, fade-out at our Theatre - only the setup required the mobile app - thereafter, it works with bluetooth, so doesn't need an internet connection. The app also allows us to add another user as an owner by just scanning a QR code from the app.

Tuesday, August 13, 2024

LIC 'Life certificate' via App

Senior citizens having LIC pension plans need to submit 'Life certificates' every year or so. According to the email they send, this can be done by submitting a form in the attached format duly filled, signed and witnessed, either by email or to a branch office or customer service cell, or via their 'LIC Digital' app.

Earlier, (maybe one year ago?) LIC had a separate app called "Jeevan Sakshya" - now the 'LIC Digital' app has the 'jeevan sakshya' feature at the bottom of the home screen.

Three verification methods are available in the app - Digilocker, offline Aadhaar and Central KYC. Offline Aadhaar xml does not seem to be available any more from the link given in the app. Digilocker method worked well for parents. (no need to install anything - just "give permission for digilocker to get your Aadhaar/PAN details" with Aadhaar OTP, then take a selfie.

Edit March 2025 - The app showed 'No data' though an SMS arrived asking for life certificate. Called up and asked the LIC Customer Zone - they said, yes, certificate is due. So I thought it might be due to Android removing data from unused app, so uninstalled it and reinstalled it. Then, 

  • Jeevan Sakshya at the bottom of the home screen
  • Register - with their registered mobile number 93*******
  • Then the policies for which life certificates were due were listed, and proceeded with Digilocker as above.

Friday, August 09, 2024

Force 5G on Any Android Device, find cell towers 5G strength etc

How to Force 5G on Any Android Device | 5G only Samsung -  https://youtu.be/Ea7XwM8W2_M

Net Monitor app, https://play.google.com/store/apps/details?id=com.parizene.netmonitor

(shows towers near you, shows 5G strength etc)

From home screen > service menu > Phone info > 
(Select Phone index 0 for SIM1 etc)

Scroll down to set preferred network type, and choose NR only (Network Radio).

(Airtel doesn't seem to work with NR only mode, even at office where 5G strength is high. Jio seems to work.)

Tuesday, July 30, 2024

headless raspberry pi - changing VNC desktop resolution

In order to set up a headless raspberry pi with VNC, we can first follow this - https://raspberrytips.com/raspberry-pi-headless-setup/

I used the Raspberry Pi Imager method - under Advanced Options in Pi Imager.

Then, as suggested in this video for an older version, I could connect to the VNC desktop on the Pi and change the resolution using

Start -> Preferences -> Screen configuration

Then Layout Menu -> Screens -> NOOP1 -> Resolution -> 1920x1080

Monday, July 29, 2024

Raspberry Pi 4 - setting static IP and checking CPU temp

How to Set a Static IP Address on Raspberry Pi
https://www.tomshardware.com/how-to/static-ip-raspberry-pi
(did it via vnc, had to install realvnc client as tightvnc client did not support)

How to check CPU temperature on Raspberry Pi - Linux Tutorials - Learn Linux Configuration
https://linuxconfig.org/how-to-check-cpu-temperature-on-raspberry-pi

ffmpeg 25 fps to 24 fps

Due to this issue with OCVWarp and frame sequences, needed to change the fps for a video from 25 fps to 24 fps.

We can do it with re-encoding using Avisynth, under 

Video -> Filters -> Transform -> Change FPS

 - useful if we want to change the codec -

or without re-encoding with ffmpeg with a command similar to the one in my earlier post,

ffmpeg -itsscale 0.834167501 -i input-25fps.mp4 -vcodec copy output-24fps.mp4

Sunday, July 28, 2024

mp3 encoding for dot net application

We got a request to install NAudio and NAudio.Lame on the production server of one of our dot net apps. But the prod server runs Linux, and NAudio uses DirectSound, hence is Windows-only. The developers were informed, and they decided to use ffmpeg instead. We used /etc/environment to add the env variable FFMPEG_PATH they wanted to create, using whereis to find the location of the executable.

Notes:

https://www.nuget.org/packages/NAudio/
dotnet add package NAudio --version 2.2.1
run inside project folder, or else error
Could not find any project in `/home/ubuntu/`.

as the relevant user in the directory also, same error.

https://stackoverflow.com/questions/56062228/error-dotnet-could-not-find-any-project-in-c-when-running-dotnet-add

But dotnet add package--help indicates that this would just add a reference to the nuget package to the project.

So, anyway nuget would need to be installed.

sudo apt install nuget
and then ...
Oh!
https://github.com/naudio/NAudio/issues/1077
NAudio does not have linux support due to directsound dependency.

Thursday, July 25, 2024

rclone and RCloneBrowser for uploading 30 GB files to Google Drive

As noted earlier, rclone is the preferred solution to transfer large files to and from Google Drive.

A point to note is that mounting and then copying seems to result in errors for Google Drive if transfer times are greater than an hour or two, so we should preferably use just rclone copy or copyto.

In the case of a Windows machine, here were my steps:

choco install rclone
rclone config

(to create the gdrive remote)
(choose everything as the defaults.)
rclone lsd gdrivemydrivename:
(to list directories)
rclone copy myfilename.mp4 gdrivemydrivename:mydirname --progress

Unfortunately, RCloneBrowser doesn't show bandwidth or time to completion with the latest rclone. So, the commandline, or browser UI might be better.