Posts

Wireless printing from Android phone

Setup printer to connect to wifi ap, and note the printer's ip address Install Moria print service : https://play.google.com/store/apps/details?id=org.mopria.printplugin Add new printer using ip address Test printing a pdf file, choose moria print service Set printer plugin service app's setting to Battery - Unrestricted (required if having issue, page not printed fully) Dont skip step 3) even if your printer already in list Step 2) you can also install HP Print Service plugin              

Reduce PDF file size

We can use ghostscript or ps2pdf:   gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile=outputA.pdf input.pdf ps2pdf -dPDFSETTINGS=/screen input.pdf output.pdf   Ghostscript should produce more compatible output.pdf by running twice: gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output-Final.pdf outputA.pdf > Reference  

Regenerate SSH host keys

How to regenerate SSH host keys , when a server give error "connection closed" on SSH2_MSG_KEXINIT rm -f /etc/ssh/sshd_host* reboot # host key will be generated after reboot For Rocky Linux 8: Edit and comment lines in /etc/systemd/system/sshd-keygen@.service.d/disable-sshd-keygen-if-cloud-init-active.conf Or ssh-keygen -f /etc/ssh/ssh_host_rsa_key -N '' -q -t rsa ssh-keygen -f /etc/ssh/ssh_host_ecdsa_key -N '' -q -t ecdsa ssh-keygen -f /etc/ssh/ssh_host_ed25519_key -N '' -q -t ed25519 systemctl restart sshd  

Civilization VI launch options

Steam launch options for Civilization VI to run under Linux: env __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia __VK_LAYER_NV_optimus=NVIDIA_only LD_PRELOAD=/home/USERNAME/.local/share/Steam/ubuntu12_64/steam-runtime-heavy/usr/lib/x86_64-linux-gnu/libfontconfig.so.1 %command% To run using nvidia gpu, remove if not using nvidia: __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia __VK_LAYER_NV_optimus=NVIDIA_only   Load compatible library: LD_PRELOAD=/home/ USERNAME /.local/share/Steam/ubuntu12_64/steam-runtime-heavy/usr/lib/x86_64-linux-gnu/libfontconfig.so.1

xbox 360 game controller clone

My usb gamepad is detected but no button registered. To fix, install latest module from https://github.com/paroj/xpad sudo su git clone https://github.com/paroj/xpad.git /usr/src/xpad-0.4 dkms install -m xpad -v 0.4 reboot

Simple cctv using webcam

Install motion sudo dnf install motion Edit ~/.motion/motion.conf stream_port 8081 stream_localhost off # comment below to save .mkv movie_output off Run motion: motion Open browser from other device: http://desktop-ip:8081/

Tuning kernel arguments for energy efficiency

Image
Grub kernel arguments Current kernel arguments: grubby --info=0 index=0 kernel="/boot/vmlinuz-5.15.16-200.fc35.x86_64" args="ro rootflags=subvol=root rootflags=noatime rhgb quiet i915.enable_psr=1 i915.enable_fbc=1 rd.driver.blacklist=nouveau modprobe.blacklist=nouveau nvidia-drm.modeset=1 intel_idle.no_acpi=Y i915.enable_guc=3 " root="UUID=99cb8132-f86a-414d-8e5e-ecc4120b93b0" initrd="/boot/initramfs-5.15.16-200.fc35.x86_64.img" title="Fedora Linux (5.15.16-200.fc35.x86_64) 35 (Workstation Edition)" id="f8c8a08f7ded4ca9ad99a0345de7dae9-5.15.16-200.fc35.x86_64" i915.enable_psr=1 Enable PSR (panel self refresh) Optional: i915.enable_fbc=1 Enable frame buffer compression for power savings intel_idle.no_acpi=Y  Do not use ACPI _CST for building the idle states list (bool) i915.enable_guc=3 Enable GuC load for GuC submission and/or HuC load. To add new parameter use grubby, for example: grubby --update-kernel=ALL --args=&qu