Skip to content

Instantly share code, notes, and snippets.

View Nusab19's full-sized avatar
😪
Bored

Nusab Taha Nusab19

😪
Bored
View GitHub Profile
#pylint:disable=W0621
import math
def prime(n):
# Handle base cases
if n < 2:
return 0
if n == 2 or n == 3:
return 1
#include <iostream>
#include <cmath>
#include <string>
#include <iomanip>
bool prime(unsigned long long n) {
if (n <= 1) return false;
if (n <= 3) return true;
if (n % 2 == 0 || n % 3 == 0) return false;
@Nusab19
Nusab19 / main.py
Created April 20, 2025 10:57
Code to disable access policy in cloudflare pages
#!/usr/bin/env python3
import requests
import sys
# Configure these variables with your actual Cloudflare account details
ACCOUNT_ID = "your_account_id_here" # eg. "6a2784243169ac723308b65ae743e5ca"
API_TOKEN = "your_api_token_here" # eg. "a-FJVHPa04_9TS0L5RjYIcTgtLfc8NwP9PNqyd6m"
def main():
@Nusab19
Nusab19 / textarea.tsx
Created February 1, 2025 20:48
Auto-growing Textarea of ShadCN
import * as React from "react";
import { cn } from "@/lib/utils";
const Textarea = React.forwardRef<
HTMLTextAreaElement,
React.ComponentProps<"textarea">
>(({ className, ...props }, ref) => {
const textareaRef = React.useRef<HTMLTextAreaElement | null>(null);
const calculateHeight = React.useCallback(() => {
from flask import Flask, request, jsonify, send_file
from flask_cors import CORS
import os
import yt_dlp
import glob
app = Flask(__name__)
CORS(app)
DOWNLOAD_DIR = os.path.join(os.getcwd(), "downloads")
@Nusab19
Nusab19 / youtubeSpeedContorller.js
Last active July 29, 2024 04:14
Use keyboard to control the video speed in youtube.com. A script to be used in TamperMonkey browser extension
// ==UserScript==
// @name YouTube Video Speed Controller
// @namespace https://your.namespace.here
// @version 3.3.1
// @description Control playback speed on YouTube with keyboard.
// @author Nusab Taha
// @license MIT
// @match https://www.youtube.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=youtube.com
// ==/UserScript==
@Nusab19
Nusab19 / main.min.js
Last active June 25, 2023 18:11
Take input in NodeJS for Online Judges. This is the short version.
// Credit: Nusab Taha @Nusab19
// Gist: https://gist.github.com/Nusab19/fc8d96ae73a910acb8403758dc41f8c5
let _inputData="",_inputArray=[],_count=-1;function input(){let n=_inputArray[_count];return _count++,n}process.stdin.setEncoding("utf8"),process.stdin.on("data",(function(n){_inputData+=n})),process.stdin.on("end",(function(){_inputArray=_inputData.split("\n"),input(),main()}));
// You need to code everything in this main function.
function main() {
// input function will return a `string` or `undefined`.
// `undefined` means there's no more input left.
@Nusab19
Nusab19 / main.js
Last active June 25, 2023 18:12
Take input in NodeJS for Online Judges. This is the long version.
// Credit: Nusab Taha @Nusab19
// Minimized Version: https://gist.github.com/Nusab19/fc8d96ae73a910acb8403758dc41f8c5
// Do not change anything from here....
let _inputData = "";
let _inputArray = [];
let _count = -1;
process.stdin.setEncoding("utf8");
process.stdin.on("data", function (chunk) {
_inputData += chunk;
});