Skip to content

Instantly share code, notes, and snippets.

View saper-2's full-sized avatar

saper-2

  • Poland
View GitHub Profile
@saper-2
saper-2 / README.md
Last active March 21, 2024 20:22
Windows 10 Windows Update forced reboot prevention using Task Scheduler

Tasks for Task Scheduler

2 tasks for Task Scheduler (taskschd.msc) to disable forced reboot in windows 10 (Home) version.

You can either save those 2 files as xml, and then immport to taskschd.msc and enable them. Or create those 2 task yourself - instructions below.

Create your own tasks in Task Scheduler

Task 1 - Kill notification processes

@saper-2
saper-2 / README.md
Created January 5, 2024 17:59
Debian on HP T620 terminal - hints

Installation tips

I use only Debian and net-inst image to install linux, and I use text install 😄

  • When partitioning primary disk where will be Debian installed, create first partiton of size 256-512M as EFI System partition - this will set this partition as Bootable, and FileSystem=vfat .
  • Don't forget about swap partition if you have not much too much RAM (at least of size of RAM), I usually create 4-8GB as 2nd partition on disk.
  • You can optionally create partition for /boot that have about 1-2GB , FS=ext4,
  • Or just use whole disk as / , FileSystem=ext4 - I almost always choose this setup - it's the most optimal.
@saper-2
saper-2 / README.md
Created January 4, 2024 12:22
Setup simple KIOSK on Raspbian 12 (Bookworm) with Wayland/Wayfire

Prereqs

  1. Burn raspios image on card - the one with desktop (no need to additional software) - tested using 2023-12-05-raspios-bookworm-arm64.img on RPi4 & RPi5.
  2. Install few additional packages to build a wayland plugin that hide cursor
    sudo apt install libglibmm-2.4-dev libglm-dev libxml2-dev libpango1.0-dev libcairo2-dev wayfire-dev libwlroots-dev libwf-config-dev meson
  3. Clone github repo: https://github.com/saper-2/wayfire-plugins-extra , and compile plugins (but not install them)

git clone https://github.com/WayfireWM/wayfire-plugins-extra && cd wayfire-plugins-extra

@saper-2
saper-2 / Program.cs
Last active June 11, 2023 19:59
Test code for checking if pageant or alike is running (C# .netFramework 4.7.2 console application)
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace ListPipes
@saper-2
saper-2 / readme.md
Last active June 9, 2023 16:39
USB capture on linux and view on Wireshark over ssh

This is easy, but to set it up for first time would need to look in few pages, here is everything in one place 😄

intro

I needed to sniff traffic on usb bus on my linux on which I was writting script for communicating with some usb device. So my setup is:

  • linux machine with usb device connected
  • Windows pc running wireshark

Linux setup (Debian based)

@saper-2
saper-2 / bom_csv_grouped_by_value_with_simple_fp.py
Created March 27, 2023 20:05
KiCAD 6.0 BOM script that don't add comma in Ref (this is easier to convert from CSV to e.g. xlsx) and strip Library name from footprint
#
# Example python script to generate a BOM from a KiCad generic netlist
#
# Example: Sorted and Grouped CSV BOM
#
"""
@package
Output: CSV (comma-separated)
Grouped By: Value, Footprint
@saper-2
saper-2 / README.md
Last active April 20, 2022 14:28
Preview monitor for Octoprint on Raspberry Pi and DSI screen

Pre-req.

  1. Raspberry Pi (2,3,4 ; 0 and 1 might be to weak... )
  2. Display - I used 5" DSI from BTT (BigTreeTech)
  3. Octoprint with mjpeg-streamer

Setup

  1. Burn latest RaspiOS (I used raspbian 11 bullseye 2022-04-04-raspios-bullseye-armhf-lite ) on SD,
  2. Create default user (pi) and enable ssh (fastes use headless method - need 2 files to drop on sd boot partition: userconf and ssh)
  3. Run raspi-config and enable kms driver (raspi-config will install some packages doing this): 8. -> A2. -> G2. , also set RaspiOS to console-autologin mode, don't reboot yet.
  4. Edit /boot/config.txt, find line with dtoverlay and vc4-kms... , change kms to fkms: dtoverlay=vc4-fkms-v3d - otherwise vlc won't work 😒 , now reboot,
@saper-2
saper-2 / .xsessionrc
Last active June 21, 2024 12:28
Kiosk mode in Rasberry Pi (raspbian/raspberry pi os)
#!/bin/sh
#
# ~/.xinitrc
#
# Executed by startx (run your window manager from here)
#Disable DPMS. (power save/blanking mode for display)
xset -dpms
xset s off
xset s noblank
@saper-2
saper-2 / restart-services.sh
Last active July 4, 2020 23:04
Script for testing if interface works ok and restart some services after interface recovers from failure.
#!/bin/bash
# script for checking if specified interface is UP and properly connected to network (so ping can work)
# enter test ping address. IF ping fails it's marked by creation of file. When ping starts working again
# it restart few services (domoticz, mosquitto, samba) and docker containers (you need to specify your
# own containers IDs).
# script also write to syslog when the ping fail first time (when interface failed), and when recovered.
# crontab entry for running every 1min:
# * * * * * /root/restart-services.sh >/dev/null 2>&1
@saper-2
saper-2 / client.ovpn
Created May 26, 2020 15:49
OpenVPN Mikrotik
#client, protocol TCP, set file name as you like - it'll be displayed in OpenVPN client as connection name.
proto tcp-client
remote domain.com 12345 # Remote OpenVPN Server DNS/IP and port
# tap allow to access LAN traffic without additional routing - not supported by ios and Android
dev tap
# 'tun' - require additional routing to access LAN resources, but works with android and ios
nobind
persist-key
persist-tun