Skip to content

Instantly share code, notes, and snippets.

View mathieu-b's full-sized avatar

Mathieu Bosi mathieu-b

View GitHub Profile
@mathieu-b
mathieu-b / brightness.sh
Created June 25, 2024 23:03
Control the brightness of external displays via ddcutil on Linux
#!/usr/bin/env bash
#==============================================================================
# Script for setting the brightness of two displays using ddcutil.
# You could store this script at ~/.local/bin/brightness
# (with execute permissions, and ensuring that ~/.local/bin is in your PATH)
# and then call it from a keybinding, launcher, or directly from CLI.
# Example usages:
# brightness +10 (increase brightness by 10%)
# brightness -10 (decrease brightness by 10%)
@mathieu-b
mathieu-b / tail.py
Created March 12, 2024 09:12
An implementation of the 'tail -f' command in Python also supporting "file truncation" (similar to the original 'tail -f' command).
import os
import sys
import time
from typing import Iterator, IO
def tail_follow(file_path: str, polling_interval_seconds: float = 0.1) -> Iterator[str]:
"""
Simplified 'tail -f' implementation in Python.
@mathieu-b
mathieu-b / CH340_Ubuntu_22.04_setup.md
Last active September 26, 2024 07:18
CH340 Setup on Ubuntu 22.04 LTS (with required fixes)

The CH340 Drivers already come with the OS:

λ lsmod | grep -i ch34
ch341                  24576  0
usbserial              69632  3 usb_wwan,ch341,option

When connecting the CH340 device, at first it is recognized, but it will then be automatically disconneted after a short while:

@mathieu-b
mathieu-b / DisablingWindows10Telemetry
Created November 12, 2017 07:40
How to disable Telemetry and Data Collection in Windows 10
The state of affairs:
https://security.stackexchange.com/a/98184
Solution based on editing the registry and disabling a pair of services:
https://winaero.com/blog/how-to-disable-telemetry-and-data-collection-in-windows-10/
...plus using the Windows Firewall...?
https://winaero.com/blog/stop-windows-10-spying-on-you-using-just-windows-firewall/
@mathieu-b
mathieu-b / C++SingletonLifeCycle.cpp
Created August 10, 2017 10:09
Singleton lifecycle.
/******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.
https://www.onlinegdb.com/online_c++_compiler
*******************************************************************************/
@mathieu-b
mathieu-b / SetAppBundleIdentifierContinuously.cs
Created June 2, 2017 11:13
When Unity3D stubbornly resets / forgets your Android app package name...
// Put this script in your "Editor" scripts folder ;)
#if UNITY_EDITOR
using UnityEditor;
using UnityEngine;
[InitializeOnLoad]
class SetAppBundleIdentifierContinuously
{