Wednesday, December 3, 2025

Debian 13: bash script to show nvme/ssd healthy and cpu temperature

Requirement

  1. smartmontools
  2. lm-sensors
  3. psensor 

Installation

# apt-get install smartmontools lm-sensors psensor

copy paste this script to show general temperature on nvme/ssd and cpu. It also give information about nvme/ssd healthy.

#!/bin/bash
# this code generated by chatgpt.com no sign in
# each step was interactive, output from pc will be feed to chatgpt to generate correct output

DRIVE=${1:-/dev/sda}

echo "=== SMART Drive Information ($DRIVE) ==="

sudo smartctl -H -A "$DRIVE" | awk '
/^SMART overall-health/      {print "Drive Health: " $NF}
/^194 Temperature_Celsius/   {print "Drive Temperature: " $10 "°C"}
/^190 Airflow_Temperature/   {print "Drive Temperature: " $10 "°C"}
'

echo
echo "=== CPU Temperature ==="
sensors | awk '
/k10temp/ {found=1}
/temp1:/ && found {print "CPU Temp:", $2; found=0}
'

echo
echo "=== GPU Temperature (AMDGPU) ==="
sensors | awk '
/amdgpu/ {found=1}
/edge:/ && found {print "GPU Temp:", $2; found=0}
'

echo
echo "=== ACPI Temperatures ==="
sensors | awk '
/acpitz/ {block=1}
/temp/ && block {print "ACPI " $1, $2}
/^\s*$/ {block=0}
'

Change permission

# chmod u+x ./checkme.sh

Run as sudo or root 

Tuesday, December 2, 2025

Android java: Releasing resource Activity/Fragment <-> AndroidViewModel <-> MyController

Activity/Fragment <-> AndroidViewModel <-> MyController

MyController will hold

  1. Executor
  2. MediaController 
  3. Network access
  4. Database access
  5. Application context for above operation  

Proper way to clear the resource

  1. Executor
            // MyAndroidViewModel onClear() has been reached
            if (myExecutor!=null) {
                myExecutor.shutdown();
                myExecutor = null;
            }
  2. Media Controller
            if (myMediaController!=null) {
                myMediaController.releaseMediaSession(); // MUST BE CLEAR
                myMediaController = null;
            }
  3. Network access
            myGetRadioLogo=null;
  4. Database access  
            myDBAccess=null;
  5. Application context
            appContext=null; // MUST SET NULL AT ONCLEAR

Fail to release these resources may lead to memory leak

Fail to release resource with not properly sequence may lead application crashed, this crash can be found on logcat.  

Debian 13: part 3 participate your vps, cofigure your vps as tor relay/exit

There 2 type of TOR network you an configure on VPS

  1. Relay
  2. Exit

Minimum system requirement:

  1. CPU 1 vcpu
  2. Ram 512MB (1GB Recommended)
  3. Bandwidth 10 Mbps in & out
  4. Traffic 100 GB in & out
  5. Disk 200 MB 
  6. swap not mention (better twice RAM size) 

Enable Debian 13 auto upgrade

# apt install unattended-upgrades
# systemctl enable unattended-upgrades
# systemctl start unattended-upgrades

Installing tor packages and key

  1. Install require software
    # apt install apt-transport-https gnupg
  2. Create /etc/apt/sources.list.d/tor.list with:
    deb     [signed-by=/usr/share/keyrings/deb.torproject.org-keyring.gpg] https://deb.torproject.org/torproject.org trixiemain
    deb-src [signed-by=/usr/share/keyrings/deb.torproject.org-keyring.gpg] https://deb.torproject.org/torproject.org trixie main
  3. installing key and tor
    # wget -qO- https://deb.torproject.org/torproject.org/A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89.asc | gpg --dearmor | tee /usr/share/keyrings/deb.torproject.org-keyring.gpg >/dev/null
    # apt install tor deb.torproject.org-keyring
    # apt install tor

Note: you can browse using browser https://deb.torproject.org/torproject.org/ if A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89.asc has change 

TOR relay 

TOR relay consider safer way to contribute to TOR network, It does not act as critical point entry or exit network. 

configure your tor relay /etc/tor/torrc:

