Friday, October 11, 2024

Wifi settings

 Beacon interval - set to maximum to save bandwith and increase battery life.
If you have more Acces Points in the location and need to switch between then lower it, so it will swich faster and not lose the connection.
Also remove other saved networks, as the clients will connect to AP's with lower becon.

DTIM stands for Delivery traffic indication map or message
DTIM - set to maximum for battery save. 

Wifi 5 - ac - 80Mhz channels

Main difference in speed is how many  TX/RX antenas 1x1 or 2x2.
1x1 is 433 Mhz 2x2 is double 866 Mhz. Most mobile devices only have 2x2.

TP-Link Archer C6
5 GHz: 867 Mbps (802.11ac) - means it has 2x2 

Clients example:
Intel Corporation Wireless 7265 - TX/RX Streams 2x2 - 866 Mbps max speed
Intel® Wireless-AC 3165 - Antena 1x1 - 433 Mbps max speed

Wifi 6 - ax  - 960 Mbps only 10% increase in speed vs ac.
Brings 160Mhz channels - but there are only 2 channels in the 5Ghz band
Wifi 6e - ax -  6Ghz band - add much more new bands. So now we can use 160Mhz and get double the speed 1920 Mbps if router supports.

Wifi 7 - be - 320Mhz with even more speed, 3x the ac 866 Mbps = 2598 Mbps

Most router makers dont give the sprecs that really matter directly.

Read more technical data here : https://www.wiisfi.com/


Friday, July 5, 2024

Caddy cd-rom HDD sata

 

This is the sata to mini-sata connections.
Only 5v is used and the data lines, plus the ground.

 DP – Device Present -  Active low signal indicating device connect to the host
 and
Manufacturer diag 
are conected to ground by the switch.
It has 3 positions, left - DP - conected to ground so active, middle Manufacturer diag and full right both disabled.




Friday, October 27, 2023

LibreOffice starts very slow on linux

 Uninstall the package xdg-desktop-portal

sudo apt autoremove xdg-desktop-portal

then it will start in second.

Ubuntu / Debian - mirage - image viewer - cannot ratate images.
There is a bug in phyton. Open mirage in cmd and try to rotate a image. You will see the problem.
Solution: sudo apt install mirage/testing.
mirage --version

Bad version: 0.11.1-1+b6 amd64
Good working version: 0.11.2 - found in testing repository

Saturday, July 22, 2023

Linux boot - kernel, initrd vs initramfs

The bootloader will load the kernel. This could be GRUB or BCD for windows

 Initrd - meant initial ram disk. Initramfs - initial ram file system.
It detects hawdware and loads drivers. Has all drivers so tjhe kernel image remains small and doesnt cause errors from conflicting drivers, and mount file system (it could be raid, netowork storage etc).
It is big 50MB and contains all drivers. 

initrd - is compressed image. Zstandard compressed data/ ASCII cpio archive
initramfs - uncompressed for older pcs.

It is called initrd in many places although it is a initramfs, particularly in boot loaders, as for them it is just a BLOB. The difference is made by the OS when it boots.

dmesg

systemd-analyze 
systemd-analyze plot > plot.svg

Startup finished in 2.840s (kernel) + 11.378s (userspace) = 14.218s graphical.target reached after 11.364s in userspace

Userspace will be since systemd (init) starts to load services. 
sudo systemctl disable/enable/start/stop NAME_OF_SERVICE

journalctl --disk-usage
journalctl --vacuum-size=50M
journalctl --verify   (verify integrity)


/etc/systemd/journald.conf
SystemMaxUse=50M

How to compile a linux kernel


https://www.kernel.org/  download kernel
If you have enough ram I recommend to build it in a ramdisk.

make mrproper- The make mrproper command cleans up any leftover files from previous kernel builds in your source directory. It also wipes out any . config files in your source directory. If you want to do a new clean build.
Boot a Linux MX image to detect all drivers.
ADD all drivers loaded either built into kernel or as modules.

sudo apt update
sudo apt install gcc flex bison libncurses-dev libssl-dev

