Skip to content

Instantly share code, notes, and snippets.

View arafathusayn's full-sized avatar
👨‍💻
Focusing

Arafat Husayn arafathusayn

👨‍💻
Focusing
View GitHub Profile
@arafathusayn
arafathusayn / useEffect_alternative_example.tsx
Last active March 18, 2023 12:46
useEffect alternative for functional React components
import * as React from "react";
import { useState } from "react";
import withCleanup from "./withCleanup";
import withOnMount from "./withOnMount";
let loaded = false;
function Counter() {
const [count, setCount] = useState(0);
#!/usr/bin/env python3
import argparse
import glob
import os
import struct
import sys
from sentencepiece import SentencePieceProcessor
HPARAMS = keys = ["vocab_size", "dim", "multiple_of", "n_heads", "n_layers"]
@arafathusayn
arafathusayn / script.sh
Created October 4, 2023 12:09
Temp Fix for `bun install some-package@latest`
echo 'void async function() { const p = await Bun.file("package.json").json(); const out1 = Object.entries(p.dependencies).filter(([k,v]) => v === "latest").map(([k]) => k).reduce((acc, curr) => acc + " " +curr, "bun add"); const out2 = Object.entries(p.devDependencies).filter(([k,v]) => v === "latest").map(([k]) => k).reduce((acc, curr) => acc + " " +curr, "bun add -d"); console.log(`\n${out1}\n\n${out2}\n`) }()' > temp.js && bun run temp.js; rm temp.js
@arafathusayn
arafathusayn / log.md
Created April 3, 2024 17:54
How I migrated my database from PlanetScale
@arafathusayn
arafathusayn / content_script.js
Last active May 20, 2025 12:03
Remove "Reels and short videos" from Facebook News Feed with less than 35 lines of JavaScript code. It works both on Desktop and Mobile web version of Facebook.
chrome ??= browser;
function removeReels(node) {
if (!node) return;
const bannedInnerTexts = ["Reels and short videos", "Reels"];
const text = node.querySelector?.(`div > span[dir="auto"]`)?.innerText ?? "";
const matchedOnDesktop = bannedInnerTexts.find((t) => t === text);
const matchedOnMobile = bannedInnerTexts.includes(
node.querySelector("div > span")?.innerText,
);
@arafathusayn
arafathusayn / index.html
Created August 2, 2024 18:54
STUN/TURN ICE Server Test
<!DOCTYPE html>
<html>
<head>
<title>Test Stun/Turn Servers</title>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>