cat ~/.xinitrc
#!/bin/sh
# enable numlock *after* X11 starts
numlockx on &
# start XFCE
exec startxfce4
cat .bash_profile
#numlockx on &
if [ -z "${DISPLAY}" ] && [ $(tty) = /dev/tty1 ]; then
startx
fi
cat ~/.xinitrc
#!/bin/sh
# enable numlock *after* X11 starts
numlockx on &
# start XFCE
exec startxfce4
cat .bash_profile
#numlockx on &
if [ -z "${DISPLAY}" ] && [ $(tty) = /dev/tty1 ]; then
startx
fi
ESP-01 -> USB-TTL
===================
3v3, EN -> 3V
TX -> RX
RX -> TX
GND,IO0 -> GND
IO0 -> GND -- programming mode
IO0 -> 3.3V -- normal boot mode
RST - via button - GND - when you press button it resets
It draws around 60-80ma @ 3.3V. Can check the USB to TTL 3.3V regulator on the back for max power. Mine is AMS1117. Can supplu 1A - (1.5A maximum)
sudo apt install esptool
Read chip info:
esptool.py --port /dev/ttyUSB0 flash_id
esptool.py --port flash_id
Output:
Detecting chip type... ESP8266
Chip is ESP8266EX
Detected flash size: 1MB
The cip supports external FLASH via SPI up to 16MB. You can find 1MB or 4MB versions.
Dowload firmware:
https://www.espressif.com/en/support/download/all?keys=8266 pick ESP8266 NONOS SDK
Direct link: https://codeload.github.com/espressif/ESP8266_NONOS_SDK/zip/refs/tags/v3.0.6
extract and go into /bin
esptool.py --port /dev/ttyUSB0 --baud 115200 write_flash \
--flash_mode dout --flash_size 1MB \
0x00000 boot_v1.7.bin \
0x01000 at/512+512/user1.1024.new.2.bin \
0xFC000 esp_init_data_default_v08.bin \
0x7e000 blank.bin
0xfe000 blank.bin
Make a backup:
esptool.py --port /dev/ttyUSB0 read_flash 0x00000 0x100000 esp8266_at_backup.bin
Restore backup:
esptool.py --port /dev/ttyUSB0 write_flash 0x00000 esp8266_at_backup.bin
Connect to ttyUSB0 you can use CuteCom. Use speed 115200 and at INPUT select CR/LF.
Commands:
https://docs.espressif.com/projects/esp-at/en/release-v2.2.0.0_esp8266/AT_Command_Set/index.html
AT
Ouput: OK
AT+GMR
Output:
AT version:1.7.6.0(Jan 24 2022 08:56:02)␍␊
SDK version:3.0.6-dev(072755c)␍␊
compile time:Jun 17 2024 07:38:00␍␊
Bin version(Wroom 02):1.7.6␍␊
AT+CWMODE?
→ shows current Wi-Fi mode:
1 = Station
2 = SoftAP
3 = Both
Optional if you want better speed
ESP3D/esp3d/src/core/esp3d_settings.cpp
#define DEFAULT_BAUD_RATE "230400"
#define DEFAULT_SERIAL_BRIDGE_BAUD_RATE "230400"
Compile
====
python3 -m venv platformio
source platformio/bin/activate
pip install platformio
cd ESP3D
platformio run -e esp01_1m_bridge --target clean
platformio run -e esp01_1m_bridge
Upload firmaware
====== dont forget to have IO0 to GND and reset before uploading
esptool.py --port /dev/ttyUSB0 flash_id
esptool.py --port /dev/ttyUSB0 erase_flash
esptool.py --port /dev/ttyUSB0 write_flash 0x00000 .pioenvs/esp01_1m_bridge/firmware.bin
If you want more speed use a ESP32
build_flags =
-DESP_SERIAL_BRIDGE
-DCONFIG_FREERTOS_HZ=1000
platformio = pio (same command)
pio run -e esp32dev
pio run -e esp32dev -t upload
curl -L http://s3.voneicken.com/esp-link/esp-link-v3.0.14-g963ffbb.tgz | tar xzf -
I installed micropython on my esp32 for easier coding - no more waiting for the arduino code to recompile, and easy testing of new code.
All good for now.
A few problems started to appear.
When using a LCD a ST7735 the refresh is very slow, you can see the screen being painted from top to bottom. Its not terrible but not that great, on arduino with C code was fine.
Second problem, when I tried to log some data online with urequest, or even with sockets.
I started to get: OSError: (-29312, 'MBEDTLS_ERR_SSL_CONN_EOF')
The problem comes from SSL part - if the server is using anything more powerfull then RSA for the HTTPS certificate we have a problem.
ESP32 is left with too little memory and cpu from running micropython.
Two solutions.
If you remove the TFT library it works, but this is not really a solution, since I want the data displayed on the screen as well.
I went through the library and started to remove pieces of code not required, like they have 3 functions to initrb, initrg, initrr - to initialize the screen with red, green or blue. Just keep the red one and remove the others.
I also removed the drawing functions like circle, line, rect etc - I only needed text.
After this trimming, I got the first success, urequests actually working, but not all the time.
So second solution was to ditch the HTTPS.
Setup the server to accept http. Then it works fine.
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.
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/
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
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)
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.
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.lsmod > /tmp/mylsmod
make LSMOD=/tmp/mylsmod localmodconfig
No rule to make target 'debian/certs/debian-uefi-certs.pem' scripts/config --disable SYSTEM_TRUSTED_KEYS scripts/config --disable SYSTEM_REVOCATION_KEYS
Check OpenCL drivers
You can run clinfo (sudo apt install clinfo ) and if it says 0 devices
sudo apt install intel-opencl-icd
bcdboot c:\Windows /l en-GB /s K: /f ALLGrub 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
For old laptops / pcs:
The Plop Boot Manager is a small program to boot different operating systems.echo 127.0.0.1 laptop > /etc/hosts
echo pcname > /etc/hostname
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:
- from arch: pacman -Sy debootstrap
- from debian: apt install debootstrap arch-install-scripts
Install debian: debootstrap --arch amd64 stable /mnt/linux
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
[manual without arch-chroot]
sudo mount -t proc /proc /mnt/linux/proc
sudo mount -o bind /dev /mnt/linux/dev
sudo mount -o bind /sys /mnt/linux/sys
chroot
[/manual]
Set Time Zone:
ln -sf /usr/share/zoneinfo/Europe/Bucharest /etc/localtime
date
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
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
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/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
1. partition id
2. mount point
3. partition type
4. options
mount /dev/sda1 /mnt
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.
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
# mkswap /dev/sda5# sync # swapon /dev/sda5
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
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 Print to PDF, go to Options - Printer Properties -> and select Orientation - Portrait
Authentification is done by PAM - Pluggable Authentication Modules
Passwords are stored in /etc/shadow
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
lsusb
Find your mouse.
Bus 001 Device 003: ID 1a7c:0191 Evoluent VerticalMouse 4
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.123Youtube - 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