Sunday, March 30, 2025

rclone - GUI and remote server-side copy possibilities

 Tried out the GUI at https://rcloneview.com/src/download.html using the Linux AppImage. The remote already configured for my user account was detected, but the directory listing didn't seem to work. Neither did the "Mount". 

Then, server-side copy possibilities - when doing remote to remote copies, the local network is used - so that's not really useful. And on the same remote, a server-side copy is done using hard links - https://forum.rclone.org/t/sftp-remote-server-side-copy/41867 - so that's a bit iffy. Server side copy might be useful for copying between two different cloud providers. The fastest option for our SFTP remotes would be to ssh into one of the machines, install rclone there, create an sftp remote for the other machine, and do the copy from the ssh shell - that would be much faster than bringing all the data to our local network and sending it back.

Thursday, March 27, 2025

compiling a wxwidgets project with cmake on Windows

Run into issues building the simple hello world example from wxwidgets using cmake on Windows. On Linux, the default github cmake action did not need much modification. 
Linux cmake build workflow

But for building on Windows, we needed to add some env variables in the workflow

env:
  # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
  BUILD_TYPE: Release
  WXWIN: C:/wxWidgets-3.2.6
  wxWidgets_ROOT_DIR: C:/wxWidgets-3.2.6
  wxWidgets_LIBRARIES: C:/wxWidgets-3.2.6/include
  wxWidgets_INCLUDE_DIRS: C:/wxWidgets-3.2.6/lib/vc14x_x64_dll
  ARCH: x64

or else the find_package would complain about not finding wxWidgets_LIBRARIES and wxWidgets_INCLUDE_DIRS

Also, 

cmake -G"Visual Studio 17 2022" -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}

to specify which version of Visual Studio to use - and for this version, the default toolset is 14.3 which is the one used to build this set of wxwidgets binaries.
https://docs.wxwidgets.org/3.2.1/plat_msw_binaries.html

But we also had to add a dummy main() to get rid of a linker error, but that breaks the Linux build. 

/home/runner/work/wxOCVWarp/wxOCVWarp/hello.cpp:78:5: error: conflicting declaration of C function ‘int main()’
   78 | int main() { return 0;}
      |     ^~~~
In file included from /usr/include/wx-3.0/wx/wx.h:25,
                 from /home/runner/work/wxOCVWarp/wxOCVWarp/hello.cpp:3:
/home/runner/work/wxOCVWarp/wxOCVWarp/hello.cpp:11:1: note: previous declaration ‘int main(int, char**)’
   11 | wxIMPLEMENT_APP(MyApp);
      | ^~~~~~~~~~~~~~~
gmake[2]: *** [CMakeFiles/OCVWarp.dir/build.make:79: CMakeFiles/OCVWarp.dir/hello.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:87: CMakeFiles/OCVWarp.dir/all] Error 2
gmake: *** [Makefile:91: all] Error 2

So, wrapped an ifdef around the dummy main(), and all is well.

#ifdef _WIN64
int main() { return 0;}
#endif

Tuesday, March 25, 2025

rclone over ssh / sftp

 Tried installing the latest rclone - version v1.69.1 using the deb file and testing an ssh / sftp remote. Finally got it to work. Used the key_file option and passed on the path to our AWS-generated PEM file as the key_file - all other options were left as default with <ENTER>

A point to note is that if we do 

rclone ls nameofourremote:/

it will list all the files on the remote recursively! Instead, we can do

rclone lsd nameofourremote:/some/path

to list only the directories inside the specified path.

setting up a server with a dotnet api

A subset of the previous post. Steps carried out - 

- created a fresh user using adduser

- MySQL database was already running.

- created the subdomains for website and API

- created the appropriate virtual servers for the above.

- copied the uat files to prod

- created a service running on a port like 5000 or 5010 etc for the dot net api at /etc/systemd/system/ourapi.service

systemctl start ourapi

systemctl enable ourapi

(Once the team changes the files referred to by the api service , I will need to restart the service.)

- tested api and website url


Sunday, March 23, 2025

Large Language Models with our own documents - RAG for LLM

RAG = Retrieval Augmented Generation - can be done locally as well as on cloud - explanatory video - 

Feed Your OWN Documents to a Local Large Language Model!

In the video, openwebui is used to run the local LLM - 

https://docs.openwebui.com/features/

If using docker (for ease of setup), and we want to copy our documents to the LLM's docker container, Docker copy command - 

Copying Files to and from Docker Containers - GeeksforGeeks

docker container cp source_local container:/path

sudo docker cp ~/Desktop/to-be-copied.txt 135950565ad8:/to-be-copied.txt

(the container id like 135950565ad8 above, is usually seen as a root@containerid prompt in the running container)

And apparently in the latest versions of openwebui, there is integration inside the UI itself for uploading documents - https://docs.openwebui.com/features/rag#local-and-remote-rag-integration

"Local documents must first be uploaded via the Documents section of the Workspace area to access them using the # symbol before a query. Click on the formatted URL in the that appears above the chat box. Once selected, a document icon appears above Send a message, indicating successful retrieval."

Wednesday, March 19, 2025

message from Microsoft Azure - Convert to Azure role-based access control (RBAC)

 The email sent to us, saying "To avoid service disruptions, convert classic admin roles that still need access to your subscription to Azure RBAC roles immediately." quoted a subscription id, and checking that subscription, found that only one admin had classic admin roles, who was already added as "Owner" in RBAC roles. So, no action taken. 

Saturday, March 15, 2025

upscaling a video (from HD to 4k, for example) using ESRGAN on Google Colab

 Tried out the first result in a web search for upscaling using google colab - 

https://colab.research.google.com/github/yuvraj108c/4k-video-upscaler-colab/blob/main/4k_Video_Upscaler_Colab_(Real_ESRGAN).ipynb

Copied to my google drive to make the changes persistent - the only changes needed were the paths to the input and output files. 

