May 16, 2023

Mobile first css media queries

Mobile first css media queries to adjust UI controls for various resolutions:
@media (min-width:320px) { /* smartphones, portrait iPhone, portrait 480x320 phones (Android) */ }
@media (min-width:480px) { /* smartphones, Android phones, landscape iPhone */ }
@media (min-width:600px) { /* portrait tablets, portrait iPad, e-readers (Nook/Kindle), landscape 800x480 phones (Android) */ }
@media (min-width:801px) { /* tablet, landscape iPad, lo-res laptops ands desktops */ }
@media (min-width:1025px) { /* big landscape tablets, laptops, and desktops */ }
@media (min-width:1281px) { /* hi-res laptops and desktops */ }

May 2, 2023

Installing .NET on Android

This runs .NET natively
not in a vm
not in a container
no need to have root access or jailbreaking your android
.NET runs natively on android in user space

Install Termux apk on android
pkg install proot
pkg install proot-distro
proot-distro allows to install linux which runs along with android os. This is not a vm so we get native performance.

proot-distro commands:
    proot-distro list - show the supported distributions and their status.
    proot-distro install - install a distribution.
    proot-distro login - start a root shell for the distribution.
    proot-distro remove - uninstall the distribution.
    proot-distro reset - reinstall the distribution.

Following linux flavours are supported:
  1. Alpine Linux (edge)
  2. Arch Linux / Arch Linux 32 / Arch Linux ARM
  3. Debian (stable)
  4. Fedora 35
  5. Manjaro AArch64
  6. OpenSUSE (Tumbleweed)
  7. Ubuntu (22.04)
  8. Void Linux

Following are the steps for Ubuntu
proot-distro install ubuntu
proot-distro login ubuntu
apt install wget -y
apt install ssh -y
apt-get install -y net-tools

Manual installation of .NET:
wget -O
cd ~/.dotnet
echo 'export DOTNET_ROOT=$HOME/.dotnet' >> ~/.bashrc
echo 'export PATH=$PATH:$DOTNET_ROOT:$DOTNET_ROOT/tools' >> ~/.bashrc
source ~/.bashrc
Now the dotnet CLI can be used, more on this:

Detailed video coming soon

1. You can install cloudflared (Cloudflare zero trust) and then can host site on your android device
2. Run FTP server
3. Share the files without uploading anywhere

Mar 2, 2023

Amplifieing analog audio output from 3.5mm audio jack with PAM8403 amplifier


In this post we will develop an amplifier which amplifies 3.5mm analog audio output, You can use the circuit as a speaker for PC.


Required Electronic Components:
1. PAM8403 Class D 3W amplifier
2. 3.3V 5.5V FT232RL FTDI USB to TTL Serial Adapter Module
3. 5V 3A USB power supply
4. USB Cable, A-Male to Mini-B Cord USB cable
5. 3W Speaker
6. Jumper Wires
7. AUX Cable

Detailed video here:

Feb 27, 2023

C#: Convert any time to time in any timezone

You can use this to convert any server time to india time or any other time zone
here's possible list of all zone IDs which can be used in this method:

First add reference to NodaTime nuget package which is built by the ultimate Jon Skeet

Pun intended
1. Jon Skeet can divide by zero.
2. When Jon Skeet's code fails to compile the compiler apologises.
3. If Jon-Skeet's program fails to compile they fix the compiler.
4. Jon Skeet coded his last project entirely in Microsoft Paint, just for the challenge.
5. Jon Skeet keeps a daily backup of the Internet on his USB pendrive.

Jon Skeet handles all my exceptions
catch(Exception ex)

here's the method
public DateTime ConvertToTimeZoneFromUtc(DateTime utcDateTime, string timezone)
    var easternTimeZone = DateTimeZoneProviders.Tzdb[timezone];
    return Instant.FromDateTimeUtc(utcDateTime)

string zoneID = "Asia/Kolkata";
var date = ConvertToTimeZoneFromUtc(DateTime.Now.ToUniversalTime(), zoneID);

SkeetOverflow link:

Jan 28, 2023

Lifetime unlimited money through manual SWP in mutual funds

