LINUX MAGAZINE #2 2024: Alle listings
- May 16, 2024
- 0
Pagina 12 – Squashfs:
sudo apt install squashfs-tools mksquashfs /home/linuxmag /tmp/homedirlinuxmag.squashfs mksquashfs /home/linuxmag /tmp/homedirlinuxmag-root.squashfsn -force-uid root -force-gid root mksquashfs /home/linuxmag/ /tmp/homedirlinuxmag-betsandenuitgesloten. squashfs -e bin -e wachtwoorden.nl sudo mkdir /mnt/squashfs sudo mount -t squashfs -o loop /tmp/homedirlinuxmag.squashfsn /mnt/squashfs sudo mount -t squashfs -o loop /tmp/homedirlinuxmag-root.squashfsn /mnt/squashfs mkdir /tmp/squashfs unsquashfs -d /tmp/squashfs/ -f /tmp/homedirlinuxmag.squashfs unsquashfs -d /tmp -f /tmp/homedirlinuxmag.squashfs -e .profile mkdir /tmp/mint sudo mount -o loop /tmp/linuxmint-21.1-cinnamon-64bit.ison /tmp/mint/ sudo mount -t squashfs -o loop /tmp/mint/casper/filesystem. squashfs /mnt/squashfs/ sudo unsquashfs -d /tmp/squashfs/ -f /tmp/mint/casper/filesystem. squashfs chmod u+x ~/bin/mntsquashfs.sh
Pagina 13 – Squashfs
#!/bin/bash error_message() { echo -e "\nusage:n mntsquashfs filename_squashfs_ filesystem [ mountpoint ]" } if [ "$2" = "" ] then mountpoint="/mnt/ squashfs" else mountpoint="$2" fi mntstat=$(mount | grepn $mountpoint) n=${#mntstat} if [ $n -gt 0 ] then sudo umount $mountpoint fi if [ "$1" = "" ] then error_message else sudo mount -t squashfsn o loop $1 $mountpoint fi
Pagina 17 – JavaScript
Pagina 20 – Lees je fitnesstracker uit via bluetooth
from machine import Pin, I2C from ssd1306 import SSD1306_I2C i2c = I2C(scl=Pin(22), sda=Pin(21), freq=100000) display = SSD1306_I2C(128, 64, i2c) display.text("Hello world", 0, 0, 1) display.show() PAGINA 21:
import bluetooth from machine import Pin, I2C import uasyncio as asyncio import aioble from ssd1306 import SSD1306_I2C HRS_UUID = bluetooth.UUID(0x180D) HRM_UUID = bluetooth.UUID(0x2A37) i2c = I2C(scl=Pin(22), sda=Pin(21), freq=100000) display = SSD1306_I2C(128, 64, i2c) def decode_heart_rate(data): heart_rate = data[1] if data[0] & 1: heart_rate = heart_rate + (data[2] << 8) return heart_rate def show_text(text): display.fill(0) display.text(text, 0, 0, 1) display.show() async def find_heart_rate_sensor(): show_text("Searching sensor...") async with aioble.scan(5000, interval_us=30000, window_us=30000, active=True) as scanner: async for result in scanner: if HRS_UUID in result.services() or result.name() == "InfiniTime": return result.device return None async def main(): device = await find_heart_rate_sensor() if not device: show_text("Sensor not found") return try: show_text("Connecting...") connection = await device.connect() except asyncio.TimeoutError: show_text("Connection timeout") return async with connection: try: hrs_service = await connection.service(HRS_UUID) hrm_characteristic = await hrs_service.characteristic(HRM_UUID) except asyncio.TimeoutError: show_text("Timeout") return await hrm_characteristic.subscribe(notify=True) while True: heart_rate = decode_heart_rate(await hrm_characteristic.notified()) display.fill(0) display.text(str(heart_rate), 56, 32, 1) display.show() asyncio.run(main())
Pagina 31 – Compileren
LISTING 1 sudo apt install linux-headers-6.1.0-18-amd64 gcc g++ make docutils-common wget https://download.geany.org/geany-2.0.tar.gz tar -xvzf geany-2.0.tar.gz cd geany-2.0 ./configure sudo apt install libgtk-3-dev make sudo make install geany
PAGINA 32 – LISTING 2:
sudo apt install linux-headers-6.1.0-18-amd64 gcc make g++ docutils-common libgtk-3-dev wget https://download.geany.org/geany-2.0.tar.gz tar -xvzf geany-2.0.tar.gz cd geany-2.0 cp geany.desktop.in geany.desktop ./configure --enable-binreloc --prefix=/usr/ make mkdir ~/AppDir make install DESTDIR=~/AppDir cd ~/AppDir/usr/bin/ ln -s ../share/geany/geany.glade geany.glade ./geany
LISTING 3:
sudo apt install cmake g++ qt5-default openssl libssl-dev libzip-dev qtbase5-private-dev qtdeclarative5-dev qtwebengine5-dev qt5keychain-dev qttools5-dev sqlite3 libsqlite3-dev libqt5svg5-dev zlib1g-dev libqt5websockets5-dev qtquickcontrols2-5-dev shared-mime-info sudo apt install cmake g++ qtbase5-dev openssl libssl-dev libzip-dev qtbase5-private-dev qtdeclarative5-dev qtwebengine5-dev qt5keychain-dev qttools5-dev sqlite3 libsqlite3-dev libqt5svg5-dev zlib1g-dev libqt5websockets5-dev qtquickcontrols2-5-dev shared-mime-info wget https://github.com/nextcloud/desktop/archive/refs/heads/master.zip sudo apt install zip unzip master cd desktop-master mkdir ~/nextcloud-desktop-client cmake -S . -B build -DCMAKE_INSTALL_PREFIX=~/nextcloud-desktop-client -DCMAKE_BUILD_TYPE=Release sudo apt install libkf5archive-dev sudo apt install inkscape sudo apt install python3-sphinx texlive-latex-extra doxygen libcmocka-dev libkf5kio-dev extra-cmake-modules sudo cmake --build build --target install cd ~/nextcloud-desktop-client/bin/ ./nextcloud echo "/home/linuxmag/nextcloud-desktop-client/lib" | sudo tee --append /etc/ld.so.conf.d/x86_64-linux-gnu.conf sudo ldconfig
LISTING 4
sudo apt install cmake g++ qtbase5-dev openssl libssl-dev libzip-dev qtbase5-private-dev qtdeclarative5-dev qtwebengine5-dev qt5keychain-dev qttools5-dev sqlite3 libsqlite3-dev libqt5svg5-dev zlib1g-dev libqt5websockets5-dev qtquickcontrols2-5-dev shared-mime-info zip libkf5archive-dev inkscape python3-sphinx texlive-latex-extra doxygen libcmocka-dev libkf5kio-dev extra-cmake-modules wget https://github.com/nextcloud/desktop/archive/refs/heads/master.zip unzip master cd desktop-master cmake -S . -B build -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release sudo cmake --build build --target install