Skip to content

Instantly share code, notes, and snippets.

View theSoberSobber's full-sized avatar
🐢

Pavit Chhabra theSoberSobber

🐢
View GitHub Profile
@theSoberSobber
theSoberSobber / fetch-spy.js
Created April 6, 2025 08:22
Fetch Spy: Monkey Patching Fetch, Import at the top before using any fetch or using any Lib that uses fetch to inspect it's network requests
import { writeFileSync } from "fs";
const originalFetch = globalThis.fetch.bind(globalThis);
function safeStringifyDeep(obj, seen = new WeakSet()) {
if (obj === null || typeof obj !== 'object') return obj;
if (seen.has(obj)) return "<<Circular>>";
seen.add(obj);
@theSoberSobber
theSoberSobber / Redis Locks Weird Service.js
Last active February 10, 2025 21:03
A is supposed to be someone that generates a resource and requests it to perform an action, A waits min (max of TTL, write lock acquiring time , message to quit), B is an ack verification from the resource of a task so A stops requesting more resources, C is a service that forcefully says that A should stop and the task is done, it reads the las…
import { Injectable, OnModuleInit } from '@nestjs/common';
import { InjectRedis } from '@liaoliaots/nestjs-redis';
import { Redis } from 'ioredis';
import { v4 as uuidv4 } from 'uuid';
@Injectable()
export class RedisService implements OnModuleInit {
private redisSubscriber: Redis;
constructor(@InjectRedis() private readonly redis: Redis) {}
@theSoberSobber
theSoberSobber / reddit-acronyms.csv
Created January 14, 2025 06:31
Reddit Acronyms
Acronym Full Form
AFAIK As Far As I Know
AMA Ask Me Anything
CMV Change My View
DAE Does Anyone Else
ELI5 Explain Like I'm 5
ETA Edited To Add
FTFY Fixed That For You
FWIW For What It's Worth
IANAD I Am Not A Doctor
@theSoberSobber
theSoberSobber / Slide Extractor Try By Clustering [Workflow]
Created November 4, 2024 11:21
Trying Slide Extraction by Clustering on Clip Embeddings in Embeddings Space
yt-dlp https://www.youtube.com/watch?v=6T46sgty4Mk -o test-2
mkdir img
git clone https://github.com/LexCybermac/smlr
ffmpeg -i test-2.mp4 -vf "fps=1" img/frame_%04d.png
pip install torch torchvision numpy Pillow transformers tqdm pathlib annoy scipy
python .\smlr.py --image_directory .\img\ --clip_model openai/clip-vit-base-patch16 --threshold 0.22 --batch_size 192
Or (didn't try)
https://colab.research.google.com/github/roboflow-ai/notebooks/blob/main/notebooks/image_embeddings_analysis_part_1.ipynb
import cv2
import numpy as np
from PIL import Image, ImageDraw, ImageFont
import os
import shutil
debug = False
# UI using ShadCN, fast iteraation, learn how to do streaming UIs though
@theSoberSobber
theSoberSobber / cam-enum.cpp
Created May 16, 2024 17:47
create a user_agents.txt and IPs.txt in the same directory, int user_agents.txt paste the comment at the end, needs libcurl, install by sudo apt-get install libcurl4-openssl-dev, compile using ++ -o scanner main.cpp -lcurl -pthread
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <thread>
#include <curl/curl.h>
#include <cstdlib>
#include <ctime>
#include <sstream>
#include <mutex>
@theSoberSobber
theSoberSobber / uploader-drive.py
Created May 12, 2024 20:04
Uploads a folder named test to drive with tag support, creates an index.json in the same directory, tags are to be supplied as meow,,cat,,animal,,pet.txt here meow.txt will be the name of the file and all others will be tags.
import os
from Google import Create_Service
from googleapiclient.http import MediaFileUpload
import hashlib
import json
API_NAME = 'drive'
API_VERSION = 'v3'
SCOPES = ['https://www.googleapis.com/auth/drive']
@theSoberSobber
theSoberSobber / profile.ps1
Last active January 25, 2025 13:19
Powershell Profile
# https://kevinlinxc.medium.com/how-hard-could-installing-autocomplete-for-powershell-be-4c8a2cbc69be
# Update-Module PowerShellGet -Force
# Install-Module -Name PSReadLine -AllowPrerelease -Scope CurrentUser -Force -SkipPublisherCheck
Invoke-Expression (& 'C:\Users\hp\scoop\shims\starship.exe' init powershell --print-full-init | Out-String)
Import-Module PSReadLine
Import-Module -Name Terminal-Icons
Set-PSReadLineOption -PredictionSource History
Set-PsFzfOption -PSReadlineChordProvider 'Ctrl+f' -PSReadlineChordReverseHistory 'Ctrl+r'
@theSoberSobber
theSoberSobber / c4.txt
Created March 16, 2024 07:52 — forked from turbo/c4.txt
This file has been truncated, but you can view the full file.
http://95.229.228.109:81/cgi-bin/faststream.jpg?stream=half&amp;fps=15&amp;rand=COUNTER
http://196.218.116.139:80/cgi-bin/viewer/video.jpg
http://213.240.185.79:50001/cgi-bin/faststream.jpg?stream=half&amp;fps=15&amp;rand=COUNTER
http://187.145.51.144:8083/cgi-bin/viewer/video.jpg
http://78.33.151.99:8888/mjpg/video.mjpg?COUNTER
http://84.244.69.110:80/cgi-bin/viewer/video.jpg
http://88.247.179.172:60001/cgi-bin/snapshot.cgi?chn=0&amp;u=admin&amp;p=&amp;q=0
http://76.70.29.102:2080/mjpg/video.mjpg?COUNTER
http://73.138.177.206:1024/mjpg/video.mjpg?COUNTER
http://188.235.132.145:80/cgi-bin/viewer/video.jpg
@theSoberSobber
theSoberSobber / connect-adb-tcpip.cpp
Last active March 4, 2024 19:53
Meant to be used with my hotkeydaemon sxhkd-win32 to be able to be used in conjuction with scrcpy, in addition one can use the ip widget app on android to make it even more seamless.
#include <windows.h>
#include <iostream>
#include <string>
#include <winuser.h>
HWND g_hTextBox;
HWND g_hButton;
LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);