Nickname    myNiceRelay  # Change "myNiceRelay" to something you like
ContactInfo your@e-mail  # Write your e-mail and be aware it will be published
ORPort      443          # You might use a different port, should you want to
ExitRelay   0
SocksPort   0 

Enable and restart tor service

# systemctl enable tor
# systemctl restart tor

TOR Exit

Exit TOR may have high security risk including breaking law. you need to carefully decide your county's rules where your vps located. Some country has aware with Exit TOR node.  

install unbound dns resolver

  1. install unbound
    # apt install unbound
  2. configure dns resolver using localhost
    # cp /etc/resolv.conf /etc/resolv.conf.backup
    # echo nameserver 127.0.0.1 > /etc/resolv.conf
  3. protect resolver from change
    # chattr +i /etc/resolv.conf
  4. edit unbound configuration
    server:    ...
        qname-minimisation: yes
        ...
  5. enable and restart unbound
    # systemctl enable unbound
    # systemctl restart unbound

Definitely do not use torproject.org as a domain name for your reverse DNS

configure your tor relay /etc/tor/torrc:

Nickname    myNiceRelay  # Change "myNiceRelay" to something you like
ContactInfo your@e-mail  # Write your e-mail and be aware it will be published
ORPort      443          # You might use a different port, should you want to
ExitRelay   1            # it is exit relay
SocksPort   0 

Enable and restart tor service

# systemctl enable tor
# systemctl restart tor

Wait until tor network recognize your node.

Done, now you are on track to run vps as tor volunteer.

Windows 11: installing windows 11 and post configuration part 2

Copy your windows iso into Ventoy USB data partition, not in boot partition. you can create folder windows and put iso file in this directory. Ventoy boot manager will find any bootable iso file in Ventoy data partition. see here to create Ventoy USB boot manager https://dedetoknotes.blogspot.com/2025/09/debian-13-using-ventoy-to-create.html

Before you starting to. install in computer/laptop, in my case axioo Hype 5 x6, download wifi driver, it does not have Ethernet port. if you have Ethernet port, download it. if those driver are zip, extract it, and put in Ventoy data directory. e.g. after you extract file in directory wifi, copy directory wifi into Ventoy data -> driver (optional you need to create). 

To start installing windows 11, insert Ventoy USB that has been prepared before and turn your laptop/pc on. it will show which iso you want to run. 

Note: you need to change UEFI boot order if you use used nvme contains working os!

installation windows is straight forward. if you use iso windows 11 24h2 or after, you need outlook account or Hotmail if you come from generation like me ☺️. when it reach internet connection, install driver that has been provided in Ventoy USB data.

if you use windows 11 iso 23h2 or before, you can bypass it by pressing shift+f10 when windows ask internet connection and run:

OOBE\BYPASSNRO

after you enter that command, it will reboot/restart. now you can choose no connection internet and create local account. 

after finish, login into windows, go to system, update and check additional update to update hardware driver. update all driver, include printer you want to use. 

if you need software/driver for printer and scanner, find it in windows store and install it. for HP printer inktank multi function, you need to update windows driver. windows said it is optional, but in my opinion it is bridge between system and HP Smart from windows store.

Tweak your windows post installation (optional)

Turning off fast boot 

turn off fast boot if you want to dual boot later. if it is turn on, windows will never unmount driver/partition they use. any files and folder created from second os will be thread as not valid. it will setback to position when windows shutdown. turn off fast boot will completely unmount any drive/partition.

I usually prefer for performance, go to control panel -> system -> advanced system settings or run sysdm.cpl. select performance.

Set fix windows virtual memory

I also use fix windows Virtual Memory / swap. from sysdm.cpl, select Virtual Memory Settings.

select custom size. if your memory less then 16GB, the value is equal twice of your physical ram. e.g physical ram 8GB, use 8GB, if ram 4GB use 8GB. if you use 16 or above, put this value 4GB. set minimum and maximum with the same value e.g 4GB in my case axioo Hype 5 x6 with ram ddr5 2x8GB.

note: there is performance penalty when you windows run out of physical ram and use swap into virtual memory, i.e your nvme. event it is fast as close to pci speed, it will slower due to overhead swap ram to disk vice versa and also reduce your nvme life! when you need bigger memory, do upgrade instead of make virtual memory bigger.

