Skip to content

Instantly share code, notes, and snippets.

View mvandermeulen's full-sized avatar

Mark mvandermeulen

  • Fivenynes
  • Sydney, Australia
  • 23:09 (UTC +10:00)
View GitHub Profile
import time
import threading
import uuid
from redis import Redis
# Configuration
REDIS_HOST = "localhost"
REDIS_PORT = 6379
MASTER_KEY = "master"
MASTER_TTL = 10 # Time-to-live for master key
@mvandermeulen
mvandermeulen / Event_Loop.md
Created August 17, 2025 02:45 — forked from kassane/Event_Loop.md
Explain Event Loop

Event Loop

In computer science, the event loop, message dispatcher, message loop, message pump, or run loop is a programming construct that waits for and dispatches events or messages in a program.

It works by making a request to some internal or external "event provider" (that generally blocks the request until an event has arrived), and then it calls the relevant event handler ("dispatches the event").

The event-loop may be used in conjunction with a reactor, if the event provider follows the file interface, which can be selected or 'polled' (the Unix system call, not actual polling).

The event loop almost always operates asynchronously with the message originator.

@mvandermeulen
mvandermeulen / README.md
Created August 17, 2025 02:44 — forked from maelvls/README.md
My hundred struggles while using Linux as my desktop driver (Ubuntu 22.04)

My hundred struggles while using Linux as my desktop driver (Ubuntu 24.04)

Hi! On Thursday 25 April 2021, I entirely switched from macOS to Linux: https://maelvls.dev/evolution-of-my-home-office/. I took note of every adjustment I had to make along the way. I use Ubuntu "vanilla" (with Gnome as my desktop manager).

🔥 Update 26 June 2023: I am abandoning "desktop" Linux! I can't bear having to work around everything all the time, not even counting the tons of problems that occur whenever I do a major version upgrade (e.g., when I upgraded from 21.10 to 22.04, my PPAs broken obviously, and also I lost all the hack I had made to the /etc to work around problems). I am officially back to macOS starting 26 June 2023. I'll still use my Linux workstation remotely over Mosh, but not as a desktop environment. To learn more: https://hackmd.io/@maelvls/my-macos-tweaks


My other articles:

@mvandermeulen
mvandermeulen / remotepaste.md
Created August 17, 2025 02:36 — forked from burke/remotepaste.md
This sets up keybindings in tmux that allow you to copy/paste to/from your OS X clipboard from tmux running inside an SSH connection to a remote host. Partially borrowed from http://seancoates.com/blogs/remote-pbcopy

Local (OS X) Side

~/Library/LaunchAgents/pbcopy.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
     <key>Label</key>
     <string>localhost.pbcopy</string>
@mvandermeulen
mvandermeulen / pane.sh
Created August 17, 2025 02:36 — forked from kunalb/pane.sh
zsh + tmux + fzf + rg - autocomplete words in command
function _print_all_panes() {
for pane_id in $(tmux list-panes -F '#{pane_id}'); do
tmux capture-pane -p -J -S 0 -E - -t "$pane_id" | tr ' ' '\n' | sort -u | rg '[a-zA-Z0-9]+'
done
}
_tmux_pane_words() {
local current_word="${LBUFFER##* }"
local new_rbuffer="${RBUFFER/#[^ ]##/}"
local prompt="${LBUFFER% *} ␣ $new_rbuffer "
@mvandermeulen
mvandermeulen / tmux-connect.sh
Created August 10, 2025 09:36 — forked from QuAzI/tmux-connect.sh
Reverse shell for NAT users with tmux+socat+ssh
#!/bin/sh
#
# Run this script on relay_server to connect shared session
#
read -p "Port number: " relay_port
socat file:`tty`,raw,echo=0 tcp-connect:localhost:${relay_port}
@mvandermeulen
mvandermeulen / split.zsh.md
Created July 31, 2025 23:46 — forked from mattmc3/split.zsh.md
ZSH - split string into array

There are a ton of different ways to split up a string in Zsh. This gist attempts to show them with examples to help you build your own. I write Zsh scripts all the time, and still reference back to this gist, so there you go.

From the Zsh docs on Parameter Expansion Flags (yeah - I know... how would anyone ever find that if they didn't know where to look!?)

j:string: Join the words of arrays together using string as a separator.
s:string: Force field splitting at the separator string.

You can also read more by running man zshexpn. (Again, I know, right!? How would anyone know to look there!?)

@mvandermeulen
mvandermeulen / string_manipulation.md
Created July 31, 2025 22:06 — forked from valosekj/string_manipulation.md
Useful string manipulation examples for bash and zsh #blog

Useful string manipulation examples for bash and zsh

I need very often to modify filenames or replace/delete their parts across huge number of files. I was using sed command for these purposes but recently I have found out that all these tasks can be easily done directly in bash (or zsh) because both of them support so called string manipulation operations.

String manipulations

Define some example string:

$ file=some_file_name.txt
@mvandermeulen
mvandermeulen / zendesk.md
Created July 31, 2025 21:47 — forked from hackermondev/zendesk.md
1 bug, $50,000+ in bounties, how Zendesk intentionally left a backdoor in hundreds of Fortune 500 companies

hi, i'm daniel. i'm a 15-year-old with some programming experience and i do a little bug hunting in my free time. here's the insane story of how I found a single bug that affected over half of all Fortune 500 companies:

say hello to zendesk

If you've spent some time online, you’ve probably come across Zendesk.

Zendesk is a customer service tool used by some of the world’s top companies. It’s easy to set up: you link it to your company’s support email (like [email protected]), and Zendesk starts managing incoming emails and creating tickets. You can handle these tickets yourself or have a support team do it for you. Zendesk is a billion-dollar company, trusted by big names like Cloudflare.

Personally, I’ve always found it surprising that these massive companies, worth billions, rely on third-party tools like Zendesk instead of building their own in-house ticketing systems.

your weakest link

@mvandermeulen
mvandermeulen / README.md
Created July 27, 2025 20:24 — forked from Tishka17/README.md
Fastpi Depends Stub

This Stub class is designed as a workaround for Fastapi Depends which mixes IoC-Container features with request parsing.

You can use parametrized Stub instance to declare dependency whilst not show your class'es __init__ params in OpenAPI specification.