Skip to content

Instantly share code, notes, and snippets.

View maanimis's full-sized avatar
💬

Meisam Maani maanimis

💬
View GitHub Profile
@maanimis
maanimis / extract-urls.js
Created May 26, 2025 23:23
Utility to extract TradingView script URLs
import fs from 'fs';
import readline from 'readline';
// Utility to extract TradingView script URLs (with or without protocol)
function extractTradingViewLinks(line) {
const regex = /(?:https?:\/\/)?(?:[a-z]+\.)?tradingview\.com\/script\/[a-zA-Z0-9-_]+/g;
return line.match(regex) || [];
}
// Main function to process files
@maanimis
maanimis / TradingView-Script-Downloader.js
Created May 26, 2025 23:04
Complete TradingView script downloading solution with batch processing and status tracking
// ==UserScript==
// @name TradingView Script Downloader
// @namespace http://tampermonkey.net/
// @version 5.0
// @description Complete TradingView script downloading solution with batch processing and status tracking
// @author You
// @match https://www.tradingview.com/script/*
// @match https://www.tradingview.com/*
// @grant GM_setValue
// @grant GM_getValue
@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
@maanimis
maanimis / GithubMultiView.user.js
Last active May 27, 2025 13:34
Redirect GitHub repositories to Gitingest, GitDiagram, or DeepWiki with a single click.
// ==UserScript==
// @name GithubMultiView
// @namespace Violentmonkey Scripts
// @match https://github.com/*
// @grant none
// @version 4.0
// @author maanimis
// @description Redirect GitHub repositories to Gitingest, GitDiagram, or DeepWiki with a single click.
// @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.