Skip to content

Instantly share code, notes, and snippets.

@ahhajlou
ahhajlou / asus-battery-limit-systemd.md
Last active August 8, 2026 06:29
asus-battery-limit-systemd

Asus battery limit using systemd service

cat >/etc/systemd/system/battery-charge-limit@.service <<'EOF'
[Unit]
Description=Set battery charge limit to %i%%
After=multi-user.target

[Service]
Type=oneshot
@ahhajlou
ahhajlou / asus-keyboard-backlight-linux
Created July 27, 2026 17:57
Asus M16 laptop keyboard backlight - Linux
The `0b05:19b6` N-KEY device ID is the key detail here. Let me check if asusctl supports this specific PID.Good findings. Here's the clear picture:
## Your USB PID `0b05:19b6` — what it means
Two things are confirmed:
1. **`rogauracore` explicitly supports `0b05:19b6`** (listed as GA503) — a libusb-based CLI tool that directly talks to the N-KEY USB HID device.
2. **`asusctl` also recognizes `0b05:19b6`** and the README states it "may work without tweaks" — however, as seen from the GA605WI issue report, asusd may log a warning that `aura_support.ron` has no entry for your exact model string and fall back to a default profile.
FROM ubuntu:16.04
ARG DEBIAN_FRONTEND=noninteractive
ARG TZ=Asia/Tehran
# For ubuntu, do not use dash.
RUN which dash &> /dev/null && (\
echo "dash dash/sh boolean false" | debconf-set-selections && \
DEBIAN_FRONTEND=noninteractive dpkg-reconfigure dash) || \
# Create initramfs without compression
# Run this command from within the rootfs directory; it will generate `initrd.cpio` in the parent directory.
find . | cpio -o -H newc >../initrd.cpio
# Create initramfs with gzip compression
# Run this command from within the rootfs directory; it will generate `initrd.cpio` in the parent directory.
find . | cpio -o -H newc | gzip >../initrd.gz
# Extract initramfs archive to current directory
cpio --extract --make-directories --format=newc --no-absolute-filenames < rootfs.cpio
qemu-system-aarch64 \
-M virt \
-cpu cortex-a72 \
-m 256 \
-kernel ./Image \
-initrd initrd.cpio \
-append "console=ttyAMA0 maxcpus=1 rdinit=/init" \
-nographic

Certainly! Here’s a step-by-step guide for setting up the DNS-01 challenge with Cloudflare using Certbot, focusing on the API key setup and configuration.

Step-by-Step for Using DNS-01 Challenge with Cloudflare

  1. Generate a Cloudflare API Token:
    • Log in to your Cloudflare account and navigate to My Profile (found under your account icon).
    • Go to the API Tokens tab.
    • Click Create Token.
    • Use the Edit Zone DNS template, which provides limited access, ideal for security.
    • Permissions: Set as follows:
# For CIDR IP range
ipset create bypass hash:net hashsize 4096 maxelem 16384
@ahhajlou
ahhajlou / fans-control.sh
Last active September 26, 2024 04:20
Linux_on_Asus_Laptop
# https://askubuntu.com/questions/1254364/how-to-control-fans-on-an-asus-laptop/1398098#1398098
cat << EOF >>~/.bashrc
alias fan-turbo='cd /sys/devices/platform/asus-nb-wmi; sudo sh -c "echo 1 >> fan_boost_mode"; sudo sh -c "echo 1 >> throttle_thermal_policy"; source ~/.bashrc; cd ~;'
alias fan-performance='cd /sys/devices/platform/asus-nb-wmi; sudo sh -c "echo 0 >> fan_boost_mode"; sudo sh -c "echo 0 >> throttle_thermal_policy"; source ~/.bashrc; cd ~;'
alias fan-silent='cd /sys/devices/platform/asus-nb-wmi; sudo sh -c "echo 2 >> fan_boost_mode"; sudo sh -c "echo 2 >> throttle_thermal_policy"; source ~/.bashrc; cd ~;'
EOF
source ~/.bashrc
sudo apt-get update && sudo apt-get -y upgrade
sudo apt-get install -y git cups samba build-essential automake libcups2-dev
sudo usermod -a -G lpadmin pi
sudo cupsctl --remote-any
sudo systemctl restart cups
# Build Canon capt driver
cd /tmp
git clone https://github.com/agalakhov/captdriver.git captdriver