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 / DB.md
Created October 12, 2026 17:27
Explaining DB Guide For Students

Database Architectures

Relational Databases (RDBMS)

  • Core Properties: Enforces ACID (Atomicity, Consistency, Isolation, Durability). Guarantees immediate consistency; a transaction either fully completes or fully rolls back.
  • Scalability Model: Primarily vertical (scaling up hardware like CPU, RAM). Horizontal scaling is difficult and expensive due to strict consistency requirements.
  • Structure: Rigid, schema-based design. Data is stored in normalized tables with strict row/column constraints and foreign key relationships.
  • Expanded Examples: Oracle DB, PostgreSQL, MySQL, Microsoft SQL Server, MariaDB.
  • Target Use Cases: Banking, e-commerce checkout systems, ERP software, inventory management, or any domain where data integrity failure results in severe system or financial impact.
@smarteist
smarteist / YKD.md
Created September 22, 2026 18:21
YAGNI, KISS, and DRY

3 Simple Software Principles: YAGNI, KISS, and DRY

Three useful software principles are YAGNI, KISS, and DRY.

YAGNI: You Aren’t Gonna Need It

Build only what you need right now. Don’t add features just because you might need them later.

public class User {
@smarteist
smarteist / brave
Last active September 28, 2026 07:37
/home/$USER/.local/bin/google-chrome-stable
#!/bin/bash
export TZ="Europe/Berlin"
export LANG="de_DE.UTF-8"
export LC_TIME="de_DE.UTF-8"
# Keep application/UI messages in English
export LC_MESSAGES="en_US.UTF-8"
export LANGUAGE="en_US:en"
@smarteist
smarteist / rtk_agy.sh
Last active September 4, 2026 09:20
RTK for Antigravity CLI setup
#!/usr/bin/env bash
set -euo pipefail
CLI_SETTINGS_DIR="$HOME/.gemini/antigravity-cli"
SETTINGS_FILE="$CLI_SETTINGS_DIR/settings.json"
HOOKS_DIR="$HOME/.gemini/hooks"
SCRIPT_FILE="$HOOKS_DIR/rtk-hook-agy.sh"
# Ensure jq is installed
if ! command -v jq >/dev/null 2>&1; then
@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)`);
})();