Skip to content

Instantly share code, notes, and snippets.

View say4n's full-sized avatar
💻

Sayan Goswami say4n

💻
View GitHub Profile
@say4n
say4n / ddc-monitor-volume-control.md
Last active August 22, 2026 18:31
KDE Plasma: mirror media-key sink volume to monitor speaker gain over DDC/CI (Plasma 6 / Wayland)

media keys that actually control my monitor speakers

Setup: Dell S3221QS over DisplayPort, audio goes to the monitor from the GPU. KDE's volume keys only touched the PipeWire sink, which is digital attenuation applied before the signal ever leaves the PC. The monitor's own amp gain (DDC/CI VCP 0x62) sat wherever the OSD left it, so pressing volume down did way less than expected.

This daemon listens for kmix's media key events on D-Bus and copies the sink level to the monitor via ddcutil after every press. Plasma keeps ownership of

@say4n
say4n / tfl-total-userscript.js
Last active April 7, 2026 13:06
Computes total fare for a month with TFL.
// ==UserScript==
// @name TFL Fare Total
// @namespace https://contactless.tfl.gov.uk
// @match https://contactless.tfl.gov.uk/NewStatements/Billing*
// @match https://contactless.tfl.gov.uk/NewStatements/Journey*
// @version 2.0
// @description Computes total fares and statistics on TFL payment history pages
// @grant none
// ==/UserScript==
@say4n
say4n / annotate_photo.sh
Created August 24, 2025 17:48
Time and location stamp images from EXIF metadata.
#!/bin/bash
# --- Function to process a single image file ---
process_file() {
# The file path is passed as the first argument to the function
local FILE="$1"
# Check if the file exists before proceeding
if [ ! -f "$FILE" ]; then
echo "Error: File not found: $FILE" >&2
@say4n
say4n / karabiner-mouse-3-4-5.json
Created May 24, 2024 23:03
Karabiner mouse overrides!
{
"description": "Maps button 5 to left desktop switch, 4 to right desktop switch, 3 to mission control",
"manipulators": [
{
"from": {
"pointing_button": "button5"
},
"to": [
{
"key_code": "left_arrow",
@say4n
say4n / vanguard-real-return.js
Last active April 8, 2026 23:08
Compute real return instead of IRR on Vanguard UK's investment dashboard.
// ==UserScript==
// @name Vanguard UK Absolute Return Calculator
// @namespace Violentmonkey Scripts
// @match https://secure.vanguardinvestor.co.uk/*
// @grant none
// @version 1
// @author say4n
// @description Native UI version: Blends seamlessly with Vanguard's aesthetic.
// ==/UserScript==
(function() {
@say4n
say4n / excuses.txt
Created November 6, 2023 16:43 — forked from fortytw2/excuses.txt
programming excuses
Actually, that's a feature
Don't worry, that value is only wrong half of the time
Even though it doesn't work, how does it feel?
Everything looks fine my end
How is that possible?
I broke that deliberately to do some testing
I can have a look but there's a lot of if statements in that code!
I can't make that a priority right now
I can't test everything
I couldn't find any examples of how that can be done anywhere else in the project
@say4n
say4n / disconnected_components_in_graph.py
Created February 6, 2022 17:58
Finds the number of disconnected components in a graph.
def number_of_disconnected_components(self, adj: List[List[int]]) -> int:
n = len(adj)
visited = set()
components = 0
for i in range(n):
if i not in visited:
visited |= {i}
components += 1
@say4n
say4n / bufferoverflow.c
Last active September 28, 2021 18:06
Buffer Overflow
#include <stdio.h>
#include <string.h>
// Compile with GCC for buffer overflow. :)
// gcc -w -fno-stack-protector -o main main.c && ./main
int main(void) {
char A[8] = "";
unsigned short B = 1979;
@say4n
say4n / shenanigans.sh
Last active January 13, 2021 05:52
MacOS Shenanigans
# Disable Gatekeeper
sudo spctl --master-disable
# Enable Gatekeeper
sudo spctl --master-enable
@say4n
say4n / analyze.py
Created November 2, 2020 19:07
Google Takeout Analyzer
#! /usr/bin/env python3
from collections import defaultdict
from pprint import pprint
fname = "files.txt"
files = []
with open(fname, "rt") as f:
files = f.readlines()