make localyesconfig - add local modules as built into kernel
make localmodconfig - add local modules as modules
lsmod > /tmp/mylsmod
 make LSMOD=/tmp/mylsmod localmodconfig
make menuconfig
make -j4 (-j is number of cores)
make modules
sudo make modules_install (optional INSTALL_MOD_PATH=/mnt/partition/lib/ -- does nothing )
sudo make install (optional INSTALL_PATH=/mnt/partition/boot/ )

Press / and search for ex USB_SERIAL_CONSOLE  for usb to serial driver - and it shows the path where to find it.

TO disable initrd, disable:
General Setup -> at the bottom - initrd imitramfs support
Need to have added as drivers in kernel ext4 and sata/ahci or nvme drivers

For iwlwifi driver to work when built as driver into the kernel you need  to set:
CONFIG_FW_LOADER_USER_HELPER_FALLBACK=y
Linux Kernel Configuration
└─> Device Drivers
└─> Generic Driver Options
└─> Firmware loader
└─> Force the firmware sysfs fallback mechanism when possible

No rule to make target 'debian/certs/debian-uefi-certs.pem'
scripts/config --disable SYSTEM_TRUSTED_KEYS
scripts/config --disable SYSTEM_REVOCATION_KEYS
Drivers are locate in /usr/lib/modules/$(uname -r)/kernel/
/lib -> /usr/lib/

sudo apt install pciutils
lspci -k
lshw
lsusb
dmidecode - list hw parts

sudo dmesg | tail
lsmod - list loaded drivers
insmod / modprobe - load driver
rmmod - unload driver / modprobe -r

Edit apt sources and add contrib non-free  
nano /etc/apt/sources.list 
deb https://deb.debian.org/debian/  main contrib non-free  
apt update

apt search firmware 
firmware-misc-nonfree 
firmware-iwlwifi

Video drivers: 
xserver-xorg-video-intel 
xf86-video-intel 
xf86-video-amdgpu 
nvidia nvidia-utils

Add driver at debian install time:
Search here:
https://www.debian.org/distrib/packages#search_contents
Put contents in /dev/sdc1/drivers and mount to /lib/firmware
/lib/firmware/iwlwifi-3945-2.ucode

mkdir /lib/firmware
mount /dev/sdc1/drivers /lib/firmware

I have an Intel Corporation HD Graphics 5500
Step 1. Check video card driver.

Type lspci

lspci -k  -- to see loaded drivers in my case its the intel i915 driver.
sudo apt install xserver-xorg-video-intell

This package provides the driver for the Intel i8xx and i9xx family of chipsets, including i810, i815, i830, i845, i855, i865, i915, i945 and i965 series chips.

Step 2. Check OpenCL drivers

You can run clinfo (sudo apt install clinfo ) and if it says 0 devices

sudo apt install intel-opencl-icd 

Thursday, June 1, 2023

Install grub boot loader + Fix Windows instalation

GRUB (GRand Unified Bootloader)

BIOS will read the first sector of a storage device for a boot partition table.
MBR( master boot record) - 4 partitions
To boot mbr you need UEFI set to boot mode:  Legacy BIOS.

For UEFI - you need a GPT partition table and a fat16/fat32 partition anywhere on the disk  with an EFI folder - 100mb for windows 200mb linux (has all drivers here).
Kernel 10mb + initramfs 75mb ~ 100mb + 30mb windows bcd.
GPT (Globally Unique Identifier Partition Table) - 128 partitions
EFI partition - FAT16, FAT32 or VFAT

UEFI will look into
<EFI_SYSTEM_PARTITION>\EFI\
Will read folders from here - and display them in UEFI boot menu
Everyfolder must have a xxx.efi boot file

FIX Windows BOOT

The System Reserved partition is optional and is created by the windows setup for the BitLocker only as it stores un-encrypted data in order to decrypt and boot main partition
It also has the BCD (Boot Configuration Data) folder.

To avoid it press SHIFT+F10 at windows setup it opens a cmd :
diskpart
select disk 0
create partition primary
and continue with graphical setup.

Install a boot manager - boot windows install media, press SHIFT+F10 to open a CMD promt

