Skip to content

Instantly share code, notes, and snippets.

View itszechs's full-sized avatar
💭
Imagine coding alongside day job

zechs itszechs

💭
Imagine coding alongside day job
  • India
  • 07:07 (UTC +05:30)
View GitHub Profile
@itszechs
itszechs / stateflow.py
Created March 15, 2026 11:42
A lightweight Kotlin-style StateFlow for Python using RxPY, a reactive state container that always holds a current value and broadcasts updates to subscribers.
import multiprocessing
from threading import Lock
from typing import Callable, Generic, TypeVar
from reactivex import Observable
from reactivex import operators as ops
from reactivex.scheduler import ThreadPoolScheduler
from reactivex.subject import BehaviorSubject
T = TypeVar("T")
@itszechs
itszechs / oops.md
Last active February 22, 2025 03:50
Notes on OOP

Object Oriented Programming in JAVA

In object-oriented programming, you have classes and objects, unlike functional programming. There are 4 main pillars in OOP Paradigm.

Pillars of Object-Oriented Programming

  1. Abstraction
  2. Encapsulation
  3. Polymorphism
  4. Inheritance
var rows = Array.from(document.querySelectorAll('.myTableProxy tr'));
var output = '';
rows.slice(1).forEach((row, index) => {
var value = row.querySelector('td:first-child');
if (value) {
output += `${value.textContent.trim()}\n`;
}
});
console.log(output);
@itszechs
itszechs / play_mpv.py
Created December 31, 2023 10:05
A python simple python script to play public google drive links using mpv
from typing import Union
import requests
import sys
import re
import subprocess
GOOGLE_FILE_ID_REGEX = r"file/d/(.*)/"
GOOGLE_DRIVE_API_URL = "https://www.googleapis.com/drive/v3"
API_KEY = ""
interface Queue {
void enqueue(int data);
void dequeue();
int front();
int rear();
int size();
interface Stack {
void pop();
void push(int data);
int top();
void print();
int size();
interface LinkedList {
void add(int data);
void remove(int index);
int get(int index);
int length();
boolean isEmpty();
@itszechs
itszechs / copy_nyaa.js
Last active January 10, 2024 16:21
Copy all the magnet links from the page
const magnetLinksXPath = document.evaluate(
"//tr[@class='default']/td[@class='text-center'][1]/a[2]/@href",
document,
null,
XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,
null
);
const magnetLinks = [];
[
"ac31aa35a76d4b4718e68281226ce51d",
"3e4cb71cf6a2f28613595cad4b75691e"
]
@itszechs
itszechs / mongo.py
Created May 6, 2022 15:32
Mongo class for CRUD operations using pymongo
from typing import Any, List
import re
import pymongo
import urllib.parse
class MongoDb: