Skip to content

Instantly share code, notes, and snippets.

View parthibx24's full-sized avatar
🧷
busy procrastinating

Inxpired parthibx24

🧷
busy procrastinating
View GitHub Profile

linux & msys

./emsdk install latest
./emsdk activate latest
source ./emsdk_env.sh
@parthibx24
parthibx24 / scaling-timeline.md
Last active October 23, 2025 22:03
scaling in stages

Minimum scaling features on each stage of a saas production timeline.

MVP Stage (1x users)

  1. Rate Limit in VM (traefik/nginx): for backend+frontend, manually set req/sec.
  2. Db redis cache: for backend (Optional, but this always helps)
  3. Frontend, Backend, DB each should have their own container (Docker is ok)

Doing this would keep the product functional for atleast some users. but it is better to write tests/benchmark script to find the optimal req/sec value for the specific vm config (not sure).

Production Stage (Has few/10x users)

  1. Frontend CDN or S3 deploy: now VM mostly deals with backend and DB.
root@XiaoQiang:~# nvram set flag_boot_success=0
root@XiaoQiang:~# nvram set flag_try_sys1_failed=1
nvram commit
root@OpenWrt:~# insmod qdf
[  158.164364] qdf: Unknown symbol cfg80211_vendor_cmd_reply (err 0)
[  158.164475] qdf: Unknown symbol __dynamic_pr_debug (err 0)
failed to insert /lib/modules/4.4.60/qdf.ko
root@OpenWrt:~# insmod cfg80211
[  317.686176] Unable to handle kernel NULL pointer dereference at virtual address 00000004
[  317.686207] pgd = 85f4c000
[  317.693499] [00000004] *pgd=46f54831, *pte=00000000, *ppte=00000000
@parthibx24
parthibx24 / DS.md
Last active January 13, 2025 15:59

Definition

Data Structures are different ways how we organize collection of data in comupter memory for faster/efficient/easier access to a perticular data in that collection. Data structure goes hand in hand with algorithm, at first we organize collection of data in a specific way, which we call a Data Structure and then we write some instructions/steps to how we can access/modify/insert/delete individual elements in that Data Structure, which we call an algorithm for that Data Structure.

The most basic data structure is a fixed size array. An array stores all of its elements next to each other, meaning if an array holds all of its data in memory range of 0-15 and it stores int type values then each element will occupy 4 bytes. So, when data is inserted it will put the first int in memory 0-3, next will be put in 4-7, next is 8-11, next is 12-15. So, basically to in an int array the data at i index will be at the memory position of i*4 and it will occupy the range i*4-(i*4)+3. And there are many a

# os_offset=`echo $(($(nvram get flag_boot_rootfs)-1)) | tr -d '-'`
r0_mtd=$(grep '"rootfs"' /proc/mtd | awk -F: '{print substr($1,4)}')
r1_mtd=$(grep '"rootfs_1"' /proc/mtd | awk -F: '{print substr($1,4)}')
os_idx=$(nvram get flag_boot_rootfs)
mtd_cur=$(($r0_mtd+${os_idx:-0}))
mtd_nxt=$(($r0_mtd+$r1_mtd-$mtd_cur))
MTD_DEV=/dev/mtd$mtd_nxt
ubiformat $MTD_DEV -f $IMAGE -s 2048 -O 2048

settings.json

{
    "$help": "https://aka.ms/terminal-documentation",
    "$schema": "https://aka.ms/terminal-profiles-schema",
    "actions": 
    [
        {
            "command": "find",
            "keys": "ctrl+shift+f"

1. Configure redsocks

/etc/redsocks.conf

base {
        log_debug = off;
        log_info = on;
        log = "syslog:local7";
        daemon = on;
        redirector = iptables;
}
/** html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Bitfield Visualization</title>
<style>
canvas {
border: 1px solid black;
  mount [root] /mnt/nix
  mount -o umask=077 [boot] /mnt/nix/boot
  
  nixos-install --root /mnt/nix --flake [flakeuri]#[osname]
  # flakeuri: https://nix.dev/manual/nix/2.18/command-ref/new-cli/nix3-flake#examples
  
  passwd [username]