Skip to content

Instantly share code, notes, and snippets.

@lukaszjablonski
lukaszjablonski / win-fr.bat
Last active March 17, 2022 11:37
Recursively find and replace files (Windows)
rem Recursively find and replace files
rem This script starts from current directory recursive search for the file name given in the first parameter and replace it (keeping its name) with the file given in second parameter.
rem source: https://stackoverflow.com/a/10423757
rem usage: fr.bat targetName replacementFile
rem example fr.bat test1.txt c:\data\replacementfile.txt would recursively search for "test1.txt" and replace it (keeping its name) withe the file "c:\data\replacementfile.txt"
@echo off
set targetName=%~NX1
set replacementFile=%~F2
call :processFolder
@lukaszjablonski
lukaszjablonski / git-cdc
Created July 18, 2018 10:48
Change the date of git commit
#!/bin/bash
# Change the date of git commit
# souce: https://stackoverflow.com/a/24584976
# usage: git cdc commit date
# example: git cdc @~ "2014-07-04 20:32:45" would reset date of the commit before HEAD "@~" to "2014-07-04 20:32:45"
#
# commit
# date YYYY-mm-dd HH:MM:SS
commit="$1" datecal="$2"
@lukaszjablonski
lukaszjablonski / ubuntu-install-xrdp.sh
Last active May 29, 2026 11:01
Install and fix issues of xrdp on Ubuntu (tested on 22.04)
#!/bin/bash
# Install and fix issues of xrdp on Ubuntu (tested on 22.04)
# v1.0.0
#
# References:
# * https://askubuntu.com/questions/1398732/multiple-users-use-linux-pc-at-the-same-time/1419949#1419949
# * https://superuser.com/questions/1479313/how-do-i-get-the-full-ubuntu-gnome-experience-via-xrdp/1655262#1655262
# * http://c-nergy.be/blog/?p=14051
@lukaszjablonski
lukaszjablonski / PowerShell-GUI.PS1
Last active May 29, 2026 11:01
PowerShell GUI example
# Init PowerShell GUI
Add-Type -AssemblyName System.Windows.Forms
# Create a new form
$GUIform = New-Object system.Windows.Forms.Form
$GUIform.MaximizeBox = $false # no maximize
$GUIform.FormBorderStyle = 'Fixed3D' # no resize
# Define the size, title and background color
$GUIform.ClientSize = '500,300'
@lukaszjablonski
lukaszjablonski / BT2USB-HIDbridge.md
Last active August 3, 2026 12:45
Raspberry Pi Zero 2 W Bluetooth-to-USB HID Bridge

Raspberry Pi Zero 2 W Bluetooth-to-USB HID Bridge

While Bluetooth keyboards are very common and often have a button to switch between multiple devices, I came across two major limitations. First, I sometimes need to access the BIOS/UEFI, which is not possible with a Bluetooth keyboard. Second, I use a single keyboard across three computers, one of which is dual-boot. Because the dual-boot machine acts as two separate devices, I have run out of available slots on my keyboard, which can only switch between three devices.

Motivation

Problem 1: Using Bluetooth keyboard with a multi-boot PC

Problem 2:

@lukaszjablonski
lukaszjablonski / install-show-apps-launcher.sh
Last active July 17, 2026 19:45
Install custom "Show Applications" launcher in Ubuntu
#!/bin/bash
# Install custom "Show Applications" launcher in Ubuntu
# Based on
# https://github.com/milanify/Ubuntu-Launchpad
echo "Installing Show Applications launcher..."
DESKTOP_FILE="/usr/share/applications/show-apps-launcher.desktop"
# Create .desktop file