diskpart
select disk 0
list volume
select volume 2 (pick the fat32 one)
assing letter k:
exit

Create a BCD store. - required to boot windows.
bcdboot c:\Windows /l en-GB /s K: /f ALL
Bcdboot.exe c:\windows /s c:
 
/s k: = install to k:

Grub doesnt see ext4 unknown filesystem --- remove metadata_csum
sudo dump2fs /dev/sda1 | head -20

install package e2fsprogs
sudo tune2fs -O ^metadata_csum /dev/sda1  -- remove
sudo tune2fs -O metadata_csum /dev/sda1  -- add
sudo e2fsck -f /dev/sda1

Edit grub on windows

open diskpark - type ar run or cmd
list volume
select volume 1
assign letter=z

You will get access denied efi partition windows when you try to access the partition.
Right click on start menu - and select PowerSheel (admin)
Type z:  then use cd and ls to navigate
To edit grub.cfg type notepad grub.cfg at the proper path

remove letter=z in diskpart again to remove it from explorer

Install GRUB

mount /dev/xxx /mnt  --- efi partition
--boot-directory=/mnt -- it will install under /mnt/grub - grub files
--efi-directory=/mnt -- it will install under /mnt/EFI/os_name (Microsoft/Debian/Ubuntu etc)
grub-install --boot-directory=/mnt --efi-directory=/mnt --target=x86_64-efi
grub-mkconfig > /mnt/grub/grub.cfg
grub-update is equivalent to grub-mkconfig
grub-mkconfig -o /boot/efi/EFI/grub/grub.cfg

ls 
grub> ls (hd1,gpt3)/
grub> set root=(hd0,1) grub> linux /boot/vmlinuz-3.13.0-29-generic root=/dev/sda1 grub> initrd /boot/initrd.img-3.13.0-29-generic grub> boot

optional (insmod part_gpt, insmod chain)
set root=(hd0,gpt1)
use tab after / or after each folder to explore contents - bootmgr is for bios, bootmgfw.efi for uefi.
chainloader /EFI/Microsoft/Boot/bootmgfw.efi
boot

Grub: no suitable video mode found boot in blind mode
insmod all_video

Edit grub.cfg :

insmod all_video
insmod part_gpt
insmod ext2
insmod gzio
insmod gfxterm
insmod gettext

font=unicode

set gfxmode=auto
set lang=en_US
set timeout=5
set menu_color_normal=cyan/blue
set menu_color_highlight=white/blue

# For booting Microsoft Windows
menuentry "Microsoft Windows 7" {
    set root=(hd0,2)
    chainloader +1
}

menuentry 'Debian' {
set root='hd0,gpt2'
echo 'Loading Linux ...'
linux /boot/vmlinuz-5.10.0-11-amd64 root=/dev/sda2 ro
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-5.10.0-11-amd64
}

menuentry 'UEFI Firmware Settings' $menuentry_id_option 'uefi-firmware' {
fwsetup
}

Manual boot from GRUB menu

chainloader /efi/Microsoft/Boot/bootmgfw.efi
boot

iso images:
loopback lo (hd0,4)/image.iso
linux (lo)/artix/vmlinuz boot=casper iso-scan/filename=${isofile}
initrd (lo)/artix.initrd.gz
boot

ls - shows disks
ls (hd0,1)/    +tab = browse partitions

If you get to grub boot menu grub 0.x
root (hd0,0) --- this will mount the partition
kernel /boot/vmlinuz... root=/dev/sda1
initrd /boot/initrd....
boot

Grub 2
ls
set root=(hd0,msdos1)
linux /boot/vmlinuz... root=/dev/sda1
initrd /boot/initrd...
boot

Grub custom font

# Generate a GRUB-compatible font with specified size
# from a TTF (type-type font)

sudo grub-mkfont --output=/boot/grub/fonts/DejaVuSansMono36.pf2 --size=36 /usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf


Slow loading of linux from USB on old laptops

Grub calls the BIOS to read from the USB.
Some usb sticks are not compatible with bios drivers for high speed usb. Other sticks might work at faster speeds.
 
 Grub uses bios driver to load vmlinuz and initramfs from usb and it is using USB 1.0 - it has a speed of around 1.5Mbps = 0.2MB/s. 75mb/0.2 = 375 = 5-10 min.

