Save and Restore Window State in iTerm2

To save and restore window state in iTerm2 under macOS Sonoma, follow the below steps.

1. Disable Close windows when quitting an application option from System Preference > Desktop & Dock under macOS Sonoma.

2. In iTerm2 > Settings > General > Start up, choose Window restoration policy: Use System Window Restoration Setting.

3. In iTerm2 > Window > Save Window Arrangement and specify a name.

4. After launching iTerm2 and to open this arrangement in the current window use Window > Restore Window Arrangement and choose the name.

5. To restore the window arrangement as new tab, use Window > Restore Window Arrangement as Tabs.

XCFramework build script

An XCFramework bundle, or artifact, is a binary package created by Xcode that includes the frameworks and libraries necessary to build for multiple platforms (iOS, macOS, visionOS, tvOS, watchOS, and DriverKit), including Simulator builds. The frameworks can be static or dynamic and also include headers.

Wrote a build script that will generate xcframework with code signing for iOS and macOS including simulator and macOS Catalyst. I wanted to create reusable libraries as frameworks that supports both iOS and macOS and it took some time to get the whole setup to work properly.

The generated framework can be added to any Xcode project like usual, from the Frameworks and Libraries section in Xcode. These will show up with blue color instead of yellow.


Note that the current build script also includes macOS catalyst and for the build to work, we must have macOS Catalyst added under “Supported Destinations” for the framework under Xcode. Else remove macos_catalyst_props from destinations array.

To build for both macOS Intel and ARM, make sure the Architectures section has the below values. This will also build iOS bundle. (This is optional now as I have included sdk flag during build).

Architectures: $(ARCHS_STANDARD)
Base SDK: macOS
Build Active Architectures Only
  Debug: Yes
  Release: No
Supported Platforms: iOS macOS

Base SDK can be Automatic as well.

The final bundle will have the following slices.

$ ls Frameworks/OBLogger.xcframework/
Info.plist
_CodeSignature
ios-arm64
ios-arm64_x86_64-maccatalyst
ios-arm64_x86_64-simulator
macos-arm64_x86_64

Using Charles Proxy to Intercept API Calls on Android

I have BSNL FTTH connection, and I am unable to check data usage using their website. There is no working iOS app also. The app that works is on Android called BSNL FFTH Usage. I tried a few similar Android apps but found this one working. Having to depend on this app all the time just to check network usage is a bit inconvenient. So, I thought of analyzing the API call made by that app. Checked connecting it with Android Studio with Network view, but it does not show any data because it shows only for app that’s under debugging. So got Charles Proxy installed. The devices must be connected to the BSNL network to check the usage as there is no additional authentication to get the data.
1. In Charles, under Proxy > SSL Proxying Settings add *.* for Location under the Include section.

2. Connect Android phone to the same WiFi network as the mac. Then on Android phone go to WiFi Settings, select the settings for the WiFi connection. Under Proxy select Manual and enter Hostname as the IP address of the mac. To find the IP address of the mac Option click on the WiFi icon on the menu bar. Mine is 192.168.1.6. For Port use 8888 which is the default port Charles Proxy is listening on and tap Save. Then open browser on Android and load any website. On mac, a popup will be displayed asking to allow the proxying. Click Allow.
3. Next go to http://charlesproxy.com/getssl on Android which will download the SSL certificate to the file system.
4. Go to Settings > Security and privacy > More security settings. Under Credential storage, tap Install from device storage and select the downloaded SSL certificate to install. Once done with the below steps, remember to turn of the Proxy option to none and save.
5. Now clear the Charles Proxy session and launch the BSNL FFTH Usage app. All network calls made by the app will be displayed in the Charles Proxy. Simple as that.

Here we can see that a POST call is made to the address https://selfcarebbportal.bsnl.co.in/portal/fetchUserQuotaPM.do and this returns the usage details as JSON response.

Below is the cURL code.

% curl --request POST 'https://selfcarebbportal.bsnl.co.in/portal/fetchUserQuotaPM.do' | jq

Piping to jq is optional. This will pretty print the JSON.

Moved away from Blogger

After using Blogger for more than 15 years, I moved away from Blogger. My main issue is that Google Search bot is not indexing Blogger. With 346 posts right now it indexed only 22. It’s close to a year that I added back the current domain for this blog and it’s still not indexed. It used to get indexed a few years ago. I made the blog private for a while and now it’s not indexing citing it will overload the server. The Google Search Console shows Crawled – currently not indexed and Discovered – currently not indexed.

The page was found by Google, but not crawled yet. Typically, Google wanted to crawl the URL but this was expected to overload the site; therefore Google rescheduled the crawl. This is why the last crawl date is empty on the report.

This means the crawling is going to make Blogger overloaded, so crawl is not performed. So, there is no much point in keep using Blogger. I had sent support requests to sc-tools-support@google.com, but got no response. Asked at Search Console Help Community but it did not help. Bing, DuckDuckGo are indexing posts just fine.

Let’s see how WordPress goes. The reason I choose WordPress was because I need to have the migration done quickly. I tried using Cryogen, Hexo and Jekyll static site generators but all failed to convert the Blogger XML.

Update on Sat 02 March 2024
After moving away from Blogger, the “Discovered – currently not indexed” error went away. It showed 0. But the “Crawled – currently not indexed” was not resolved. Later I deleted the Google Web Console property altogether and created a new property in another account. After a few days I don’t have any crawl or indexing errors. Some old pages show redirect and 404 errors. Pages are still not indexed. I think it will take some time.

API Tester Pro v2.0 Released

API Tester Pro v2.0 is released to the iOS App Store. This release brings major changes to data storage. It includes iCloud syncing per workspace. Also allows to keep workspaces locally on device with seamless switching between iCloud or local workspaces. The changes and improvements in this release are listed below.

• Enable iCloud syncing when creating a new workspace. If syncing is disabled workspace will be created on device only.
• Seamless switching between local and iCloud workspaces
• Response details screen UI enhancements
• Added option to copy response details table values on long press

Script to Copy MP3 ID3 Metadata Between Folders

I wrote a Python script to copy mp3 ID3 metadata from all files in the source folder to the corresponding file in the destination folder. I have lots of old mp3 files which are of low bit rate and I have new files with higher bit rate. The newer files don’t have metadata information. For the old files I had added them manually along with album art. It would be painstakingly time-consuming to manually add them again. This script automates that process. The script is available from the GitHub mp3-copy-id3-metadata repository.