Skip to content

Instantly share code, notes, and snippets.

View smarteist's full-sized avatar
🙂
I may be slow to respond.

Ali Hosseini smarteist

🙂
I may be slow to respond.
View GitHub Profile
@smarteist
smarteist / radar.py
Created July 9, 2026 07:51
LLM Friendly Project Context
#!/usr/bin/env python3
import argparse
import os
import subprocess
import json
from pathlib import Path
from typing import Set, Optional, Dict, List
from datetime import datetime
# Context Limits & Core Constants
@smarteist
smarteist / etsi_clone_latest.py
Last active June 30, 2026 19:32
Bash Script for Web Downloading
import os
import re
import requests
from bs4 import BeautifulSoup
from urllib.parse import urljoin
# Config
START_URL = "https://www.etsi.org/deliver/etsi_ts/"
DOWNLOAD_DIR = "./pdfs"
REQ_TIMEOUT = (10, 30)

Arrow functions — simple comparison

ES5 (need .bind to keep this):

const result = {
  name: "Hello",
  data: function () {
    setTimeout(function () {
      console.log(this.name);
    }.bind(this), 5000);
#!/usr/bin/env bash
set -e
# Configuration Variables
VM_NAME="VM1"
CPU_CORES="2"
RAM_SIZE="2048" # VirtualBox requires RAM in MB
VRAM_SIZE="16" # VRAM in MB
DISK_SIZE="20G"
@smarteist
smarteist / main.c
Created May 28, 2025 06:58
Example C Pointer
#include <stdio.h>
int main() {
// 1. Declaring a Pointer
int *ptr; // Pointer to an integer
// 2. Assigning Address to a Pointer
int var = 10;
ptr = &var; // ptr now holds the address of var
@smarteist
smarteist / Versioning.md
Created May 23, 2025 10:28
Version Specifications Documentation

Version Specifications Documentation

When specifying versions for packages or modules, you may encounter various formats. Below are the details and examples to help you understand and apply the correct version specifiers.


General Form

Semantic Versioning Explained

@smarteist
smarteist / extractHrefsAsBashArray.js
Last active February 21, 2025 16:59
extractHrefsAsBashArray
(function extractHrefsAsBashArray() {
const domain = window.location;
const links = document.querySelectorAll('body main.container div.list table.table tbody tr td a');
const hrefsArray = Array.from(links).map(link => {
const href = link.getAttribute('href');
return href ? (href.startsWith('http') ? href : domain + href) : '';
}).filter(href => href);
console.log(`urls=(\n ${hrefsArray.map(href => `"${href}"`).join('\n ')}\n)`);
})();
@smarteist
smarteist / .wezterm.lua
Last active August 2, 2025 06:57
My wezterm conf
local wezterm = require('wezterm')
local config = {}
local window_bell_notified = {} -- Key: window_id, Value: boolean
wezterm.on('window-focus-changed', function(window, pane, has_focus)
if window then
local window_id = window:window_id()
if has_focus then
window_bell_notified[window_id] = false
@smarteist
smarteist / kitty.conf
Last active September 1, 2025 05:22
My kitty conf
# Colors
background_opacity 0.95
#foreground #d2d7d7
#background #120e0a
#cursor #d2d7d7
#active_tab_foreground #120e0a
#active_tab_background #d2d7d7
#inactive_tab_foreground #d2d7d7
#inactive_tab_background #120e0a
#!/bin/bash
set -euo pipefail
exclude_networks=("1.2.3.4" "1.2.3.0/24")
for net in "${exclude_networks[@]}"; do
if sudo ip route del "$net" 2>/dev/null; then
echo "Deleted existing route for $net"
fi
done