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

Friday, January 03, 2025

Going around Mount Fuji

More fulldome videos made with OpenSpace - details as in my previous post. Inspired by the Digital Earth Volcanos video - https://www.youtube.com/watch?v=HEIE8V2sbFE&t=2354s


Needed to use the ESRI Wayback 2020 images to get a view of snow-capped Fuji - https://github.com/OpenSpace/OpenSpace/tree/master/data/assets/scene/solarsystem/planets/earth/layers/colorlayers/esri_world_imagery_wayback - these images load very slowly for me, unlike ESRI hosted image tiles.

The 4K (4096x4096) full resolution videos are available from archive.org - 
https://archive.org/details/fuji-side
https://archive.org/details/zoom-in-to-fuji-nvenchevc







nvidia accelerated video encoding with ffmpeg

Following this page,

https://docs.nvidia.com/video-technologies/video-codec-sdk/12.0/ffmpeg-with-nvidia-gpu/index.html

the following encoding went at around 21 fps with the NVidia 1060 graphics card - 

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

Using h265_nvenc gave codec not found error, but hevc_nvenc worked. That went at around 23 fps. Without acceleration, when using the "lossless" parameter, it was taking several seconds per frame. 0.2 fps or so.

Edit - apparently full hardware transcode with NVDEC and NVENC:

ffmpeg -hwaccel cuda -hwaccel_output_format cuda -i input.mp4 -c:v h264_nvenc -preset slow output.mp4

But apparently lower quality - https://stackoverflow.com/questions/44510765/gpu-accelerated-video-processing-with-ffmpeg