Wednesday, June 26, 2024

additional spam protection for forms using Cloudflare turnstile

One of our forms, which had first level protection using a hidden field, occasionally got bursts of spam submissions. Added Cloudflare turnstile as an additional layer of protection.

In the <head> section of the web page which had the form, 

<script src="https://challenges.cloudflare.com/turnstile/v0/api.js" defer></script>

Inside the form,

<div class="cf-turnstile" data-sitekey="0x4OUR-SITE-KEY0-"></div> 

and in the done function, handling the "failed captcha" situation - 

 $.ajax({
                        method: "POST",
                        url: url,
                        data: user
                    }).done(function (msg) {

                        // When the request is successful
                        if(msg=="Success") {
                        $('span').html('<strong>Thank you for submitting your details. We will get back to you shortly, in a week or so.</strong>');
                        $("form").trigger("reset");
                        }
                        if(msg=="Failed captcha.") {
                            $('span').html('<strong>Please resubmit after the captcha loads, checking the box to confirm you are human if necessary.</strong>');
                        }
                    }).fail(function (err, textstatus, error) {
                        $('span').text(textstatus);
                    });

              

Then, we need to add some back-end code. Since we're using Google Apps Scripts, this looked like:

function doPost(e) {

var scriptProperties = PropertiesService.getScriptProperties();
var myKey = scriptProperties.getProperty('SECRET_KEY');
.....
const siteresponse = e.parameter['cf-turnstile-response'];
.....
var verifyurl = 'https://challenges.cloudflare.com/turnstile/v0/siteverify';
var formData = {
'secret': myKey,
'response': siteresponse
};
var options = {
'method' : 'post',
'payload' : formData
};

var responsetositeverify = UrlFetchApp.fetch(verifyurl, options);
var verifydata = JSON.parse(responsetositeverify.getContentText());


if (!verifydata.success) {
// do the rest of the processing only if verification returns success.
return ContentService.createTextOutput().append('Failed captcha.');
}
 
 

 


Monday, June 17, 2024

problem and workaround for Youtube api calls from Google Apps script

When trying to implement the earlier solution to one of our channels, the script would fail, complaining that the user was not authorized for live streams. Interestingly, when using google api explorer, it asks whether to use the google account or the youtube brand name. If we choose the latter, it works.

The issue and its solution are discussed at  

Accordingly, started work on a script of our own, based on this blog post, but paused development since manual creation of broadcasts was preferred due to the complicated setup which depends on GDrive service which would fail at least once a month as my previous experience with Drive service shows.

The one take-away from this exercise seemed to be that the 'consent screen' needs to be set to 'Production' for this workaround to work, otherwise the Oauth doesn't proceed.

Sunday, June 16, 2024

Missing Site UUID or Hub Secret error in Moodle

One of our Moodle sites was presenting users with this error, "Missing Site UUID or Hub Secret. Please check your Hub registration".

Apparently the fix is to change a setting, as mentioned at
https://h5p.org/node/1472461

"uncheck the option "Use H5P-hub. mod_hvp | hub_is_enabled" in the H5P settings in Moodle (.../admin/settings.php?section=modsettinghvp"

But that setting says, "It's strongly encouraged to keep this option enabled. The H5P Hub provides an easy interface for getting new content types and keeping existing content types up to date. In the future, it will also make it easier to share and reuse content. If this option is disabled you'll have to install and update content types through file upload forms."

There is also an option to "Register an account with H5P hub" just below that.

I have now tried entering some data into the "register an account" part, for one of our Moodle sites.

Hopefully this resolves the issue.

Sunday, June 02, 2024

closed Airtable and SendinBlue (now Brevo) accounts

Since I'm no longer using their services, closed Airtable and Brevo (formerly Sendinblue) accounts. For Airtable, I copy-pasted a table I had made into a Google Sheet, deleted collaborators from it, and then deleted my account. 

Saturday, June 01, 2024

VP9 codec for 4K video on Raspberry Pi4 - stutters

Tested a video encoded with VP9 - very good quality 4K video - only 2.5 GB file size for a 24 minute 4K video - but playback on Kodi running on Raspberry Pi 4 stutters for high complexity scenes. x265 is the way to go, for now. 

Tuesday, May 28, 2024

Zoom in from Milky Way to Puttaparthi

The scripts and settings used to generate this 4k fisheye fulldome video are shared at https://github.com/hn-88/openspace-scripts 


The following script was used,
https://github.com/hn-88/openspace-scripts/blob/main/user/recordings/zoom-out-psn-to-galaxy4.osrectxt

where the motion is actually backwards, zooming out, in order to give a more controlled zoom travel. 

ffmpeg and blender were used to render the screenshot image sequences into video, forward and backwards. Blender could be used to fine-tune the video by speeding up parts of the video without much action and so on. 

ffmpeg to reverse a frame sequence - https://stackoverflow.com/questions/40475480/ffmpeg-convert-image-sequence-to-video-with-reversed-order

The zoom-in (reversed frames) have been uploaded and made available at archive.org using the x265-lossless codec under a Public Domain licence.

https://archive.org/details/zoom-in-to-psn-lossless

react app in docker vs native

Relative performance etc - via
which is hosted on vercel, https://gitachapsummwtel.vercel.app/

Hosting next.js on our own server -

Performance of docker -

Apparently nearly as good as native.

Monday, May 27, 2024

ffmpeg lossless for archive.org and reverse order of frames

Archive.org did not accept zip files containing frames for uploading 4K content, but lossless codecs were accepted.

ffmpeg - Best Lossless Video Codec for 8 bpc RGB image sequences? - Super User

seems to indicate that the best seems to be x265,

and commandline
 
ffmpeg -i input.mp4 -c:v libx265 -x265-params lossless=1 output.mp4 

And for reversing the frame order (backwards video),

 
- first bulk rename to - (minus) for the numbers prefix.

Saturday, May 25, 2024

github importer, for making a copy of a repository from the web interface

For testing a reported opencv bug

 
I wanted to make a copy of one of my repositories. Instead of cloning to a local directory etc, I wanted to do it from github's web interface. The solution seemed to be to use github importer. 
 
At the upper-right corner of any page, click the plus sign, and then click Import repository
 

making google great again

A follow-up to my post about the beginning of the end of Google -

https://askleo.com/why-ive-stopped-using-google-search/

and a temporary band-aid fix to get better search results from google,

https://tedium.co/2024/05/17/google-web-search-make-default/

- just add &udm=14 to the end of the search query url. 

Tuesday, May 21, 2024

Fly through Mars valley and Grand Canyon - generated with OpenSpace

The scripts and settings used to generate these 4k fisheye fulldome videos are shared at https://github.com/hn-88/openspace-scripts


 

https://github.com/hn-88/openspace-scripts/blob/main/user/recordings/setupgrandcanyon.osrectxt

https://github.com/hn-88/openspace-scripts/blob/main/user/recordings/grandcanyonflyin5.osrectxt

(default profile, Window options fisheye 4k as at
https://github.com/hn-88/openspace-scripts/blob/main/config/single_fisheye-4k.json )

Link to 4096x4096 video at archive.org -  https://archive.org/details/grand-canyon5

Flying 5 km (3 miles) above a valley on Mars, near Valles Marineris


https://github.com/hn-88/openspace-scripts/blob/main/user/recordings/marsvalley2setup2.osrectxt

https://github.com/hn-88/openspace-scripts/blob/main/user/recordings/marsvalley2upfrombeginning3.osrectxt

(this recording is played in reverse at the beginning of the video.)

https://github.com/hn-88/openspace-scripts/blob/main/user/recordings/marsvalley2.osrectxt

Link to 4096x4096 video at archive.org - https://archive.org/details/mars-fly-into-valley0001-6940

The 4k frames are available with me, and can be made available. I'll also see if I can upload them to archive.org - Edit - apparently zip files with jpg frames can't be uploaded to archive.org, so I have added links to the 4K movie files uploaded to archive.org above.

Monday, May 20, 2024

Microsoft's answer to brute force mitigation - $$$

 How to avoid successful SSH Brute Force Attack - Microsoft Q&A

mentions Just-in-time access usage. But that

https://learn.microsoft.com/en-us/azure/defender-for-cloud/just-in-time-access-usage

requires Defender for Cloud Plan 2

https://learn.microsoft.com/en-us/azure/defender-for-cloud/plan-defender-for-servers-select-plan#plan-features

which costs nearly $15 per month per server!

https://azure.microsoft.com/en-us/pricing/details/defender-for-cloud/

Indian income tax e-filing - validation failed

When filling up the ITR2 income tax return, one of the "validation failed" messages said:

In Schedule CG, Sl. No. B4a LTCG u/s 112A is not equal to total of Col. 14 of Schedule 112A

This is probably because of rounding errors, I think. The numbers in the quarter-wise table in Schedule CG (Capital Gains) must add up to the numbers in Schedule 112A. So we should manually add and check, and make small one rupee adjustments to make the quarterly numbers add up to the total in Schedule 112A.

Another couple of points to note when there are "brought-forward losses" -
(1) in that case, the maximum amount of the BFL has to be applied - we can't apply a lower amount of the total losses to cover only part of the profits of this financial year
(2) and the numbers in the quarterly numbers should then add up to zero (if the losses completely cover the profits.)

Monday, May 13, 2024

making a copy of a wordpress blog and setting it up on another domain

What I should have done:

Probably I should have used wp-cli to deactivate all plugins before the migration. And apparently, the whole thing could have been done far easily with wp-cli - https://rocketgeek.com/basics/using-wp-cli-to-migrate-copy-your-site/
https://guides.wp-bullet.com/migrate-wordpress-site-new-server-wp-cli/

Steps taken:

0. Ran all commands inside screen.

1. https://wordpress.stackexchange.com/questions/75135/how-to-export-import-wordpress-mysql-database-properly-via-command-line
says a normal mysqldump should suffice.

2. Mysqldump complained about permissions -
Error: 'Access denied; you need (at least one of) the PROCESS privilege(s) for this operation' when trying to dump tablespacesldump: Error: 'Access denied; you need (at least one of) the PROCESS privilege(s) for this operation' when trying to dump tablespaces

So, https://dba.stackexchange.com/questions/271981/access-denied-you-need-at-least-one-of-the-process-privileges-for-this-ope

SHOW GRANTS for someuser@localhost;.

To add the global privilege use the SQL command
GRANT PROCESS ON *.* TO someuser@localhost;

That solved the issue. In our case, I was running the SQL commands from the SQL console of dbeaver.

3. Created a new db as root, granted permissions for the relevant user as per https://www.digitalocean.com/community/tutorials/how-to-create-a-new-user-and-grant-permissions-in-mysql

4. mysql -u theuser -p thenewdb < wpdevelbackup.sql to populate the new db.

5. Copied over the directory with cp -a to retain permissions as well as do a recursive copy - https://unix.stackexchange.com/questions/44967/difference-between-cp-r-and-cp-a
sudo cp -a olddirectory newdirectory

6. After that, need to update the wp_options table in the new database. option_value like '%public_html%' showed all the required changes to be made after siteurl -
siteurl
home
astra_sites_recent_import_log_file
recently_edited
astra_sites_recent_import_log_file
fs_active_plugins
duplicator_package_active
uagb_downloaded_font_files
_transient_dirsize_cache

(Had to copy paste to text editor and find and replace for the multiple instances of the old path in some of these fields.

the _transient field was very big. Since anyway it would be recreated, deleted its value instead of changing the path to the new path for that value.)

7. Have to edit wp-config file also, since the site was redirecting back to the old url. https://www.sitepoint.com/how-to-migrate-a-wordpress-site-to-a-new-domain-and-hosting/
Had to add the
define('WP_HOME','https://oursite.com');
define('WP_SITEURL','https://oursite.com');

at the end of wp-config file also, since I had not de-activated the plugins before doing the migration. Or maybe just a caching problem with firefox which I used for testing. Site was working at this point, when tested with another browser. (I had done the editing of /etc/apache2/sites-available etc beforehand.)

Wednesday, May 08, 2024

Schedule Page date listing much in advance

 PB wanted to verify that the schedule created for a few days in advance loads OK on the schedule page. But only a few days were visible. This was because

the code checks if the schedule data txt file is available, and then updates the dropdown, but only up to 5 days in advance -


while (dtimems < dateplus5ms) {
addifscheduledataavailable(dtimems);
dtimems += 24 * 60 * 60 * 1000;
}

It may be possible to see the schedule of other dates by changing your system date to the future.

And indeed, PB confirmed that he could check the published playlists for future dates by changing the system date.

Monday, May 06, 2024

run simple python code online

There is google's colab for executing python workbooks online, in the browser. But for simple code, trinket.io - "no need to log in, download plugins, or install software. "
via
https://www.youtube.com/watch?v=v7svyPnIeGA
via
https://www.wired.com/story/why-the-solar-system-is-flat/

Thursday, May 02, 2024

interesting problem with S3 buckets - anyone can do a $ DDoS now

Copy-pasting from Slashdot - 

How an Empty S3 Bucket Can Make Your AWS Bill Explode (medium.com) 55

Posted by msmash on Tuesday April 30, 2024 @03:10PM from the oops dept.
Maciej Pocwierz, a senior software engineer Semantive, writing on Medium: A few weeks ago, I began working on the PoC of a document indexing system for my client. I created a single S3 bucket in the eu-west-1 region and uploaded some files there for testing. Two days later, I checked my AWS billing page, primarily to make sure that what I was doing was well within the free-tier limits. Apparently, it wasn't. My bill was over $1,300, with the billing console showing nearly 100,000,000 S3 PUT requests executed within just one day! By default, AWS doesn't log requests executed against your S3 buckets. However, such logs can be enabled using AWS CloudTrail or S3 Server Access Logging. After enabling CloudTrail logs, I immediately observed thousands of write requests originating from multiple accounts or entirely outside of AWS.

Was it some kind of DDoS-like attack against my account? Against AWS? As it turns out, one of the popular open-source tools had a default configuration to store their backups in S3. And, as a placeholder for a bucket name, they used... the same name that I used for my bucket. This meant that every deployment of this tool with default configuration values attempted to store its backups in my S3 bucket! So, a horde of misconfigured systems is attempting to store their data in my private S3 bucket. But why should I be the one paying for this mistake? Here's why: S3 charges you for unauthorized incoming requests. This was confirmed in my exchange with AWS support. As they wrote: "Yes, S3 charges for unauthorized requests (4xx) as well[1]. That's expected behavior." So, if I were to open my terminal now and type: aws s3 cp ./file.txt s3://your-bucket-name/random_key. I would receive an AccessDenied error, but you would be the one to pay for that request. And I don't even need an AWS account to do so.

Wednesday, May 01, 2024

OCVWarp on Google Cloud Shell

Checked and found that OCVWarp works (though slowly - 5 fps for XVID encoded 1080p output) even on Google Cloud Shell, after installing the dependencies.

wget https://github.com/hn-88/OCVWarp/archive/refs/tags/v4.01.zip
unzip v*.zip
cd OCVWarp*/build
wget https://github.com/hn-88/OCVWarp/releases/download/v4.01/OCVWarp-4.01-x86_64.AppImage
chmod +x OCV*mage
mv OCV*mage ocvwarp
sudo apt install libopencv-dev


(after uploading the input file)


./ocvwarp OCVWarp.ini 30fps.mp4 output.mp4

Friday, April 26, 2024

Moodle upgrade path - 4.1 to 4.5

An evaluation of requirements and timelines for upgrading Moodle 4.1 to 4.3 or 4.5.

Moodle 4.1 -> 4.3

Min PHP 7.4 -> 8
PHP extension sodium is required
(seems to be built in to 8
)
PHP setting max_input_vars must be >= 5000.
PHP variants: Only 64-bit versions of PHP are supported.

MySQL 8.0 (increased since Moodle 4.1)

Moodle 4.4 release date is 22 April 2024
so probably should upgrade to that - OR -

Next LTS is 4.5. 7 October 2024.

Moodle 4.1 -> 4.4

Min PHP 8.1

Ubuntu 22.04
PHP 8.1.2
Mysql 8.0.28

PHP 8.3

How to upgrade from Ubuntu 20.04 to 24.04 - Probably will need to do it as a two step process -
https://linuxconfig.org/ubuntu-upgrade-to-24-04-noble-numbat-a-step-by-step-howto-guide
 
20.04 is supported till Apr 2025. So in Oct 2024, we should be able to upgrade the OS and Moodle together. 







Friday, April 19, 2024

Filezilla TLS errors

When using Filezilla on Linux Mint at work, connecting to an FTP server, after logging in, I get some errors like the following:


Command: LIST
Response: 150 Opening BINARY mode data connection.
Error: GnuTLS error -110: The TLS connection was non-properly terminated.

Some file transfers go through, while some get 550 errors - when I close Filezilla and open it again, the transfer succeeds.
 
Later, when using Windows and downloading using a domestic BSNL fiber line, there were no errors.
 
According to this set of posts on serverfault, it may have been due to either the firewall gateway blocking passive mode FTP or it may have been something to do with implicit/explicit TLS.

Wednesday, April 17, 2024

methods to download from Amazon S3 bucket (if we own/manage the bucket)

Some ways are mentioned at 

 
Cyberduck can provide a UI for Windows or Mac - "Cyberduck is a libre server and cloud storage browser for Mac and Windows with support for FTP, SFTP, WebDAV, Amazon S3, OpenStack Swift, Backblaze B2, Microsoft Azure & OneDrive, Google Drive and Dropbox."

Saturday, April 13, 2024

workflow_dispatch only from default branch

I like to set Github Actions to only run when manually triggered, that is, using workflow_dispatch

As that page says,  "To trigger the workflow_dispatch event, your workflow must be in the default branch."

But we can change the default branch - like we may want to do for forks etc - Repository --> Settings --> Default branch (choose by clicking the "choose another branch" button which has two opposing arrows as an icon)

comparing the contents of two directories on Windows

 How to Compare Two Folders on Windows 11 and 10 (howtogeek.com)

robocopy "C:\first" "C:\second" /L /NJH /NJS /NP /NS

Thursday, April 11, 2024

reminder to take a break - using cron

Wanted to create a pop-up message or reminder (and was later requested an audio reminder) for N to take periodic breaks from the computer. Since his usage was mostly passive, workrave did not work for this purpose - workrave's timer only progresses when the keyboard or mouse are active.

 Looking for solutions, reminder apps on Mint/Ubuntu seemed to have only flatpak versions which I did not want to install.

Finally thought it would be simpler to use cron.

But, to pop up messages on the screen with cron, we need some special handling.
https://unix.stackexchange.com/questions/307772/pop-up-a-message-on-the-gui-from-cron
https://unix.stackexchange.com/questions/111188/using-notify-send-with-cron

And for audio, we would need another line to be added to the script. Working script - 

#!/bin/bash
export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
export DISPLAY=:0
export XDG_RUNTIME_DIR=/run/user/1000
# this last line above is for sound to work
notify-send -u critical "this is the reminder to take a walk"
# the -u critical is supposed to show over full screen apps, but doesn't always work
/usr/bin/mpg123 /home/username/Downloads/Walk.mp3 > /dev/null 2>&1

For help with setting up cron, cron.help is useful. Eg.

*/30 * * * * /home/username/walkremind.sh

for every half an hour.

For getting the environment variables' values, used

printenv

And for installing notify-send

sudo apt install libnotify-bin






using a laptop as a secondary monitor using Miracast

Apparently Windows now has built-in support for Miracast, so we can use a Windows laptop as a secondary display for a Windows desktop, for example.

https://www.tomshardware.com/how-to/use-laptop-as-monitor-for-another-pc
that is if both run Windows.

Miracast client for Linux - miraclecast - to use as sink,
https://askubuntu.com/questions/1254998/how-do-i-launch-miraclecast-after-installation

https://alternativeto.net/software/miraclecast/
https://letsview.com/screen-mirroring
(but not on linux)

https://github.com/albfan/miraclecast

 

Wednesday, April 10, 2024

RAM usage - Edge and Firefox browsers on Linux Mint

I've installed 'Graphical Hardware monitor' to show RAM, Disk read and Disk write on the panel of the old Macbook Pro running Linux, which has only 4 GB of RAM including VRAM. Curious to see RAM usage, tried opening Gmail + GDrive + a spreadsheet on Firefox and Edge browsers separately. With Firefox, total RAM used was 1.92 GB. With Edge, it was 1.63 GB. So, Firefox was using around 300 MB more than Edge in this (not too rigourous) test.

image sequence support for OCVWarp

Prompted by this feature-request for command-line support, OCVWarp version 4.00 now has basic support for image sequences, too. The documentation in the wiki has been updated with caveats. And here is a link to all posts about OCVWarp.

PS. And in December, a test build with MacOS X succeeded on github actions using homebrew to install OpenCV.

Sunday, April 07, 2024

using blender online

As noted at https://digitalarthub.net/3d/how-to-use-blender-online-without-downloading/

"Do note that most of these apps run outdated versions of Blender and they’re pretty laggy",

Since Blender doesn't run any more on the old Macbook running Linux - https://www.blender.org/download/requirements/ - I can use the online versions for quick screenshots and so on.

 

Friday, April 05, 2024

Windows defender finding a Trojan in build from Github actions - false positive

Artifacts from some builds of OCVWarp were being flagged by Windows Defender as having a trojan, Wacatac. As mentioned in this page, https://github.com/RPCS3/rpcs3/issues/15309 this is probably a false alarm, as some other builds with minimal changes were not flagged. So, tried Add an exclusion to Windows Security - Microsoft Support - that worked well. 

Start --> Settings --> Privacy & security --> Virus & threat protection -->  Manage settings --> Exclusions --> Add or remove exclusions.

shifting a blogger blog to Google Analytics 4

There was an email from Google, "All Universal Analytics services cease to function starting July 1, 2024"

Googling "use analytics with blogger", found this support article - and found that this blog was not automatically transferred from the earlier Universal Analytics to Google Analytics 4. Copy-pasted the "Measurement ID" as mentioned in that support article, finding the "Measurement ID" via this article. Now let's wait for a couple of days and see if it works.

Thursday, April 04, 2024

CPU-based stable diffusion

In my previous post about Stable Diffusion and how I could not generate 4k fulldome images with it, I had mentioned running out of RAM as the reason it failed. I thought perhaps if there is a way to run it on CPU instead of GPU, I could use a more recent faster machine - and perhaps use virtual memory and run for a longer time - to generate 4096 x 4096 fulldome images. But trying out rupeshs/fastsdcpu: Fast stable diffusion on CPU - found that even if I do an img2img using a 4K fulldome image as the input, the output was only 1024 x 1024. 

There may be ways to run google colab or something like that, and generate 4K fulldome images - but that is something to be tested later. At first glance, it seems that even Dall-E is limited to 1024x1024, and people have to stitch generated images together to make bigger canvases, as mentioned in this reddit thread. And this thread gives a Stable Diffusion guide which uses upscaling - which has issues as mentioned in my previous post.

super-resolution experiments

I thought of doing some super-resolution experiments directly with ffmpeg or something similar for virtualdub or avisynth or avidemux, but this detailed post makes me pause - mostly not so much better than Lanczos, as they say - scale - How do the super resolution filters in FFmpeg work? - Video Production Stack Exchange

Tuesday, April 02, 2024

stable diffusion experiments

Now that I have access to a GPU, I tried out some AI-based image resizing, video upscaling and image generation, using stable diffusion as noted in a previous post. This post notes some of the pros and cons of the technology as it stands now, in April 2024.

1. There doesn't seem to be a way to incrementally correct images as with ChatGPT-generated code. We need to fine-tune our prompts if we need better results, and run the generation once again.

2. On this machine - 1050TX GPU, quite slow - stable diffusion with the webui takes around a minute to generate a 512x512 default image with an img2img promt and the default 20 steps.

3. Following this guide on fddb, my results with generation were not so great. Changing "little girl" to "businessman with briefcase" did not result in a briefcase in the 4-5 iterations I tried out. Additionally, scaling up the image showed that the skyscrapers were not realistic at all. Perhaps this can be fixed by generating in the higher quality instead of first generating in 512x512 and then scaling up - but I can't do that, since I run into 'CUDA out of memory' errors.. Edit - further experiments in this post seem to indicate 1024x1024 seems to be the upper limit for most models.

Example - part of the fddb example image, upscaled to 4k using Lanczos resizing,

 and using R-ESRGAN-4x+, we see the cartoonish quality,



4. Trying to upscale a video which had a series of stills - something like a slideshow - resulted in lots of image flicker in the upscaled video. The reason for the flicker is some horrendous hallucination, close-ups from a couple of frames shown below.
Original - 

Upscaled - 


and the next frame has the shading which causes the flicker,


Decided to use Lanczos instead of AI in that case. But single image upscaling can give good results, especially if the image is a generic image and not an exact likeness of someone. In case of an exact likeness, some hallucination of features is seen. Example close up, something like spectacles is seen on the bridge of the nose, not present in the original.





 

Monday, April 01, 2024

supported browser for old versions of Windows and MacOS

Copy-pasting from an email I sent:

There is a Chromium-based browser called Thorium which has support for Win7 and above.


(So it may allow use of Google Drive, Google Meet etc which nowadays say "not supported" on older versions of Chrome.)

(Via

A list of browsers for older Macs -

Wednesday, March 27, 2024

Unreal engine for fulldome creation

One of my colleagues passed on this tutorial on how to get started with Unreal Engine - Unreal Engine 5 Beginner Tutorial - UE5 Starter Course from Unreal Sensei

It looks like VR export is also possible relatively easily, but with some caveats as seen in the comments of the youtube video - Unreal Engine 5 360 Panoramic EASY! | No coding No Plugins

I'm not going into it right now, since I have too much on my plate already, and lots of pending content generation with translations, OpenSpace, Stellarium and available VR360 videos.

Tuesday, March 26, 2024

Action required: Migrate your .NET apps to the isolated worker model

There was an email notice from the Azure portal, Migrate your .NET apps in Azure Functions to the isolated worker model by 10 November 2026.

I wanted to check for .NET apps in the various subscriptions, so I followed the method given at the link in the email,

I also found the app under "App Services" in the relevant tenant - so there was no need to spin up a cloud shell.

Since we're currently not using this function (which automates starting the dev server every day, after it is shut down at night), I'll just delete this function instead of migrating it.

creating a simple (but large) family tree

Looking for free (of cost) solutions for making a simple (but large) family tree, I had installed Gramps, but found it less than friendly to use, at least for my purposes. Looking at free family tree templates in Excel and Google Docs, https://spreadsheetpoint.com/family-tree-template-google-docs/ - did not make it very quick to create a tree. Then, more searches turned up familyecho.com - very quick and easy to use, browser based, exports to html.

Monday, March 25, 2024

experiments enabled by NVIDIA graphics card

Now that I have access to a desktop computer with an NVIDIA graphics card, even though it's just a GTX1050 with 8 GB VRAM, I could try out several useful tools which generally need GPU support to run well.

  1. Openspace - I've contributed to the documentation with an FAQ on Planetarium usage.
  2. Running Sheepit autoupdater when I'm not using the machine for anything else, racking up points so that when I need to render something in Blender, I can cloud-render it faster.
  3. Upscaling some of our old videos - from VHS or miniDV - to 4K. Initial idea from Awesome Blender, then using the tutorial from nextdiffusion.ai, taking care to block images on that site (could be NSFW in many contexts).
  4. Will also check out creating some animations with text prompts, and perhaps even fulldome images with Stable Diffusion, since the webui makes it quite a bit more accessible.

Saturday, March 23, 2024

Moodle authentication via an external website

There was a query about how we can authenticate users on one of our LMS servers running Moodle, if they sign up and sign in using an external website. My reply was: 

Moodle supports the following authentication methods as given in the documentation link below:


If (the other website) can supply any of those methods, we can implement the plugin on Moodle.

Friday, March 22, 2024

push to Github failing on Google Apps Scripts

One of our Google Apps scripts sometimes fails to push to Github, with the error message "(filename)  does not match " - the quick fix is to just delete the relevant file(s) (filename) in the git repo, and run the script from the console - it would then successfully push, and retain the correct hash for the next push.

 Edit: link to a repo with example GAS code for pushing a file to a github repo - a json file to a github pages site in this case - https://github.com/hn-88/GAS-daily-upload-to-sched

Tuesday, March 19, 2024

Mirage3d show previews

Mirage3d has a lot of show previews and demo reels on Vimeo. Also, full-length flat previews of shows like Dinosaurs at Dusk. Could download using savevideo.me using the play.vimeo.com url, also available download buttons for some of their videos, as well as savefromnet extension.  

Sunday, March 17, 2024

Netlify serverless functions

Interesting option for fast low traffic api - Netlify serverless functions using the free plan  -  use node.js on the back-end. (Via https://ravisiyerblog.netlify.app/ - https://raviswdev.blogspot.com/2024/01/roadmap-to-learning-full-stack-web.html )

Intro to Serverless Functions | Netlify

Tutorial - https://www.netlify.com/blog/intro-to-serverless-functions/

I just forked this repo, deployed it to my account on Netlify, it started working. Can simply modify the code to suit my requirement, no need for me to install node etc. though of course, if I need to change the functionality and use more node packages, I would need to do all that.

And it's very fast compared to Google Apps script. 

Free usage comparison:

GAS - https://developers.google.com/apps-script/guides/services/quotas - per day and per hour quotas for some services, 6 minutes per execution.

Netlify free plan - https://www.netlify.com/pricing/ - 1M per month serverless function calls, 100 GB per month.

ffmpeg screen recording

Seeing that the OCVWarp post comparing it to ffmpeg was mentioned in February search performance results from google as the top growing page, I browsed ffmpeg.org to check how easy or difficult it would be to contribute a plugin to ffmpeg. Seems a bit complicated. Browsing further, found these instructions in the wiki for screen-recording video using ffmpeg. Quite useful information. And ffmpeg's wiki and bug-tracking runs on Trac.

Saturday, March 16, 2024

SysMain showing high Disk usage on Windows

Apparently this is a "speed-up" tool on Windows! Can be safely disabled - https://helpdeskgeek.com/help-desk/how-to-fix-service-host-sysmain-high-disk-usage-in-windows-11-10/

workaround for cors errors on api calls

In order to implement a "browse categories" button, the schedule page had to call the api, get the categories json, and display as needed. But the api call was running into CORS errors, since the schedule page was hosted on a different subdomain.

From observing the network traffic using Chrome/Firefox Inspect > Network tab at
https://ourwebsite.org/listen/
- got Categories.

to circumvent the CORS errors. 

Since the schedule page is on github pages,

But that page talks about requests going to an api on github pages, but ours is the opposite situation. So, decided to host the json locally, updating it using a google apps script once a day using a time-based trigger.

const githubtoken = 'github_pat_ABABABABABUxj4xsUKeW0909090909090909098';
const tempfolderid = '1pAABCABCABCABCrD8w';
const uploaderemail = 'OurID@users.noreply.github.com';
const apiurl = 'https://ourwebsite.org/api/public/find?col=audiocategories&qry=%7B%22isDeleted%22%3Afalse%7D&order=%7B%7D&limit=1000';

// a wrapper for an automated github commit call using github REST API
// to save a particular json file to a github repo hosting a
// github pages website.

// pushjsontogithub() is called with a timed trigger every day,
// in case the data is updated.

const tempfolder = DriveApp.getFolderById(tempfolderid);

function pushjsontogithub() {
var jsontextoutput = UrlFetchApp.fetch(apiurl).getContentText();

//delete previous copies of the file if any
var files = tempfolder.getFilesByName("audiocategories.json");
while (files.hasNext()) {
files.next().setTrashed(true);
}

tempfolder.createFile("audiocategories.json", jsontextoutput, "text/plain");
doUpload(jsontextoutput, "program/data/audiocategories.json", githubtoken );
}

function getshavalue(shafilename){
var files = tempfolder.getFilesByName(shafilename);
if (files.hasNext()) {
var file = files.next();
var shavalue = file.getBlob().getDataAsString();
return shavalue;
}
return '';
}

function doUpload(file_git, expfilename, token) {
var shafilename = 'shahash-' + expfilename.substr(3) + '.txt';
var shavalue = getshavalue(shafilename);
//var file = DriveApp.getFileById(expfilename);
//var file_git = file.getBlob().getDataAsString();
var data_git = {
'sha': shavalue,
'message': 'updating ' + expfilename,
'content': Utilities.base64Encode(file_git),
'committer': {
'name': 'uploadJSONtoGithub',
'email': uploaderemail
}
};
var data_string_git = JSON.stringify(data_git);
var options = {
'method': 'PUT',
'payload': data_string_git,
'headers': {
'Content-Type': 'application/json',
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 YaBrowser/19.9.3.314 Yowser/2.5 Safari/537.36',
'Authorization': 'token ' + token
}
};
var url = 'https://api.github.com/repos/SSSMC-web/schedule.sssmc/contents/' + expfilename;
var response = UrlFetchApp.fetch(url, options);
var p_git = JSON.parse(response.getContentText());
Logger.log("Done.");
var shablob = Utilities.newBlob(p_git.content.sha, 'text/plain', shafilename);
// delete all copies of shafilename if they exist
var files = tempfolder.getFilesByName(shafilename);
while (files.hasNext()) {
files.next().setTrashed(true);
}
// and then create shafilename
tempfolder.createFile(shablob);
}


 




Friday, March 15, 2024

Transition from Azure classic administrator roles to RBAC roles

There was an email from the Azure portal, asking us to transition from Azure classic administrator roles to RBAC roles for one of our subscriptions. 


As mentioned in this documentation,


I have added the co-administrators and the service administrators as seen in the classic administrator pane to "Owner" role for each of the subscriptions.

Wednesday, March 13, 2024

creating a live stream on youtube using the api and google apps script

There was a requirement for 
(a) streaming an http audio stream to youtube with ffmpeg
(b) automating the creation of the broadcast, making sure that each broadcast is less than 12 hours long so that youtube will archive the video

The method we followed is detailed in this github repo folder - 
(Work in progress as of now - the main concept works, but some refinements like setting the thumbnail, descriptive title, etc to be done.)

The first option was to implement using bash scripts using something like rwxrob/cmd-yt - but the Oauth using go did not work on the first try - go list -f '{{.Target}}' did not return anything. The steps I did are listed below.

apt install jq
tput # already installed
apt install pandoc
# install go with https://go.dev/doc/install
wget https://go.dev/dl/go1.22.1.linux-amd64.tar.gz
rm -rf /usr/local/go && tar -C /usr/local -xzf go1.22.1.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin
# and added that line to /etc/profile

For using the auth-go package, need to compile and install it.
cd ~/auth-go/auth-go-main
go build
but
go list -f '{{.Target}}'
did not return anything.

Then thought of trying google apps script instead.
just need to enable it.


Edit: Please see this later post on a problem and workaround for this approach.

certbot did not auto-renew a domain - it had expired

Even manually trying to renew a domain's SSL certificate from LetsEncrypt, which had not been auto-renewed, did not work. 

Certbot failed to authenticate some domains (authenticator: apache). The Certificate Authority reported these problems:
  Domain: theconcerneddomain.ours
  Type:   unauthorized

Checking the DNS, found the relevant domain was pointing to a godaddy ip address instead of our ip address. Then, checked the whois record and found that the domain had expired. Alerted the concerned person, they renewed the domain, and a few hours later, certbot auto-renewed the SSL certificate, too.

Monday, March 11, 2024

redirect stderr and stdout

While researching various methods to implement a reminder to take a break - some notes about redirecting stderr and stdout - 

ls good bad >/dev/null 2>&1

You have to redirect stdout first before duplicating it into stderr; if you duplicate it first, stderr will just point to what stdout originally pointed at.