For old laptops / pcs:

The Plop Boot Manager is a small program to boot different operating systems.
The boot manager has a built-in ide cdrom and usb driver to access that hardware without the help/need of a bios.

https://www.plop.at/en/bootmanager/intro.html

Connect to Wifi internet linux

echo 127.0.0.1    laptop > /etc/hosts
echo pcname > /etc/hostname


Connect to WIFI
sudo systemctl enable iwd

Enable dhcp client
/etc/iwd/main.conf
[General]
EnableNetworkConfiguration=true
[Rank]
BandModifier5Ghz=100.0

DNS
Either use resolv.conf for a static dns or enable systemd-resolved
/etc/resolv.conf
nameserver 1.1.1.1
#cloudflare
nameserver 4.4.4.4  
nameserver 8.8.8.8
# google public dns

/etc/runit/sv/iwd/run
#!/bin/sh
exec /lib/iwd/iwd 2>/dev/null
ln -s /etc/runit/sv/iwd /run/runit/iwd


Connect to AP
rfkill 
rfkill unblock all
* if it is powered off - press FN+Wifi or Fn+Airplane Mode twice

iwctl device list
iwctl station wlan0 scan
iwctl station wlan0 get-networks
iwctl station wlan0 connect NETWORK_NAME
iwctl station wlan0 disconnect
iwctl station wlan0 show
iwctl known-networks list
iwctl known-networks NETWORK_NAME forget

Install iwgtk. On debian it must be compiled.

ifconfig - temporary settings in kernel, not persistent at reboot
ifup/down - config /etc/network/interfaces

Don't install networkmanager 
If you do, sudo systemctl disable NetworkManager-wait-online
Systemd - waits for - multi-user environments - for the network to connect and then continues to load services and you get a long wait at boot.

===========================

ip a
dhclient -v eth0
route
ping
netstat -tapn
namp
iptables -L (INPUT - FORWARD - OUTPUT)

wpa_supplicant
wpa_password wifi_network password > wifi
ip a
rfkill -- check it is enabled
wpa_supplicant -B -i wlan0 -c ./wifi
sudo dhclient wlan0

wpa_supplicant -B -i wlan0 -c <(wpa_passphrase "Your_SSID" Your_passphrase) && dhclient wlan0

Link service to runit by 
# ln -s /etc/sv/wpa_supplicant /var/service
or systemctl enable wap_supplicant

Manual install debian or arch linux from scratch

Boot  Arch linux image from USB. Use rufus to burn it windows, balenaetcher or dd in linux.
dd if=~/Download/arch.iso of=/dev/sdb bs=1M status=progress oflag=direct

* Install base packages distro

Wifi - internet
iwctl station wlan0 connect SSDID_name

Partition
lsblk
mkfs.ext4 /dev/sda3
mount /dev/sda3 /mnt

Install:
- from arch: pacman -Sy debootstrap
- from debian: apt install debootstrap arch-install-scripts

Install debian: debootstrap --arch amd64 stable /mnt

genfstab /mnt/linux >> /mnt/linux/etc/fstab
Chroot into the new install
arch-chroot /mnt/linux     --- this will auto mount /dev /proc etc from current system

Set Time Zone:
cd /etc
ls -l | grep localtime
date
sudo ln -s /usr/share/zoneinfo/Europe/Bucharest /etc/localtime
date

apt install linux-image-amd64
apt install sudo
passwd   --- create password for root or you cant login after reboot

WIFI

nano /etc/apt/sources.list - add non-free-firmware
apt update
apt install firmware-misc-nonfree    --- othter wifi boards - realtek asus
apt install firmware-iwlwifi    --- mostly intel wifi boards

apt install iwd (alternative is wpa_supplicant)
Enable dhcp client + dns
/etc/iwd/main.conf
[General]
EnableNetworkConfiguration=true
/etc/resolv.conf
nameserver 1.1.1.1

nano /etc/hostname
nano /etc/hosts    - 127.0.0.1 hostname
adduser username
usermode -aG sudo user