Without modifications, the upscaled video went to the google drive recycle bin instead - it looks like there is a missing 'mv' in the command = f"'{final_video_path}' '{save_directory_drive}'/'{final_video_name}'"

Anyway, input video with compression artifacts gets upscaled to output video with compression artifacts. If there's some clean video, will take a look. The upscaling inference goes at approx 2 seconds per frame on the T4 google colab GPU.

Thursday, March 13, 2025

planets "flyby" renders with OpenSpace


The full versions of these clips - more frames as well as 4096x4096 resolution - are available at https://archive.org/details/sun-2-rotate

Copy-pasting the notes posted on Github, for creating these "flybys" - 

  • for openspace to focus on a planet without making the camera rotate around it - In the settings > Navigation Handler there is a "Follow Anchor Node Rotation" and a "Follow Anchor Node Rotation Distance", smaller distance = the closer you can be to the object before following its rotation - https://openspacesupport.slack.com/archives/C055D75TJ9K/p1718704511126989?thread_ts=1718701308.415139&cid=C055D75TJ9K

  • For changing the length of the planet trails (orbit paths) - https://docs.openspaceproject.com/releases-v0.20/using-openspace/scripting/console/index.html for getting the trails length property, checking logs/ScriptLog.txt openspace.setPropertyValue("{planetTrail_solarSystem}.Renderable.Enabled", false) works. It is case sensitive. In Trail Appearance, currently the default is LineLength=1 Line Fade Amount is a small amount - something like 0.25. Increasing Line Fade Amount to 0.4 increases the length of the trail shown. openspace.setPropertyValue("{planetTrail_solarSystem}.Renderable.Appearance.LineFadeAmount", 0.4) in the console scripting window by hitting ` (backtick) key We need to again close the console window by hitting ` again, otherwise keyboard shortcuts like t to toggle all trails won't work - the keystrokes will be captured by the console.

  • The Sun size was increased to 36x and Sun glare was turned off for the Mercury + Sun clip.

