Thursday, October 16, 2025

How to create apache2 alias myapp to directing to user myuser under directory /home/myuser/public

Note: FOR DEVELOPMENT NOT PRODUCTION!

Use root or sudo for sign with #

Use user myuser for sign $

Enable alias module

# a2enmod

Edit /etc/apache2/sites-available/000-default.conf

....
/etc/apache2/sites-available/000-default.conf
    Alias "/myapp" "/home/myuser/public"
    <Directory "/home/myuser/public">
        Options Indexes FollowSymLinks MultiVIews
        AllowOverride None
        Require all granted
    </Directory>
</VirtualHost>

Create directory public

$ mkdir public

Change the group ownership 

# chown -R myuser:www-data /home/myuser/public

Give the www-data group read and execute permissions. 

# chmod -R g+rx /home/myuser/public

Adjust the permissions for the home directory itself (not recommended for production, use ACL)

# chmod a+x /home/myuser

Test configuration

# apache2ctl configtest
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
Syntax OK

Restart service

# systemctl reload apache2

Open in your browser http://localhost/myapp 

Tuesday, October 14, 2025

Android Studio 2024.1.4: backup and how you migrate your old project

Android Studio move so fast, the developer and ide tools are racing each other.

These are must you backup: 

  1. Project name
  2. Your key file i.e jks for your project
  3. your project source
    1. <root_app> remove folders .gradle .idea and build, remove file .gitignore
    2. <root_app>/app remove folders build, libs and release, remove file .gitignore
    3. <root_app>/gradle remove file ./gradle/wrapper/gradle-wrapper.jar

For upgrading from old project, and your project does not have libs.versions.toml file:

  1. Create it (see below) or copy from other project <root_app>/gradle/libs.versions.toml.
  2. change build.gradle.kts (:app)
    plugins {
        id("com.android.application")
    }
    into 
    plugins {
        alias(libs.plugins.android.application)
    }
    Change dependency 
    dependencies {

        implementation("androidx.appcompat:appcompat:1.7.1")
        implementation("com.google.android.material:material:1.12.0")
        implementation("androidx.constraintlayout:constraintlayout:2.2.1")
        testImplementation("junit:junit:4.13.2")
        androidTestImplementation("androidx.test.ext:junit:1.2.1")
        androidTestImplementation("androidx.test.espresso:espresso-core:3.6.1")
        implementation("com.google.android.gms:play-services-ads-lite:24.0.0")

    }
    into
    dependencies {

        implementation(libs.appcompat)
        implementation(libs.material)
        testImplementation(libs.junit)
        androidTestImplementation(libs.ext.junit)
        androidTestImplementation(libs.espresso.core)

        // admob
        implementation(libs.play.services.ads)
    }
  3. Update your libs.versions.toml, revise the version if necessary:
    [versions]
    agp = "8.13.0"
    junit = "4.13.2"
    junitVersion = "1.3.0"
    espressoCore = "3.7.0"
    appcompat = "1.7.1"
    material = "1.13.0"
    playServicesAds = "24.7.0"

    [libraries]
    junit = { group = "junit", name = "junit", version.ref = "junit" }
    ext-junit = { group = "androidx.test.ext", name = "junit", version.ref = "junitVersion" }
    espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
    appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
    material = { group = "com.google.android.material", name = "material", version.ref = "material" }
    play-services-ads = { module = "com.google.android.gms:play-services-ads", version.ref = "playServicesAds" }

    [plugins]
    android-application = { id = "com.android.application", version.ref = "agp" }

Note: if you have other external dependency, keep the library first, and migrate after common library successfully upgraded.

To create libs.versions.toml, at left side Project Files -> gradle -> New -> File, name it with: libs.versions.toml. Continue step 2 above.

This is example of external library, how to move jsoup into libs.versions.toml

Change build.gradle.kts (:app) from  