Reboot

sudo dpkg-reconfigure locales

* Video system

You can install here a desktop/login manager - gdm3, lightdm etc OR just use xinit without an GUI interface
apt install xfce4   --- it will install xorg as a requirement

Xwayland works with gdm3 and gnome only for now.
Xfce4 works with lightdm and xorg/x11.

Change active Display Manager:
sudo dpkg-reconfigure gdm3
sudo dpkg-reconfigure lightdm

To start video mode:
systemctl start lightdm 

sudo apt install wget
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
dpkg -i google.....deb
sudo apt -f install  --- to fix dependencies error from above

Change console FONT size

Go to directory /usr/share/kbd/consolefonts - and ls to see all available fonts

then setfont iso01-12x22.psfu.gz 
or any other fonts you like from there

dpkg-reconfigure console-setup


https://www.linuxfromscratch.org/

ArchLinux - https://wiki.archlinux.org/title/Installation_guide

https://gist.github.com/myTerminal/4f1d26eaf32cdc5bcc9fb19f594c03d2

https://www.debian.org/releases/stretch/amd64/apds03.html.en

https://wiki.debian.org/Debootstrap

On xfce4 time will not update after sustend on the gui - but time sync works fine


Saturday, April 1, 2023

Storage partitions under linux - swap - ramdisk

Partitions

gparted, cfdisk, lsblk, df -h

mkfs.ext4 /dev/sda2 , mkfs.ntfs etc --- format the partition  

sudo fdisk -l     --- view disks
lsblk -f     --- view disks and filesystems
sudo blkid - partition UUID
df -h
df -ih --- innodes

sudo tune2fs -l /dev/sda8
sudo tune2fs -m 1 /dev/sda8
Reserved blocks for root - so when you run out of space you can still login. Set default to 5% of partition size..
*** merge online cu partitia mounted = ok
After you rezise partition size with cfdisk you need to also resize the filesystem:
sudo resize2fs /dev/sdb

Mounting

/mnt : Mount point for a temporarily mounted filesystem - should not have subfolders
/media : Mount point for removeable media

These 3 are required for chroot, 

are interfaces to kernel data structures and not real files on hdd - they stay in ram.

Can check with the command findmnt /sys
/dev - file devices
/proc - running process table + some system info same as sys left for backward compatibility 
/sys - hardware information

/run - virtual ram runtime for udev - needed before /var/run is mounted

/etc - system config files - before changes would be done in source code and recompile
means etcetera - as in the rest of the files of a system

/var - variable stuff like logs
/opt - optional software not installed with system package manager
/usr - libraries, binaries, manuals - all the software

/etc/fstab --- automount at start-up - should at least have /

mount -a --- mount all from fstab

UUID=14D82C19D82BF81E /mnt/d auto nosuid,nodev,nofail,x-gvfs-show 0 0

1. partition id
2. mount point
3. partition type 
4. options

nosuid - specifies that the filesystem cannot contain set userid files. This prevents root escalation and other security issues.
nodev - specifies that the filesystem cannot contain special devices (to prevent access to random device hardware).
nofail - removes the errorcheck.
x-gvfs-show - show the mount option in the file manager. If this is on a GUI-less server, this option won't be necessary.
0 - determines which filesystems need to be dumped (0 is the default).
0 - determine the order in which filesystem checks are done at boot time (0 is the default).

mount /dev/sda1 /mnt

NTFS partition from windows closed without proper shutdown ---> ntfsfix /dev/sda1
If that doesn't work you need to boot a windows os and it will fix it. ntfs is not opensource.

See mounted filesystems and space usage : 
du -sh -- file/folder size

INODES on linux

The file system has an inode table - every file and directory on a disk requires one inode entry.

To have more inode you need to re-format the filesystem and reserve more space for the inode table.

Other filesystems dont allocate a fixed inode table like XFS, JFS, BtrFS or ZFS.

On ext3 and ext4 - the most common used filesystems on linux you get by default 1 inode for every 16kb of space.
using the -i flag to mkfs.ext4 to specify the bytes:inode ratio. 

