Sunday, May 04, 2025

script to run multiple commands on a remote server over ssh

 Made Chatgpt write the following script. The EOF syntax is useful. In our case, we need to put in the appropriate -pPORT also.

write a bash shell script to ssh into two servers server1 and server2 with ssh keys key1.pem and key2.pem, run sudo apt upgrade on both, and show the result on the terminal.

#!/bin/bash


# Define servers and keys

SERVER1="user1@server1"

KEY1="key1.pem"


SERVER2="user2@server2"

KEY2="key2.pem"


# Function to upgrade a server

upgrade_server() {

  local SERVER=$1

  local KEY=$2


  echo "Upgrading packages on $SERVER..."

  

  ssh -i "$KEY" -o StrictHostKeyChecking=no "$SERVER" << 'EOF'

    echo "Running apt update..."

    sudo apt update

    echo "Running apt upgrade..."

    sudo DEBIAN_FRONTEND=noninteractive apt upgrade -y

EOF

}


# Upgrade both servers

upgrade_server "$SERVER1" "$KEY1"

echo "---------------------------------------------"

upgrade_server "$SERVER2" "$KEY2"


Saturday, May 03, 2025

x86 Emulation on iPad with UTM

Continuing my earlier post about UTM - finally got JIT to work on iPad. Apparently I had been successful earlier also, but had thought that the QEMU error was due to JIT not being enabled. Going into settings (in the context menu of each VM, accessed by long-press) and trying to increase RAM, UTM gave the warning that the system had only 1700 MB of RAM left, of which 1300 or so was free, hence increasing the VM's RAM beyond this would cause crashes. Ubuntu 14.04 boots up in around 4 minutes. Unfortunately, maybe due to Ubuntu's behaviour when running on a display without acceleration, very slow to respond. Nearly a minute for keystrokes to appear on screen!

What I followed was this:

Installed AltStore via AltServer for Windows - https://faq.altstore.io/altstore-classic/how-to-install-altstore-windows

Installed StikJIT & StosVPN via AltStore - StikJIT user manual

Copied over the pairing file created as per the user manual above, using iCloud Drive (Installed that also on the Windows machine.)

Then, the procedure is - 
  • Swipe up from down and hold, to show all applications - swipe up applications which you want to close and start again with JIT, like UTM.
  • Start StosVPN, click to start the connection
  • Start StikJIT - one-time requirement of passing on the path to the pairing file, then
  • Click Enable JIT - a few moments later, it prompts for which app to enable JIT for, from a list of apps - choose UTM, and then UTM opens up with JIT enabled. Can start up JMs at this point. 
But as mentioned in the first paragraph of this post, we need to choose those VM images (or create such VMs) which can work with 512 MB or 768 MB of RAM on this 9th gen iPad, since it has limited free RAM. Perhaps trying Raspberry Pi might be a good option.

Wednesday, April 30, 2025

development for Android / iOS - preliminaries

Seeing that the mobile devices were quite competitive with the desktop's processing power in a previous post, thought about working on porting various tools like OCVWarp to Android and iOS if feasible.

OpenCV Android - had earlier cloned / forked NDK samples.

The binaries are available here 
only up to OpenCV v3.4.3, but iOS framework seems to be available at
and

To check if swift playgrounds is available on 9th gen ipad - https://www.theverge.com/2021/6/15/22534902/ipad-pro-apple-swift-playgrounds-4-wwdc-2021

To check if example opencv apps can run on ipad.

Monday, April 28, 2025

simple logger created by chatgpt

I wanted to make a simple load-average logger. Thought of making ChatGPT do the typing, instead of me creating the simple code.

The result was quite OK.


The prompts and conversation are in the issues tab.

moving Virtualbox VMs to external drive

VirtualBox Manager
> Right-click on the VM
> Select "Move"
> Choose the new location and click "Move"

(Tho' the progress bar doesn't seem to work, it moved the VM and associated files to the external drive in approx the usual time it would take for a 12 GB file move.)

Sunday, April 27, 2025

Google's "free to try" AI Studio

Google AI Studio has image generation, video generation and more, in addition to text chat. But even Google's Gemini does not know this:) 

Unless we enable "auto-save" in the settings (I guess) our prompts are not saved in History.

Choosing the model Gemini2.0 Flash (image generation)
"Create an image of a sunset over a sandy beach" - result is below.


Not bad.

By clicking the Video generation tab, Veo 2 generated the following videos on the respective prompts. Not very good, but it's a good start. And the best part is that it's free. And it took less than a minute to generate.

"Create a video of overcast clouds over sunset on a sandy beach" - resulted in a timelapse-style video below:


"Generate a 360 degree equirectangular video of sunset over a beach" resulted in:

Since this was not really an equirectangular 360 degree video, tried by running the same prompt again. Then it gave:

 Refining my prompt, changed it to "Generate a VR360 equirectangular video of sunset over a beach" which resulted in this:

I didn't want any human beings or birds in the video, so I tried adding a negative prompt of birds, men, women - and the same prompt as above. But the result still had this woman,

All right. Maybe it will do better when given an image to work with. So, I uploaded the sunset image earlier generated with Gemini 2.0 Flash, and gave the prompt "Generate a VR360 equirectangular video from this image by panning left to right."
But it did not pan, instead added birds!