dependencies {
    ...
    implementation("org.jsoup:jsoup:
1.21.2") // jsoup

}

change into

dependencies {
    ....
    implementation(libs.jsoup)
}

And add into libs.versions.toml

[versions]
...
# Define the version number
jsoup = "1.21.2"
...
[libraries]
...
# Define the library coordinates, referencing the version above
jsoup = { group = "org.jsoup", name = "jsoup", version.ref = "jsoup" }
...

 

Friday, October 10, 2025

Debian 13: Configure NVidia in dual gpu - hybrid mode and how to utilize it in Android Studio

List your VGA: 

# lspci | grep -E "VGA|3D"
01:00.0 VGA compatible controller: NVIDIA Corporation GA107 [GeForce RTX 2050] (rev a1)
05:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Rembrandt [Radeon 680M] (rev 0b)

Installation

# apt-get install firmware-nvidia-graphics nvidia-detect nvidia-driver linux-headers-$(uname -r) vulkan-tools

Warning "Conflicting nouveau kernel module loaded" may appear.

Check your nvidia

# nvidia-detect
Detected NVIDIA GPUs:
01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GA107 [GeForce RTX 2050] [10de:25ad] (rev a1)

Checking card:  NVIDIA Corporation GA107 [GeForce RTX 2050] (rev a1)
Your card is supported by all driver versions.
Your card is also supported by the Tesla 535 drivers series.
It is recommended to install the
    nvidia-driver

Chek your nvidia software

# nvidia-smi
Fri Oct 10 23:07:14 2025       
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 550.163.01             Driver Version: 550.163.01     CUDA Version: 12.4     |
|-----------------------------------------+------------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id          Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |           Memory-Usage | GPU-Util  Compute M. |
|                                         |                        |               MIG M. |
|=========================================+========================+======================|
|   0  NVIDIA GeForce RTX 2050        On  |   00000000:01:00.0 Off |                  N/A |
| N/A   40C    P0              7W /   45W |       9MiB /   4096MiB |      0%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+

Note: run glxinfo in "xfce terminal", not "terminal emulator"  

GLX information

$ glxinfo | grep "OpenGL renderer"
OpenGL renderer string: AMD Radeon 660M (radeonsi, rembrandt, LLVM 19.1.7, DRM 3.61, 6.12.31-amd64)

The desktop will utilize AMD GPU, we want to run Android Studio and utilize GeForce RTX 2050. Create a bash script to run Android Studio using NVidia Geforce RTX2050 instead build in AMD gpu, e.q 

#!/bin/bash
# Launch Android Studio using the NVIDIA GPU (Prime Render Offload)

APP_PATH="$HOME/AndroidStudio/android-studio/bin/studio.sh"

if [ ! -f "$APP_PATH" ]; then
    echo "Error: Android Studio not found at $APP_PATH"
    exit 1
fi

# Run Android Studio with NVIDIA GPU offload
__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia "$APP_PATH" &

Usefull command if any systemd error during boot 

# journalctl -b -u systemd-modules-load.service


Using nextdns.io as parental control for home user

This summary is not available. Please click here to view the post.

Thursday, October 9, 2025

Debian 13: part 2 configure privoxy and torrc as lan https gateway to anonymity Tor Network

Prerequisite Debian 13: part 1 install Tor-Project  without error.

General network configuration 

Internet — router —- lan —- proxy(tor) 

All client has direct connection to internet via router. Client's browser can be configure to use proxy tor for anonymity.

The browser's connection becomes: [Client PC] --> [Debian Server - Tor & Privoxy] --> (WAN/Router) --> Internet (via Tor)

Privoxy is your https proxy. privoxy will connect to tor software, and tor software will find the way to reach destination using tor anonymity network. 

Debian proxy

Install privoxy

# apt-get install privoxy

Edit or add your /etc/privoxy/config : 

# listening port for your lan
listen-address  0.0.0.0:8118
# connection to tor software, privoxy and torrc run on the same server/pc
forward-socks5t / 127.0.0.1:9050

Edit or add your /etc/tor/torrc :

# Change "myNiceRelay" to something you like
Nickname    myNiceRelay
# Write your e-mail and be aware it will be published
ContactInfo your@e-mail
# for relay, 0 disable
ORPort      0
# for exit relay, 0 disable
ExitRelay   0
# use 127.0.0.1 to make torrc only accessible by localhost / privoxy
# comment these if you allow lan accessing torrc
SocksPort 9050
SocksListenAddress 127.0.0.1
# uncomment these to allow lan accessing torrc
#SocksBindAddress 192.168.1.1:9050
#SocksPolicy accept 192.168.1.0/24
#SocksPolicy reject *

 Enable your privoxy and tor service 

# systemctl enable tor
# systemctl enable privoxy
# systemctl restart tor
# systemctl restart privoxy

Client Browser

Open your browser setting, find proxy. Fill with

HTTP Proxy: 192.168.1.10
Port: 8118 

Note: change 192.168.1.10 to your debian lan ip server.

Now your client can browsing using anonymity tor network