This problem is most common on servers where you can get a lot of small files.
Apache’s disk cache system (mod_cache_disk) - creates a lot of small files - htcacheclean should clean it.

Swap

Instead of storage swap partition you can have a swap partition in ram.
Of course this will not work for hibernation.

Swap file

dd if=/dev/zero of=/swapfile bs=1M count=3064 status=progress
chmod 600 /swapfile
mkswap -U clear /swapfile
swapon /swapfile
Add it to fstab
/swapfile none swap defaults 0 0 >> /etc/fstab

Ram swap

When ram gets full, data is moved and compressed into this z swap partition.

To enable it, open a cmd and create these files :

sudo su
echo zram > /etc/modules-load.d/zram.conf
echo 'options zram num_devices=1' > /etc/modprobe.d/zram.conf
echo 'KERNEL=="zram0", ATTR{disksize}="512M",TAG+="systemd"' > /etc/udev/rules.d/99-zram.rules

touch /etc/systemd/system/zram.service

[Unit]
Description=Swap with zram
After=multi-user.target

[Service]
Type=oneshot
RemainAfterExit=true
ExecStartPre=/sbin/mkswap /dev/zram0
ExecStart=/sbin/swapon /dev/zram0
ExecStop=/sbin/swapoff /dev/zram0

[Install]
WantedBy=multi-user.target

sudo systemctl enable zram
reboot 

swapiness - sudo nano /etc/sysctl.conf

The default value is 60."
0 - does not disable swap

To use a swap partition instead

# mkswap /dev/sda5
# sync
# swapon /dev/sda5

Ram-disk

For windows :
The only free software that allows for more then 4gb is ImDisk Toolkit

For linux  :
First check how much ram you got : free -h
Make a new directory and mount the ramdisk :

sudo mkdir /mnt/ramdisk
sudo mount -t tmpfs -o size=10g tmpfs /mnt/ramdisk
tmpfs - is mounted in ram
To make it available every time you boot edit /etc/fstab :

tmpfs       /mnt/ramdisk tmpfs   nodev,nosuid,noexec,nodiratime,size=1024M   0 0

Tuesday, March 28, 2023

Android on linux

 ADB - Android Debug Bridge - sudo apt install adb

To enable go to Settings - About phone - scroll to bottom - tap many times - Build number - until you get a message Developer mode enabled.
Now go to Settings - Developer mode - enable USB DEbugging

Connect android via usb to computer - you will get a message to allow connection.

sorin@hp250:~$ adb devices
List of devices attached
ZY326M79LR device

sorin@hp250:~$ adb tcpip 5555
restarting in TCP mode port: 5555

sorin@hp250:~$ adb connect 192.168.0.201:5555
connected to 192.168.0.201:5555

sorin@hp250:~$ adb devices
List of devices attached
192.168.0.201:5555 device

Then use scrcpy (sudo apt install scrcpy ) to connect to the phone from laptop.
Record screen with OBS Studio - and select scrcpy window.

DroidCam - use camera



Monday, January 30, 2023

Convert scanned document images to pdf

Rename the images with numbers 1, 2 ,3 etc 12.jpeg - the image view/print app from windows doesnt use the same order as you see it in explorer.

Select all scanned images, right click - Show more options - Print


Select Print to PDF, go to Options - Printer Properties -> and select Orientation - Portrait

Monday, December 12, 2022

Linux autologin + Sudo with yubikey

Authentification is done by PAM - Pluggable Authentication Modules
Passwords are stored in /etc/shadow

passwordless login with yubikey on linux

HMAC-SHA1 Challenge-Response is specific for Yubikey only.

yubiko-pam - is yubikey-specific and relay on it's specific features, 
pam-u2f - is generic and works with any keys supporting u2f and/or fido2.

auth required pam_u2f.so cue interactive

 Set authentification with yubikey off-line with Challenge-Response so you dont have to type a password just touch the keyyubikey

install yubico pam package
# install chalenge to slot 1
# generate challenge file for slot 1
ykpamcfg -1 -v
man ykpamcfg

