Skip to content

Instantly share code, notes, and snippets.

@rhydb
rhydb / 99-monitor-hotplug.rules
Last active October 10, 2025 10:42
Set XFCE window scaling when 4k monitor connected/disconnected
ACTION=="change", SUBSYSTEM=="drm", ENV{DISPLAY}=":0", ENV{XAUTHORITY}="/home/USER/.Xauthority", RUN+="/usr/local/bin/udev-monitor-hook %E{DEVNAME} %p %E{ACTION} %k"
@rhydb
rhydb / calculator.cpp
Created July 27, 2021 10:44
Simple math expression parser in python and c++
#include <string>
#include <iostream>
#include <algorithm>
float
calculate(std::string exp)
{
char operators[] = {'+', '-', '*', '/'};
std::string buffer;
char op = -1;
@rhydb
rhydb / sdlboiler.c
Last active July 12, 2021 15:00
SDL App boilder plate
#include <SDL2/SDL.h>
#define SCREEN_WIDTH 1280
#define SCREEN_HEIGHT 720
int
main(void) {
SDL_Window *window = SDL_CreateWindow(
"Window Title",
SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
Function list_names {Get-ChildItem -Name}
Set-Alias -Name ls -Value list_names -Option AllScope
function prompt {
$(
if ( -join (Get-Location).Path -eq ($HOME)) {
$promptString = "[~]"
}
else {
if ((Get-Location).Path.Split("\").length -ge 3) {