Skip to content

Instantly share code, notes, and snippets.

View Kjue's full-sized avatar

Mikael Lavi Kjue

View GitHub Profile
@Kjue
Kjue / gist:7e644a37254fb8d431580eb0e2daebb7
Created October 14, 2025 10:54
Python version of the server with socket CLI.
import socket
import os
import sys
import json
import signal
import pathlib
import tempfile
import time
SOCKET_PATH = pathlib.Path(tempfile.gettempdir()) / "python-app-daemon.sock"
@Kjue
Kjue / go-cli-socket-only.go
Created October 14, 2025 08:23
Go version of the server with socket CLI.
package main
import (
"encoding/json"
"fmt"
"io"
"log"
"net"
"os"
"os/signal"
@Kjue
Kjue / host-cli-with-worker.js
Last active October 14, 2025 08:51
Node CLI for any server using unix socket and non-blocking worker.
const cluster = require('node:cluster');
const net = require('node:net');
const fs = require('node:fs');
const os = require('node:os');
const path = require('node:path');
// ##################################################################
// ## Sample script that showcases a supposed server application #
// ## with integrated CLI. This sample establishes master with #
// ## worker process to address blocking concerns. #
@Kjue
Kjue / host-cli-socket-only.js
Created October 14, 2025 07:24
Node CLI for any server using unix socket
const net = require('node:net');
const fs = require('node:fs');
const os = require('node:os');
const path = require('node:path');
// ##################################################################
// ## Sample script that showcases a supposed server application #
// ## with integrated CLI. This sample foregoes the worker process. #
// ## It simply opens the socket and listens for commands. #
// ## Use this if you can guarantee the server is not blocked. #
@Kjue
Kjue / tampermonkey_move_teams_call_bar.js
Created September 5, 2022 07:57
Tampermonkey script: Move Teams Call Bar
// ==UserScript==
// @name Move Teams Call Bar
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Move the call functions bar on Microsoft Teams
// @author Mikael Lavi <mikael@lamek.fi>
// @match https://teams.microsoft.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=tampermonkey.net
// @grant none
// ==/UserScript==