/etc/pam.d/common-auth
#[success=1 new_authtok_reqd=ok ignore=ignore default=die]
auth required   pam_echo.so "Touch the key"
auth  sufficient      pam_yubico.so mode=challenge-response authfile=/home/user/.yubico/challenge-xxxx

Install xscreensaver if you want to lock the screen

Autologin with desktop/login manager

autologin with lightdm:
/etc/lightdm/lightdm.conf -- uncomment the lines
autologin-user = sorin
autologin-user-timeout = 0
*Note if you cannot login with the user but you can with root check if you ran out of space. (df -h)

Autologin with systemd directly

Agetty is called by /bin/INIT and this calls /bin/login 

/etc/systemd/system/getty.target.wants/getty@tty1.service
add -a my_username

ExecStart=-/sbin/agetty -a username - $TERM
remove the login options -o '-p -- \\u'

To start X11 with xfce
~/.bash_profile
if [ -z "${DISPLAY}" ] && [ $(tty) = /dev/tty1 ]; then
  startxfce4
fi

Tuesday, November 8, 2022

Mouse latency response time in linux

 lsusb

Find your mouse. 

Bus 001 Device 003: ID 1a7c:0191 Evoluent VerticalMouse 4

sudo usbhid-dump -s 1:3 -f -e stream

From the manual we get what the parameters mean:
man usbhid-dump
 -s =bus[:dev]
Replace -s 1:3 with the Bus Device for your device

Output is in the form
BUS:DEVICE:INTERFACE:ENTITY TIMESTAMP

.001:003:000:STREAM             1667902900.482858
 00 00 00 FC FF 00 00

.001:003:000:STREAM             1667902900.490787
 00 00 00 FE FF 00 00

.001:003:000:STREAM             1667902900.498863
 00 01 00 FC FF 00 00

Timestamp is in seconds before the point and subdivisions of seconds after the point.
First 3 digits milliseconds next 3 digits microseconds.
So the difference between two events is in my case is 8ms.
Note the speed dpi choise does not affect this. This is the maximum physical transmit speed.

usbhid-dump will disconect you mouse/device.
if you mess up just remove the receiver and plug-it back in or wait 60 seconds.

It is a WiFi Evoluent Vertical Mouse 4.

Configure Mouse Buttons X11
xinput
press a button and run in terminal to find the number associated with each button
xinput query-state id-nr
or
xev | grep button


xinput set-button-map "Kingsis Peripherals Evoluent VerticalMouse 4" 1 2 3 4 5 6 7 9 2 8

90-evoluent.conf /usr/share/X11/xorg.conf.d/conf
Section "InputClass" Identifier "Evoluent VerticalMouse 4" MatchUSBID "abcd:0123" # input id: 1 2 3 4 5 6 7 8 9 10 Option "ButtonMapping" "1 2 3 4 5 6 7 9 2 8" EndSection


Tuesday, November 1, 2022

Nofap - block porn

 Change the dns on your router in the DHCP section, with the dns from cisco OpenDNS  FamilyShield

https://www.opendns.com/setupguide/#familyshield

208.67.222.123
208.67.220.123

Use cloudflare warp - set it to familly mode full (malweare + adult)
Chrome - uses and external google dns to bypass it.
chrome://net-internals/?#dns  --- you can check here what dns record it returns
To disable external google dns go to:
Settings - Privacy and security - Security : chrome://settings/security - 
at the bottom of the page Use secure dns - With your current service provider - and it will use warp/cloudflare settings.

Youtube - click the profile picture in right top corner - and select Restrcited Mode - On - but the downside is it disables the comment section.

Android - Settings - Google  - Settings for Google apps (last one) - Search, Assitant & Voice (last one) - Hide Explicit results - On

Sunday, October 23, 2022

Hacker movies

 Takedown 2000 - computer hacker Kevin Mitnick

Antitrust 2001

The net 1995

Hackers 1995



Disable notification pop-ups in chrome

 Click on vertical 3dots icon for menu list and choose the Settings option.

  1. Switch to the Privacy and Security section and click on the Site Settings tab.
  2. Scroll down to the Permissions section and click on Notifications.
  3. Select 
  4. Don't allow sites to send notifications
    Features that need notifications won't work