In summary, a long way to go. But since it's fast and free (the video generation did not specify any queries per day limits, but the Gemini models did specify 1500 requests per day and so on in the free tier), we can definitely try out some stuff. And perhaps upscale locally or with google colab. 







Geekbench scores - Android phone, iPad, laptop, desktop, Raspberry Pi

Thought of doing some benchmarks to rate the performance of the various devices to which I have access. Samsung Galaxy M34 Android phone, Raspberry Pi 4 8 GB without cooling fan, i5-4430 processor desktop with GTX 1050 graphics card, i5-1235U processor laptop with Intel graphics, 9th gen iPad.

https://www.geekbench.com/download/

Higher scores are better.

Example benchmarks also linked in the page above.

CPU single-core / multi-core - the Android phone was surprisingly close to the desktop. The iPad crashed this test, so I've not added it in the lineup below. The pi overheated without the cooling fan, hence it gave a worse multi-core performance than could be possible with better cooling.

Pi4 (292/519) < M34 (960/2072) < Desktop (1062/2813) < Laptop (2131/7460)

GPU OpenCL / Vulkan - the Pi4 gave an error, unknown CL platform, so it is not listed below. But the Pi5 seems to have a rating of only 96! And the iPad perhaps outperformed the Laptop.

M34 (2306/2339) < Laptop (11723/15237) < iPad (13914 (Metal)) < Desktop (22555/NA)

Conclusion - The Raspberry Pi 4 did much worse than I expected, and the mobile devices - the phone and the iPad - did better than I expected. 


Wednesday, April 23, 2025

airtel's horrendous "AI" customer service

I was trying to recharge another prepaid Airtel number with "international roaming plan 2997" for 365 day validity.

Tried with Airtel thanks app from my Airtel mobile - failed.

Tried from website - failed.

Tried calling customer care - they said try going to a shop.

Tried from shop - failed.

Tried sending them an email to 121@in.airtel.com - "We noticed that you're contacting us from an email ID that isn't linked to your Airtel account. 

You shall write back to us from your registered ID or reach out to airtel thanksapp get instant support 24x7 right from the help and support section."

The help and support section is a chatbot. There didn't seem to be any option to contact a human being. 

Finally, I thought maybe trying from the Airtel app on the actual prepaid account for which Intl. Roaming was needed - success. Edit - half an hour later, that transaction was reversed, too!  

Airtel's own customer service people did not know this, the shop guys (tried two different shops) did not know this, it is not mentioned anywhere that these intl. roaming plans need to be bought from the phone which is actually going to roam! 

UTM for OpenSpace on iOS / MacOS

Found on https://getutm.app/faq/#what-are-the-limitations
"The lack of hardware virtualization on Apple A-chips means that even for ARM code we must re-compile it with JIT. Therefore performance would never reach the levels possible with KVM. There is also no support for GPU virtualization so that means no DirectX or OpenGL. This makes most modern games non-playable." So, OpenSpace is most probably not suitable to run via UTM on iPad / iOS.


"UTM does not currently support GPU emulation/virtualization on Windows and therefore lacks support for 3D acceleration (e.g. OpenGL and DirectX). You may be able to run older games with software rendering options, but nothing with hardware acceleration. There is experimental support for hardware OpenGL acceleration on Linux through Virgl."
So, OpenSpace on Ubuntu might be doable - at least with performance similar to a Windows box without NVidia graphics - on a Mac with UTM.

---------------------------
Details of what didn't work

Found the limitations the hard way, trying for many hours on the (9th gen) iPad (since I don't have access to a Mac at the moment). 
UTM SE - with no JIT - took half an hour or more to boot Ubuntu 14.04 (that's not a typo, it really was the old version 14.04)

Trying to enable JIT - 

Directly on AltStore - need a Hackintosh or Mac for it? - https://github.com/altstoreio/AltStore/issues/1349

says use stikJIT - https://stikdebug.xyz/


Apparently enabling JIT is a one-time installation - https://faq.altstore.io/altstore-classic/enabling-jit

We can't use Altstore PAL since we're not in the EU - tried and failed.

To install a downloaded ipa, go to Altstore > My apps (at the bottom), and click the + on the top. The ipa should be visible. 

(if ipa is not visible, we may need to navigate using the files app, and "open with" Altstore.
Then, it asks for apple creds.)

Transferred the pairing file using icloud drive.

Long press on UTM, then "enable jit", then try to open the vm, then
error trying to connect to spice server.

If StosVPN is turned off, then AltJIT not found, can't run VMs without JIT.

FAILED TO CONNECT TO SPICE

To force quit, 
swipe up and hold to open app switcher, then swipe up on the app to force-quit it.

Jitstreamer EB on Debian guide is here,

To try - minimal Ubuntu or something like that without 3d acceleration, which may not need spice.

debian 11 ARM64 lxde with spicetools installed, from gallery.

It was a zip file. Open in Downloads > unzipped. Long press and open in UTM.

But same error, QEMU exited no error message.

UTM also says Virtualization is not supported on your device.
So we can only use Emulate.

Still, same error. Then, I tried UTM SE, which took half an hour to boot the old version of Ubuntu as noted at the top of this post.