escaping backticks in markdown

 While writing markdown in github, wanted to know how to escape the backtick ` character. 

https://stackoverflow.com/questions/24313204/how-does-one-escape-backticks-in-markdown

Apparently, we can do ``` ` ``` which will render as ` (note the space between the three initial backticks and the single one. We can also do \` when the backtick is not supposed to be inside a code block. 


Wednesday, March 05, 2025

google classroom overview video tutorial

 Shows both teacher view and student view - How to Use Google Classroom - Tutorial for Beginners from @TeachersTech

https://www.youtube.com/watch?v=pl-tBjAM9g4


Moodle server expansion

Copy-pasting from an email thread, responding to a query on how we can move forward with expansion plans - context was that a large number of users (presumably editing on Moodle) brought down the db server:

Various options:

1. Use CMS for content creation, and LMS for content distribution. Use only one or two concurrent users for loading content onto LMS. For training purposes, https://moodle.org/demo can be used instead of our server.

2. If the above does not work for you, consider shifting to Google Classroom - we can probably get an edu account, which would allow 500 concurrent users per class. Even in the free version, 250 concurrent teachers and students can log in. If you're predominantly going to use H5P, there are some workarounds for using H5P on google classroom, like https://h5p.org/node/137178 

Another option is Google Sites, which also allows easy creation of content pages like Wordpress, but free for us, and we don't need to add any servers - https://support.google.com/a/answer/6399191

3. If that also does not work for you, then consider repurposing some of your old developer workstations into servers, and use them instead for training + multi-user content creation purposes; at other times, when only content distribution is taking place, we can switch to the existing Azure servers within 5 minutes or so.

4. If none of the above, and you continue to want to work with Moodle, consider Moodle hosting service providers in India at ~$30 a month (compared to ~$60 a month we would spend on overages if we upgrade our Azure servers beyond the free credits) - https://cloudpap.com/blog/moodle-hosting-in-india/

Sunday, March 02, 2025

Customized Moodle app bug and solution

 Copy-pasting from a request for help in the Moodle forum - "we're facing a strange issue, and any help is welcome. The questions in the feedback module are visible when viewed on a web browser, but the questions are not visible when using a customized Moodle app. Even if we just build the Moodle app for Android without any customizations, the resulting app doesn't show the questions. "

I see now that this is a bug reported in the Bug Tracker for the app, https://tracker.moodle.org/browse/MOBILE-4698

The code in the "beta" branch has the fix, and the bug is fixed there, as I check today.

Friday, February 28, 2025

online panorama stitcher

 Via OpenCV directly in the browser (webassembly + webworker) - DEV Community

latsic/imgalign: Webapplication for image stitching and aligning

Needle - took some 30 seconds to a minute to load OpenCV on my machine, the actual stitching took less than two seconds with the sample 3 images.

using hand-held video clips on the planetarium dome

One of our colleagues wondered how nice it would be to see videos like this documentary on the "large screen" by projecting on the planetarium dome. We can use tools like OCVvid2fulldome to project the video to the front part of the tilted dome, say covering 180 degrees left to right. Trying out a variation of this technique, using OCVWarp on video padded to 4k equirectangular shape, reasonably distortion-free results for 
padding with equal amounts of black on all four sides, with
-136 degrees y angle in OCVWarp. 
Some parts of the video - the lower parts near the left and right edges - get cropped, but the visuals look good.

Unfortunately, the problem is that the mostly hand-held footage is extremely nausea-inducing when blown up to such a large size. Even the moderate shake of this professionally shot video segment is unacceptable on the dome without slowing down the footage or making the video window smaller.

Tuesday, February 25, 2025

appimage build on github actions - potential issue

linuxdeployqt will not allow building of appimages with ubuntu versions above 20.04 till 20.04 is out of support, which is end of May, 2025.

 But github actions has already started "brownout" of 20.04 - The Ubuntu-20.04 brownout takes place from 2025-02-01. For more details, see https://github.com/actions/runner-images/issues/11101

A workaround would be to use go-appimage instead, which does not have this hard limit on OS version. As was used for OpenSpace-AppImage.

fake astronomy posts on social media

I got a message about this,


Copy-pasting from my reply, 
As is usual with most email forwards, this is fake. The actual paths are described in the post below,


Then there was the "planets lining up" forward from January - for which my reply was https://earthsky.org/tonight/planetary-alignment-january-25-2025/



Thursday, February 20, 2025

adding two wordpress sites to an existing server

We had a server which had Apache and Mysql already installed (as well as a couple of Wordpress sites already). Steps followed, in brief, to add two more Wordpress sites:
  1. mysql> create database wordpresswebsitestaging;

    CREATE USER "stagingwpuser"@"localhost" IDENTIFIED BY "ThePasswordH3r3";
    GRANT ALL PRIVILEGES ON wordpresswebsitestaging.* TO "stagingwpuser"@"localhost";
    FLUSH PRIVILEGES; 

    https://developer.wordpress.org/advanced-administration/before-install/creating-database/

  2. Creating the web root directories and a user who can sftp in to upload files etc if needed
    sudo adduser thewpwebsiteadmin
    sudo su thewpwebsiteadmin
    cd /home/thewpwebsiteadmin
    mkdir directory1
    mkdir directory2


    We need to give read permissions to the entire path for the webserver to be able to read these directories, so
    sudo chmod -R +rx /home/thewpwebsiteadmin


  3. Created DNS entries in cloudflare. In this case, CNAME records.

  4. Copied existing files in /etc/apache2/sites-available as templates for the new sites. Since we were using cloudflare origin certificates, there was no need to create new certificates with certbot etc. After editing the conf files as needed, with the /home/thewpwebsiteadmin/directory1 and directory2 as home directories, enabled the sites with
    sudo a2ensite newsite1 newsite1ssl newsite2 newsite2ssl
    sudo systemctl reload apache2


  5. Path to latest wordpress from https://developer.wordpress.org/advanced-administration/before-install/howto-install/
    wget https://wordpress.org/latest.tar.gz
    tar -xzvf latest.tar.gz
    cp -R wordpress/* directory1
    etc

  6.  Visit the new sites with a browser to supply the database configuration etc, the wp-config file gets generated, create a new file and paste the generated file to the wordpress root directories as
    nano wp-config.php

  7.  Create ssh key and add to authorized_keys - 
    ssh-keygen -t rsa -m PEM -f theadminuserkey.pem
    mkdir .ssh
    mv theadminuserkey.pem.pub .ssh/authorized_keys

    and set appropriate permissions for the .ssh directory and file - 
    chmod 700 .ssh
    cd .ssh
    chmod 600 authorized_keys

Monday, February 17, 2025

cloudflared or ssh tunnel for reverse-proxying on-premise servers

Exploring what we can do with cloudflare - 


2. But BSNL, Airtel etc would block ports. So, it would be far easier to use a tunnel with an outgoing ssh connection to a VM or something like that. That way, we don't have to depend on port-forwarding and availability of unblocked ports. We can use -R in the ssh tunnel for reverse-proxying.

3. But then, we may not even need a VM - currently Cloudflare Zero Trust Web access supports private apps, which would ask clients for authentication, and then allow them to connect to our private server via cloudflared tunnels.
https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/get-started/create-remote-tunnel/
and give it a public hostname with
Starting from the page below, we can go "next, next" to finish all the steps to achieve ZT web access.


Saturday, February 15, 2025

app api call slowdown, QUIC is suspected

It was reported that one of our Android apps was experiencing delays and timeouts in api calls, which hit a dot net backend running on Linux. Apparently the errors they saw were
 net::ERR_QUIC_PROTOCOL_ERROR

I suggested that they disable QUIC in their browser, https://thegeekpage.com/err_quic_protocol_error/

But apparently the app was having the errors and not in a browser. Since I'm not a dot net or Android developer, I'm not sure how one can disable QUIC in a generalized manner. But I could configure the server's firewall to explicitly Deny QUIC requests (UDP requests on port 443) which would then immediately make the client fall back to HTTP/2 (TCP packets).

There was an update pending on the server. Completing that and rebooting, still the issue continued. "For the past week, we've been experiencing buffering and delays in the app, especially on 3G networks". Maybe there was some change in either the network or Android or something like that? Cause could be any of those. Anyway: set up a firewall rule to Deny UDP to ports 80 and 443, and also disabled QUIC for the entire domain in cloudflare, https://developers.cloudflare.com/speed/optimization/protocol/http3/

That seems to have solved the issue. 

Monday, February 10, 2025

Miscellaneous Blender VSE settings used for the recent project

Some settings and shortcuts I revised when working on a recent project - 

I thought that I should prevent the creation of "proxies" in Blender VSE (Video Sequence Editor) since the working SSD was only 256 GB, with only around 100 GB free. 

First, I set the 
Proxy setup to Manual
Proxy render size to 25%
Then I thought of disabling proxies altogether, so set the 'Use Proxies' checkbox to False (pull out menu on right of rendered view)

Image showing all these, from the page above,


How to rotate an HDRI background - https://www.youtube.com/watch?v=fqd4mc42sZQ
Shading tab - Choose World instead of Object as the subject of the shading editor, rotate using Vector Mapping node ahead of the single image HDRI as in the screenshot below,


Cutting video clips into pieces which do not show the previously existing clip sections when stretched - is by "Hold Split" - https://vse-docs.readthedocs.io/video_editing/edit/montage/transform.html#split
Shift + K to 'hold-split' at the cursor.

Shift + A is the shortcut key to add speed control strip (and many other things) - https://vse-docs.readthedocs.io/video_editing/edit/effects/speed.html - Add > Effect > Speed Control

Similarly, for a cross-fade transition, select begin clip, Shift click to select end clip, then Shift+A - Add > Transition > Cross - https://vse-docs.readthedocs.io/video_editing/edit/effects/transition.html - we can change the order of the transition later, if needed, from the side bar, by changing the Input 1 and Input 2 strips as in the screenshot below.




Sunday, February 09, 2025

listing ffmpeg commandline options


You can see available presets including lossless
with
ffmpeg -h encoder=hevc_nvenc

List of the hwaccels available in the ffmpeg executable, 
ffmpeg -hwaccels

So, added
-preset lossless
to my commandline, and it worked. I think it was something like

ffmpeg -r 30 -start_number -003875 -f image2 -preset lossless -i "OpenSpace%06d.png" -c:v hevc_nvenc ../filename.mp4

Got the message
The selected preset is deprecated. Use p1 to p7
(but it is doing the encoding.)
There is also -tune lossless option. But I didn't try that.


Thursday, February 06, 2025

simple static multi-lingual titles instead of tracked titles

Instead of going the tracked title route, I settled on a simpler static title overlay using Blender VSE, because

  • It's far less time-consuming
  • Hindi text does not render well as a Blender text object

So,the workflow was:

  • Create the title text in a document editor like Google Docs
  • Take a screenshot of the black text on white background
  • Invert to white text in black background on Gimp
  • Overlay over "warped" video directly with opacity fading in from 0 to 0.5 over a second - OR -
  • If overlaying over a fulldome clip, first "warp" the flat text to match the fulldome clip's curvature using the method in this old post.

In particular, after trial and error, the particulars seem to be:

  • 36 point font size text to take screenshot
  • stretch the text to make it square (halve the width)
  • put the stretched screenshot at the bottom of a 4096x4096 transparent image
  • make the screenshot even smaller if required, or use a larger transparent image
  • merge down the layer if the filter doesn't act on the entire image
  • use Gimp's Filter > Distorts > Polar co-ordinates with "Map backwards" checked (otherwise the text would be inverted left to right) and save as png preserving transparency (alpha channel).


 


Payzapp mini review

I tried using HDFC Bank's Payzapp app for payments - it has features like loading up the Payzapp wallet with credit card, then transfer by UPI to bank accounts, etc. But, 

  • they doubled the fee for Payzapp wallet loading from credit card
  • many merchants, including the most important one which I needed to pay > 10k per month, blocked access to Payzapp payments due to fees they're charging merchants
  • a billdesk payment of APSPDCL went through, but did not reflect in the "paid" bills. Billdesk said merchant had rejected payment, I need to pay again. Payzapp says refund has been issued, but there is no way to check except by seeing the balance - which I have now emptied, because the back-and-forth between Payzapp and Billdesk had taken more than a month.
     

Overall, a very poor experience. So I will use Payzapp only for the convenience of paying HDFC Bank credit cards with it, will block all notifications from it, and not keep any wallet balance. Even when making HDFC bank credit card payment, the app failed to load this morning, and loaded again later in the day. Also, the Payzapp app shows "apply coupons" when making a Rs. 4000 payment, but the coupon says min. transaction Rs. 5000, and the "apply coupon" button is not shown when I was actually making the Rs. 10,000 transaction! Bad HDFC! We can contrast this with Amazon.in's method of showing exactly how much "cashback" or "savings" will accrue for each payment method.

Tuesday, February 04, 2025

monitoring expiring certificates with Red Sift

 LetsEncrypt sent out an email that they would no longer be sending certificate expiry warning emails, and recommended we sign up to Red Sift's free plan. 

We can recommend Red Sift Certificates Lite, which provides free expiration emails for up to 250 active certificates: https://redsift.com/pulse-platform/certificates-lite

After signing up, there was a certificate warning, but it turned out to be a false alarm - a certificate which had been re-issued onto a new machine. 

Monday, February 03, 2025

manual setup of awstats with static report pages

To improve responsiveness, tried to make awstats generate static pages instead of dynamic report generation with the cgi-bin perl script.

Most probably the unresponsive nature was due to the DNS settings in the /etc/awstats/*.conf files for the domains we were reporting on. As the conf file says,

# If you want/need to set DNSLookup to 1, don't forget that this will
# dramatically reduce AWStats's update process speed. Do not use on large web
# sites.

Then, there was also the dynamic DNS lookup option, which also needed to be set to 0 - 

# For very large sites, setting DNSLookup to 0 (or 2) might be the only
# reasonable choice. DynamicDNSLookup allows to resolve host names for
# items shown in html tables only, when data is output on reports instead
# of resolving once during log analysis step.
# Possible values:
# 0 - No dynamic DNS lookup

Then two more settings were changed, changed to 0

# Possible values:
#  0  - Report is not shown at all
#  1  - Report is shown in main page with an entry in menu and default columns
# XYZ - Report shows column informations defined by code X,Y,Z...
#       X,Y,Z... are code letters among the following:
#        U = Unique visitors
#        V = Visits
#        P = Number of pages
#        H = Number of hits (or mails)
#        B = Bandwidth (or total mail size for mail logs)
#        L = Last access date
#        E = Entry pages
#        X = Exit pages
#        C = Web compression (mod_gzip,mod_deflate)
#        M = Average mail size (mail logs)

# Show domains/country chart
# Context: Web, Streaming, Mail, Ftp
# Default: PHB, Possible column codes: UVPHB
ShowDomainsStats=0

# Show hosts chart
# Context: Web, Streaming, Mail, Ftp
# Default: PHBL, Possible column codes: PHBL
ShowHostsStats=0

Then, with much trial and error, the following lines were added to the root crontab for creating the static pages, and an index file was created to easily go to the relevant server/month page.

sudo su -
crontab -e

58 23 * * * /usr/share/awstats/tools/awstats_buildstaticpages.pl -update -dir=/var/www/pathtostatsfromawstats/ -config=server1.org -builddate=$(date '+\%Y\%m') > /dev/null  2>&1

 56 23 * * * /usr/share/awstats/tools/awstats_buildstaticpages.pl -update -dir=/var/www/pathtostatsfromawstats/ -config=server2.org -builddate=$(date '+\%Y\%m') > /dev/null  2>&1

and so on. 

There were lots of emails to root being generated every 10 minutes from cron, saying awstats.pl could not read the log files in /var/log/apache2/ourlogfile.log - it turned out that these were being generated by another cron which would probably have been created by the awstats installation via apt, which was located in /etc/cron.d directory, the file was /etc/cron.d/awstats which was being run as an unprivileged user, hence unable to read log files etc. So I just commented out those awstat update lines in that file. To note:

# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.

Initial setup -

followed the post
to get Ubuntu install documentation,
and followed that for the setup, with separate access.log files for each domain set in their respective conf files.
 

And if we need to password protect it,

https://www.digitalocean.com/community/tutorials/how-to-set-up-password-authentication-with-apache-on-ubuntu-20-04

Running the perl script without any arguments gave the listing of possible arguments -  

perl /usr/share/awstats/tools/awstats_buildstaticpages.pl

Usage:
awstats_buildstaticpages.pl (awstats_options) [awstatsbuildstaticpages_options]

  where awstats_options are any option known by AWStats
   -config=configvalue is value for -config parameter (REQUIRED)
   -update             option used to update statistics before to generate pages
   -lang=LL            to output a HTML report in language LL (en,de,es,fr,...)
   -month=MM           to output a HTML report for an old month=MM
   -year=YYYY          to output a HTML report for an old year=YYYY

  and awstatsbuildstaticpages_options can be
   -awstatsprog=pathtoawstatspl AWStats software (awstats.pl) path
   -dir=outputdir               Output directory for generated pages
   -diricons=icondir            Relative path to use as icon dir in <img> links
   -builddate=%YY%MM%DD         Used to add build date in built pages filenames
   -staticlinksext=xxx          Build pages with .xxx extension (default .html)
   -buildpdf[=pathtohtmldoc]    Build a PDF file after building HTML pages.
                                 Output directory must contains icon directory
                                 when this option is used (need 'htmldoc')

At first, I thought I would need to manually create directories and chown them to www-data

# mkdir 202502
# chown www-data:www-data 202502

 

but then I could use the builddate parameter instead. Note that in the builddate parameter, when the $(date) is called in a cron script, the % characters have to be escaped.

Reports for older year/month combinations could be created like
perl /usr/share/awstats/tools/awstats_buildstaticpages.pl -dir=/var/www/pathtostatsfromawstats/ -config=ourserver.org -year=2024 -month=12 -builddate=202412

And finally, asked Github Copilot to generate a form with dummy servernames and paths, which I manually edited to get the correct paths, as below -

<script>
        function redirectToUrl() {
            var server = document.getElementById("server").value;
            var year = document.getElementById("year").value;
            var month = document.getElementById("month").value;
            var url = "https://ourstatsurlforstatsfromawstats/awstats." + server + year + month + ".html";
            window.location.href = url;
        }
    </script>
</HEAD>
<body>
    <form onsubmit="event.preventDefault(); redirectToUrl();">
        <label for="server">Select Server:</label>
        <select id="server" name="server">
            <option value="1.org.">CMS</option>
            <option value="2.org.">devel2</option>
            
        </select>
        <br /><br />
        <label for="year">Select Year:</label>
        <select id="year" name="year">
            <option value="2024">2024</option>
            <option value="2025">2025</option>
            <option value="2026">2026</option>
        </select>
        <br /><br />
        <label for="month">Select Month:</label>
        <select id="month" name="month">
            <option value="01">01</option>
            <option value="02">02</option>
            <option value="03">03</option>
            <option value="04">04</option>
            <option value="05">05</option>
            <option value="06">06</option>
            <option value="07">07</option>
            <option value="08">08</option>
            <option value="09">09</option>
            <option value="10">10</option>
            <option value="11">11</option>
            <option value="12">12</option>
        </select>
        <br /><br />
        <input type="submit" value="Submit" />
    </form>

               
</body>

Friday, January 31, 2025

resizing a window in xfce

 Some windows like the file manager Thunar allow resizing by dragging any corner, but not the Microsoft Edge browser window. Solution - press ALT, right-click inside the window and drag in any direction.

https://unix.stackexchange.com/questions/61037/how-to-resize-application-windows-in-an-arbitrary-direction-not-vertical-and-no

Thursday, January 30, 2025

show date-time instead of date in Thunar

On the Linux Mint XFCE desktop, Thunar is the default file manager, and by default, it just shows "Today" or the created date of the file. Not useful to find the latest in several versions created in a few minutes time, or to see how long it took to generate file sequences etc. But happily, it can easily be fixed, instead of having to open a terminal and do ls -l

https://forums.linuxmint.com/viewtopic.php?t=241840
Menu > Edit > Preferences - very first tab (Display), Date Format - drop down list right along the bottom is a format like yyyy-mm-dd hh:mm:ss

Wednesday, January 29, 2025

boot logs and more with journalctl

On machines with systemd, we see systemd logs with journalctl - How to Read and Edit Systemd Logs using Journalctl in linux

journalctl -b -1 for previous boot logs.

These still work - 
tail /var/log/syslog
tail /var/log/dmesg 

Other logs still seen in /var/log are auth.log and boot.log
-----------------
On newer systems, there is no /var/log/syslog
- /var/log/syslog does not exist.


journalctl -r for reverse chronological order.

spacebar to move forward, b to move backward.


Tuesday, January 28, 2025

adjusting pitch and narration speed in Reaper

Quick and dirty pitch shifting + increasing speed of narration in Reaper - using the "Playback Rate" item setting. Increasing playback rate increases the speed of the narration, of course. Keeping the "Preserve pitch" checkbox ticked allows the voice to retain the current pitch. And a negative value for "Pitch adjust (semitones)" makes the voice deeper. 



Monday, January 27, 2025

downloading youtube videos in 4k

Youtube has recently changed some of its video delivery code, so that online tools like ssyoutube.com etc don't provide videos higher than 360p. Even tools promising free 4k downloads like 4kdownload.com could only provide a 1080p version. Checking if open-source tools can do better - searched for yt dl on github, found https://github.com/ytdl-patched/ytdl-patched which had been updated recently. 

Usage - just needed to give

yt-dlp https://www.youtube.com/suitable-url
 
and it downloaded a 4k version.

Sunday, January 26, 2025

Fulldome video - simulated view of moving through a gas cloud or Nebula

Trying to create a different version of this video by ESO - https://www.youtube.com/watch?v=lj3t_gjuXWk - led me to various searches, where apparently IFSRenderer was supposed to be easier to create Nebula videos than Blender. There's the disadvantage that it runs only on Windows, and also doesn't seem to be accelerated much using an NVidia graphics card? So, these renders are only 1024x1024 - also, since these are supposed to be clouds, we can probably scale them to 4k - and probably just get a softer look for the nebula. These renders went at around 4 to 5 frames per minute on the computer with the NVidia 1060 card. 

Fulldome video suitable for playback in Planetariums - 


And one more (which was actually done earlier, on a laptop with integrated Intel graphics) - 


The saved settings for these are uploaded to github,
https://github.com/hn-88/IFSRenderer-saves

Zoom out to the edge of the observable universe in a single shot without cuts

Similar to the previous post, but in a "single take" zoom motion all the way from Earth to the edge of the observable Universe. A fulldome video made with OpenSpace - details as in my previous post.



The 4K (4096x4096) full resolution videos are available from archive.org - https://archive.org/details/to-edge-of-u-single-zoom-4k-hevc-nvenc-30fps
 

 A "reference" video with text overlay is also created, so that we can note the distances from Earth as the "camera" moves outwards - 


Earth to the Moon - fulldome video

Zooming out from a view of the Earth to a close view of the Moon, with a shot similar to the iconic "Earthrise" photo, and moving beyond the Moon - fulldome video suitable for planetariums created with OpenSpace


 

The "recording" file used to create this image is shared at https://github.com/hn-88/openspace-scripts/tree/main/user/recordings/Moon-Earthrise-beyond

As noted in the readme there, this was created with v2.1 of OSREC-interp and not with v3.0, v3.0 had bugs - jerky motion.

The full resolution 4096x4096 video is shared on archive.org - https://archive.org/details/earthto-moon-earthrise-beyond-hevc-nvenc

More of our fulldome videos on archive.org are at  https://archive.org/search?query=creator%3A%22www.saispace.in%22

Saturday, January 25, 2025

delete files found with "find"

Trying to create an AppImage for OpenSpace led to many learnings. Among them - how to delete the files found with the "find" command - 


find . -name '*.cpp' -print0 | xargs -0 -P2 rm

Explanation - 

"If you're on Linux or have the GNU find and xargs commands, then use -print0 with find and -0 with xargs to handle file names containing spaces and other odd-ball characters." - https://stackoverflow.com/questions/864316/how-to-pipe-list-of-files-returned-by-find-command-to-cat-to-view-all-the-files

"xargs reads items from the standard input, delimited by blanks (which can be protected with double or single quotes or a backslash) or new‐lines, and executes the command (default is echo) one or more times with any initial-arguments followed by items read from standard input.  Blank lines on the standard input are ignored." ... "Because Unix filenames can contain blanks and newlines, this de‐ fault behaviour is often problematic; filenames containing blanks and/or newlines are incorrectly processed by xargs. In these situations it is better to use the -0 option, which prevents such problems. When using this option you will need to ensure that the program which produces the input for xargs also uses a null character as a separator. If that program is GNU find for example, the -print0 option does this for you." - https://www.man7.org/linux/man-pages/man1/xargs.1.html

and the -P option is "-P max-procs, --max-procs=max-procs
              Run up to max-procs processes at a time"


patch files using patch

For creating the OpenSpace AppImage, we need to apply some changes to the cfg file, and the most straightforward way to do it in the build script might be using patch.



So we create a file with the needed changes and use diff to create the patch.

diff -u old/slang.c new/slang.c > slang.patch

Thursday, January 23, 2025

logging load average and memory usage on Linux servers

Just redirecting the output of top to a text file, like top >> logtop, we get lot of unprintable characters due to its refresh nature.

uptime gives load average.

top can do various things, like batch mode, -b


Probably more efficient to just log timestamps, free and uptime.

So, put in a cron job to run every 15 minutes,
*/15 * * * * /home/path/to/logtopscript.sh

$ more logtopscript.sh
#!/usr/bin/bash
echo $(date '+%Y-%m-%d:%H:%M:%S') uptime: $(uptime) free: $(free)  >> /home/path/to/toplog.txt

This can be imported into spreadsheets like LibreOffice Calc using <SPACE> as the delimiter, but has problems with uptime's output not being exactly the same length - sometimes
up 1 hour
sometimes
up 6 days,  8:33
etc. It has issues for 3-4 data points every day, which need to be manually finagled. Probably a regex to select only the load average can solve that.

Wednesday, January 22, 2025

reinstating check status php code

 During the kerfuffle caused by the server overload mentioned in a previous post, we had disabled javascript code used to periodically ping a php page to check whether the CMS user had logged out from another window. That would have caused some session timeouts which would not be reported to the user, resulting in issues like this: 

Earlier today a few users contacted me saying that they are unable to login. I told them to clear cache and login and it worked. 

Since this check status code was not the root cause of the issue - which was just too many users trying to log in and using up all the RAM, the javascript and the check status code has been reinstated now.

Windirstat to find large files in filesystem

Revisiting an old tool, still great at what it does - Windirstat - for easily visualizing large files and directories.

Tuesday, January 21, 2025

server overloaded

 Lots and lots of server issues over the last 4 days, on some of our Moodle instances. Tried blocking bots on the ssh port, tried adding robots.txt to prevent excessive crawls, still, 30+ alerts from the server from last night ~8.30 pm onwards up to this morning. Finally, upsized the web server to 7 GB RAM (at double the cost) and the alerts stopped. So, it was human traffic that was probably to blame.

Checking logged in users on Moodle, for instance, via Site Administration > Reports > Live logs showed more than 20 users actively editing courses.

(Had tried blocking bots using

https://techexpert.tips/apache/apache-blocking-bad-bots-crawlers/

RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} (gumgum-bot|postmanruntime|ag_dm_spider|scrapy|chimebot|SeekportBot|Amazonbot|SemrushBot) [NC]
RewriteRule .* - [F,L]

But since the root cause was human users, this did not have much effect.)

Monday, January 20, 2025

BSNL FTTH ONT port 9090 server - did not work

A custom defined server on the ONT, without configuring anything else, did not work at port 9090. A predefined Shoutcast server, port 8000, also didn't work. Probably BSNL does some firewalling at the gateway. So would probably need some sort of ssh tunneling to run a server over BSNL FTTH. 

simple webserver for testing on Windows using Powershell

 This needs to be run in a Powershell run as administrator on my machine. Via https://woshub.com/simple-http-webserver-powershell/


$httpListener = New-Object System.Net.HttpListener

$httpListener.Prefixes.Add("http://+:9090/")

$httpListener.Start()


write-host "Press any key to stop the HTTP listener after next request"

while (!([console]::KeyAvailable)) {

$context = $httpListener.GetContext()

$context.Response.StatusCode = 200

$context.Response.ContentType = 'text/HTML'

$WebContent = Get-Content -Path "D:\Downloads\new.html" -Encoding UTF8

$EncodingWebContent = [Text.Encoding]::UTF8.GetBytes($WebContent)

$context.Response.OutputStream.Write($EncodingWebContent , 0, $EncodingWebContent.Length)

$context.Response.Close()

Write-Output "" # Newline

}

$httpListener.Close()

run file-manager as root on Linux Mint

 gksu etc doesn't work, what does work, from https://forums.linuxmint.com/viewtopic.php?t=424807

pkexec nemo

Friday, January 17, 2025

flash drive errors

Tried many different ways to try and fix a 500 GB flash drive's errors, finally gave up as probably hardware fault. Details below.

Trying robocopy to copy large files, when a simple copy command fails - From
to
to


Accidentally set this drive to offline in windows disk management - using the diskpart method did not work. The object is not found. No solutions for me from this link. Finally got it online again from the settings app, Right-click on the Start button and select Settings >
Navigate to System > Storage > Advanced storage settings > Disk & volumes >
 Properties button of a disk (except the system disk or Windows disk) > Status section >
Online/Offline button


chkdsk f: /f /r /x

Free space verification is complete.
 Phase duration (Free space recovery): 10.42 minutes.
An unspecified error occurred (6e74667363686b2e 164d).

Again, formatting fails.

badblocks (on Linux) - recommends using badblocks via e2fsck, but e2fsck does not support ntfs. (on rpi).
So, plan is to repartition into 5 100 GB partitions, and try format f: etc on Windows. Partitioned OK, but formatting the partitions fails. So, gave up as hardware fault.



robots.txt syntax to exclude specific bots

 https://stackoverflow.com/questions/56049660/how-to-exclude-all-robots-except-googlebot-and-bingbot-with-both-robots-txt-and

So for allowing googlebot and bingbot and nothing else, the syntax would be:

User-agent: *
Disallow: /

User-agent: Bingbot
Disallow:

User-agent: Googlebot
Disallow:

Sunday, January 12, 2025

preventing Moodle time-outs

 Copy-pasting from an email I sent out:

 ...  doing bulk actions on the Moodle instances can cause timeout failures if the action takes more than a minute or so to complete. So, actions should be done in small batches. For example,

1. Deleting users - first start with deleting one user, see how long it takes, and then scale to as many as possible to complete in one minute. A detailed post about automating this process is at 

https://hnsws.blogspot.com/2024/10/moving-multiple-moodle-instances-from.html#deleting-users

2. Deleting courses - you may need to delete module by module, checking how long each process takes, as above. 

3. Running ad-hoc queries - please filter for small result sets and optimize code so that the query completes within a minute or two.

Similarly, when designing the course pages, please use themes / modules / etc in such a way that only a limited number of images and or other content loads on a single page - otherwise, the site will be experienced as slow to load, slow to edit, etc. A rule of thumb would be to limit the scrolling to two screen heights, and not more than that.

In general, if you experience timeout errors (which usually will be displayed as "gateway error" if using cloudflare), you can simply close and re-open your browser after a couple of minutes, login again, and the site should load.


manually editing kodi playlists

Following up on the use of Kodi for theatre playouts - the previous posts below,
Work Stuff: optimizing kodi for planetarium projection


the playlists are located on the SDCARD and not on the USB drive containing the video files - 
Path to the video playlists is
STORAGE > .kodi/userdata/playlists/video

The editing has to be done as root, as no access otherwise.

Can't use UI, since gksudo is removed,
and other methods also don't work,

The entries in the m3u files are of the form
#EXTINF:0,3002Fade-out Lights.avi
/var/media/NTFS500GB/CommonFiles/3002Fade-out Lights.avi
so we need to remember to edit the filename on two lines.

Saturday, January 11, 2025

Zoom out to the edge of the observable universe

A fulldome video made with OpenSpace - details as in my previous post.

The OpenSpace recordings are shared at 
openspace-scripts/user/recordings/ToEdgeofU

The 4K (4096x4096) full resolution videos are available from archive.org -  
Zoom out to the edge of the observable Universe



format_onetopic plugin backwards compatibility

 Copy-pasting from an email, regarding the onetopic plugin's version for Moodle 4.5 and compatibility with older (3.x?) versions - 

I'm updating the format_onetopic plugin on all our Moodle instances. When doing that, it notified me of a new setting, backward compatibility with old styles, which it says will be removed soon.

 Currently I have enabled it, but if possible, please check the courses which use format_onetopic to see if they can be migrated to use the format_onetopic new style editor. The setting for format_onetopic is at

/admin/settings.php?section=formatsettingonetopic

 - the 2nd option, 

"Use legacy style controls. This option is only available for compatibility with older versions of the plugin and will be removed in the future in favor of using only the new style editor." 

Most probably, the way to do this would be:

1. check if the course is displayed correctly

2. go to admin/settings.php?section=formatsettingonetopic and uncheck the "Use legacy style controls"

3. check again if the course is displayed correctly

4. make some edit to the course, check again if the course is displayed correctly

5. If displayed OK, then you can revert the edit, and leave the check box unchecked.

6. If not displayed OK, please let me know.

If you find that unchecking this box does not create any problems for some course which uses format_onetopic, please uncheck the box for all the instances.

Site Administration > Plugins > Plugins Overview > Onetopic_format Settings

Friday, January 10, 2025

plugin updates not prompted by Moodle

Noting the conversation with the developer of the format_onetopic Moodle plugin, https://github.com/davidherney/moodle-format_onetopic/issues/204

Today I've been notified of a new plugin update by Moodle, so changing the Maturity level (by the developer, from Beta to Mature) seems to have fixed the "not being notified by Moodle about new updates" issue.

free up disk space on Github runner

While building OpenSpace on a github action, the github runner was running out of disk space. Fortunately, there is an action to clear up disk space - 
    - name: Free Disk Space (Ubuntu)
      uses: jlumbroso/free-disk-space@main
      with:
        # this might remove tools that are actually needed,
        # if set to "true" but frees about 6 GB
        tool-cache: false
        
        # all of these default to true, but feel free to set to
        # "false" if necessary for your workflow
        android: true
        dotnet: true
        haskell: true
        large-packages: false
        docker-images: true
        swap-storage: false

Here, true means remove. Since we need some of the large packages and we do need the swap space, I set those to false, and that solved the problem.

Thursday, January 09, 2025

trying out ai video generation

 Inspired by

SSSHSS || Karunyamatanvate || Drama Trailer 2025 ||

Tried out via

ai generated video for free duckduckgo search

imagine.art

(not very good)


Same prompt, "big bang which started the universe evolving into millions of galaxies", gave a 4 minute + documentary with commentary but watermarked, using invideo.io

https://ai.invideo.io/watch/sCKIn5VJQDE

Uploaded to youtube and embedded below. Though what I wanted was a visualization of the Big Bang and this is not what I wanted, as a mediocre youtube video, this is OK.



Tuesday, January 07, 2025

errors in apache logs

Copy-pasting from an email - 

While checking the error log on the server for clues on the 'password reset' causing server errors, I found that there were thousands of errors being logged by various plugins and pages on the various Moodle installations.

Apparently there are some outdated plugins on the Moodle installation which did not get upgraded automatically. One example seems to be the onetopic format plugin. Manually updating it seems to have worked. But there are some more. One example is the "Edwiser Reports" plugin, which does not seem to be available any more, no Moodle 4.5 support available as far as I can see, and not updated since 2022.

Deleted this plugin from all our instances, to get rid of errors like this:

[Sat Jan 04 09:37:35.671230 2025] [php:notice] [pid 1416984] [client 11.22.33.34:26126] Debugging: Invalid $required parameter value: '' .\n                It must be either VALUE_DEFAULT, VALUE_REQUIRED, or VALUE_OPTIONAL in \n* line 53 of /lib/external/classes/external_description.php: call to debugging()\n* line 47 of /lib/external/classes/external_value.php: call to core_external\\external_description->__construct()\n* line 47 of /local/edwiserreports/classes/external/get_plugin_config.php: call to core_external\\external_value->__construct()\n* line ? of unknownfile: call to local_edwiserreports\\external\\api::get_plugin_config_parameters()\n* line 110 of /lib/external/classes/external_api.php: call to call_user_func()\n* line 186 of /lib/external/classes/external_api.php: call to core_external\\external_api::external_function_info()\n* line 83 of /lib/ajax/service.php: call to core_external\\external_api::call_external_function()\n, referer: https://oneofourservers.org/mod/hvp/view.php?id=20118

Monday, January 06, 2025

updating copyright year in Moodle footer

Wanted to check if we can use php to automatically change the copyright year in Moodle footer, using the Moove theme. For example,

https://natclark.com/tutorials/php-automatic-copyright-notice/

<?php echo date('Y'); ?>

But no, when we add this to the footer via the Moove theme's UI, the footer displays the code instead of allowing php to parse it. So, updated manually.

pillars of creation, Hubble or Webb deep field, 3d model

 Thought about doing a render of the "pillars of creation" in Blender or something like that, using some 3d model available online.

https://hubblesite.org/contents/media/videos/2024/020/01J0KSWQV7N2ZC4JEKE2Q0RCJ8

has the video and

https://hubblesite.org/contents/media/images/2024/020/01HZ7KZ85WKVG3H46A8B7GCEV8?app=true&news=true

has the 3d model, STL model for 3D printing

https://webbtelescope.org/contents/media/products/01HZ7M91P8DY5J5JFQJ28WQ72X

But then, found this "zoom in" video was quite nice, needn't spend too much time on Blender,

zoom into pillars of creation

https://www.youtube.com/watch?v=lj3t_gjuXWk

https://esahubble.org/videos/heic1501f/

UHD download.

---------------------------------------------------------------------------

Similarly, for Hubble Deep Field, Extreme Deep Field, etc - there are some resources online,

https://hubblesite.org/contents/media/videos/2012/37/718-Video.html?news=true

extreme deep field flythrough

(On the dome, the video provided by Lionel Ruiz looks nicer.)

There's a Blenderkit HDRI,

blenderkit james webb deep field hdri

https://www.blenderkit.com/asset-gallery-detail/6973dec9-f137-47da-9c5b-7bc9fa6780df/

Hubble ultra deep field animation in 3d

https://www.youtube.com/watch?v=oAVjF_7ensg

720p

(link to hubblesite in description is dead)

And HD download at

Across the Universe: The Hubble Ultra Deep Field

https://svs.gsfc.nasa.gov/30687