Monitor your NVME

install CrystalDiskInfo to monitor NVME, don't let run your nvme run on high temperatur for long time wihtout proper heat sink or cooling system, especially of laptop. In my option running nvme on 70°C or above on a long time may damage your nvme's chips.

Using windows encryption (bitlocker) on nvme may arise higher activity and increase temperature. if it is not urgent, don't use it.  when it bitlocker turning on or turning off, it will start encrypt or decrypt your entire harddisk. in Task manager it will show 100% harddisk utilization and at CrystalDiskInfo the temperature may arise

Adding Local Account 

for windows with link account to outlook or Hotmail, here is how you create local account.

  1. run cmd as administor 
  2. command to create local user
    > net user myname mypassword /add
  3. to set user myname as administor 
    > net localgroup administrators myname /add
  4. to verify user 
    > net user
  5. sign out and try sign in with local account.

note; you can remove account linked to outlook or Hotmail using local administrator user created before. 











Wednesday, November 26, 2025

Windows 11: clean install preparation part 1

This is documentation when I need to reinstall windows 11, because of nvme damage (overheat). It is Axioo 5 hype X6 with Ryzen 6600h. It has windows 11 installed, and this laptop does have ethernet port. 

Download ISO should I download

  1. 25h2: shift+f10 keyboard input has been disabled (download from archive.org/)
  2. 24h2: shift+f10 keyboard input has been disabled (download from archive.org/)

I did not try 23h2 version, it will take more time to install and laptop must be ready for studying.

During installation shift+f10 will bypass network configuration, you have to run

oobe\bypassnro

after terminal. it will restart installation.  

If you want to use 25h2 and 24h2, download the driver from laptop provider website. in my case download from driver.axiooworld.com, just network driver, others can be installed at the end of windows 11 installation. If you want to use only Windows skip step below, and go to part 2 installation windows.

This below instruction uses other pc/laptop to prepare nvme disk. 

Optional but recommended for dual OS, create EFI System partition (ESP) for new nvme, the minimum size is 500MB. this is step on debian using gparted.

Put a nvme, into nvme ssd/nvme external usb, and connect it your laptop.

Check your nvme

# dmesg
...
[  262.395926] scsi 0:0:0:0: Direct-Access     ADATA LE GEND 710         0213 PQ: 0 ANSI: 6
[  262.397870] sd 0:0:0:0: Attached scsi generic sg0 type 0
[  262.398189] sd 0:0:0:0: [sda] 500118192 512-byte logical blocks: (256 GB/238 GiB)
...
# lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda           8:0    0 238.5G  0 disk 
# fdisk -l
...
Disk /dev/sda: 238.47 GiB, 256060514304 bytes, 500118192 sectors
Disk model: GEND 710        
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

this is mount point /dev/sda.

I use this schema

  1. 500 MB ESP (FAT32 Flag boot and esp)
  2. 120 GB Windows system (NTFS)
  3. 30 GB Data Windows (NTFS
  4. 80 GB Debian / (ext4)
  5. 4 GB swap (swap)

 To use GParted to create partition on nvme (Be careful not select wrong disk)

  1. Open GParted
  2. Select Gparted -> devices -> /dev/sda, If it a new device (never use), you need to create parititon table, Device -> Create partition table, choose 'gpt'
  3. select unallocated space, and create EFI System Partition (ESP) for boot loader
        File System: FAT32
        Size: At least 300 MiB (recommended 500 MiB for future needs)
        Label: Optional, but you can name it "EFI". 
  4. Apply all operation 
  5. Now you can manage flag for ESP, select partition EFI,right click -> Manage Flags -> check 'boot' and 'esp' 

Note: if you try to create new partition in brand new nvme (never used), it will reported No Partition table found, it is really a new device.

Just, to create the partition, the Adata legend 710 heat sink feel a bit warmer.

You can not download windows 11 multi iso from windows https://www.microsoft.com/en-us/software-download/windows11. You can continue with windows 11 installation, it will put boot loader in EFI system partition (ESP) and next you want to install Debian.