Skip to content

Instantly share code, notes, and snippets.

View maanimis's full-sized avatar
💬

Meisam Maani maanimis

💬
View GitHub Profile
@maanimis
maanimis / Backup GitHub Repository.userscript.js
Created April 10, 2025 16:47
Backup GitHub repositories directly from user profile page
// ==UserScript==
// @name Backup GitHub Repository
// @namespace Violentmonkey Scripts
// @version 2.1
// @description Backup GitHub repositories directly from user profile page
// @author maanimis
// @match https://github.com/*?tab=repositories
// @grant GM_registerMenuCommand
// @grant GM_download
// @run-at document-end
// ==UserScript==
// @name GitHub Ingest Redirect
// @namespace Violentmonkey Scripts
// @match https://github.com/*
// @grant none
// @version 1.0
// @author maanimis
// @description redirect GitHub repositories to gitingest.com
// @grant GM_registerMenuCommand
// @run-at document-end
@maanimis
maanimis / Path-Notes-userscript.js
Created March 17, 2025 20:52
Add and save notes for different website paths
// ==UserScript==
// @name Path Notes
// @namespace Violentmonkey Scripts
// @version 2.0
// @description Add and save notes for different website paths
// @author maanimis
// @match *://*/*
// @grant GM_registerMenuCommand
// @run-at document-end
// @license MIT
@maanimis
maanimis / fdict-command.sh
Created March 17, 2025 08:22
translate to persian [cli]
alias fdict='function _fdict(){ curl -s "https://translate.googleapis.com/translate_a/single?client=gtx&sl=auto&tl=fa&dt=t&dt=bd&dj=1&q=$(echo $* | sed "s/ /%20/g")" | awk -F'"' "{print \$2}"; }; _fdict'
@maanimis
maanimis / X-Translator-userscript.js
Created March 13, 2025 08:39
Automatically translates tweets on X (formerly Twitter).
// ==UserScript==
// @name X-Translator
// @namespace https://yourdomain.com
// @version 1.2
// @description Automatically translates tweets on X (formerly Twitter).
// @author You
// @match *://*.x.com/*
// @grant GM_registerMenuCommand
// @grant GM_xmlhttpRequest
// @license MIT
@maanimis
maanimis / Code-Diff-Checker.userscript.js
Last active March 12, 2025 08:19
Compare differences between two code versions
// ==UserScript==
// @name Code Diff Checker
// @namespace http://tampermonkey.net/
// @version 2.0
// @description Compare differences between two code versions
// @author maanimis
// @match *://*/*
// @grant GM_registerMenuCommand
// @require https://cdnjs.cloudflare.com/ajax/libs/jsdiff/7.0.0/diff.min.js
// @run-at document-end
@maanimis
maanimis / sse.worker.js
Created February 15, 2025 18:48
SSE-cloudflare-worker.js
addEventListener("fetch", (event) => {
event.respondWith(handleRequest(event.request));
});
async function handleRequest(request) {
const { readable, writable } = new TransformStream();
const headers = new Headers({
"Content-Type": "text/event-stream",
"Cache-Control": "no-cache",
Connection: "keep-alive",
@maanimis
maanimis / README.md
Created February 15, 2025 18:35
The code enables real-time WebSocket messaging with Redis Pub/Sub.

From chatgpt

To implement WebSockets with Redis Pub/Sub for scalable, real-time communication across multiple servers, here’s a step-by-step example that combines WebSockets and Redis.

Architecture

  • WebSocket: Handles real-time communication between clients and the server.
  • Redis Pub/Sub: Allows the server to broadcast messages to all connected WebSocket clients, even when there are multiple instances of the server.

@maanimis
maanimis / README.md
Last active February 15, 2025 18:35
Server-Sent Events (SSE) in Node.js using Express

From chatgpt

Handling Load Balancers

  • SSE requires sticky sessions if behind a load balancer, like Nginx.
  • Example Nginx config for SSE:
location /events {
    proxy_pass http://your-node-server;
 proxy_set_header Connection '';
@maanimis
maanimis / YouTube-URL-Cleaner.js
Last active February 25, 2025 07:53
Clean YouTube URLs to only keep the video ID when Shift + Left Click is used
// ==UserScript==
// @name YouTube URL Cleaner
// @namespace http://tampermonkey.net/
// @version 1.6
// @description Clean YouTube URLs to only keep the video ID when Shift + Left Click is used and show a popup
// @author maanimis
// @match *://*.youtube.com/*
// @grant clipboardWrite
// @run-at document-end
// @license MIT