The ₹1 lac example:

  1. Invest a lump sum in multiple high performing equity mutual fund e.g. ₹1lac
  2. Wait for 1+ year - yea! Let it grow for sometime
  3. Withdraw ₹1k per month on a fixed date (to minimize loss: withdraw only if mutual fund returns are greater than or equal to 13%)

More realistic example

Suppose you have ₹1k society maintainance bill:

Real-Time excel calculations

With initial investment of ₹1,00,000
Here you can see I have withdrawed ₹1,64,759 in 10 years
and still ₹87,361 is remaining in the account
If you keep withdrawing infinitely still money remains in the account
Download Withdrawl plan


  1. mutual funds are subject to market risks, market down huwa to samjho paisa gaya
  2. works well if you choose the right mutual fund and start SWP after one year.
  3. Most trading/mutual fund platforms do not allow auto SWP of mutual funds, here's BSE circular Hence manual SWP needs to be done.
  4. its just a theory, try at your own risk

Oct 31, 2022

Arduino for Beginners: IoT basics


In this article we will have high level overview of Arduino, its parts, sensors and how we can use it with Internet of Things aka IoT sensors. I will take you step by step in creating your first simple Arduino project and reading data from IoT temperature sensor.


Arduino is open source programmable circuit board which you can use for creating electronic hardware. This board contains a microcontroller which can be programmed to sense and control the electronic components.

Following image depicts one of the most popular Arduino boards “Arduino UNO” and its components on the board:

1.     Microcontroller: This is the brain of the Arduino where the programs are stored, on UNO board the microcontroller is based on ATmega328P integrated circuit(IC).

2.     USB Port: The USB port can be used to powering up the board and also to connect to PC and flash programs on the board

3.     USB to Serial chip

4.     Digital Pins: Pins 0-13 can be used for digital input or output

5.     Analog Pins: These pins can read the signal from an analog sensor and convert it to digital

6.     5v, 3.3v out Pin: This pin supplies 5/3.3 volts of power to your electronic sensors and circuits

7.     GND Pin: This pin is used to allow the flow of leakage and fault current. Sudden rise in flow current will damage the equipment, hence it is a protection.

Breadboard: The breadboard allows you to create temporary prototypes and experiment with different circuit designs without permanently soldering the circuit together.


Jumper Wires: The electronic components are connected to each other using Jumper wires, electricity flows through these jumper cables, Jumper wires are of three types- Male to Male, Male to Female and Female to Female

LED: Light Emitting Diode, an LED can emit any color depending on its make, following LED emits blue light.

Resistor: Resistors resist the flow of electricity and the higher the value of the resistor, the more it resists, and the less electrical current will flow through it.

Your first Arduino Sketch

We can program the Arduino using C/C++ language, the programs in Arduino are called as Sketch, the sketches are saved as “.ino” extension. To write the programs we need to download the Arduino IDE which is available at

A minimal Arduino sketch consists of only two functions:

1. setup(): This function is called once when a sketch starts after power-up or reset. It is used to initialize variables, input and output pin modes, and other libraries needed in the sketch. It is analogous to the function main().

2. loop(): After setup() function exits (ends), the loop() function is executed repeatedly in the main program. It controls the board until the board is powered off or is reset. It is analogous to the function while(1).


Pin Connections

The above sketch turns the LED on and off each 1 second interval.


A sensor, in simple terms, is used to sense its environment, meaning it records a physical parameter, for example temperature, and converts it into an electronic signal.

In this article we will use the temperature sensor.

LM35 is a classic Analog Temperature Sensor. LM35 has 3 pins: VCC, Data and GND.

Place the LM35 anywhere horizontally on your breadboard, the flat side of the sensor must be facing you. Then, connect three wires under the three pins of the sensor.

The wire on the left will go to the 5v pin on the Arduino.

The middle wire will go to A1 (analog pin 1).

The wire on the right will go to GND (-) on the Arduino.


Upload below sketch to Arduino.


You can see the program output in the Arduino serial monitor console


1.     Temperature sensor Arduino project

2.     Uploading Arduino sketch

3.     Buy electronic components and sensors

4.     Arduino Wikipedia

5.     Arduino IDE

6.     Arduino starter kit

7.     Make Electronics book pdf