Skip to content

Instantly share code, notes, and snippets.

@5j9
5j9 / Sync-TimeHttpAdaptive.ps1
Created January 25, 2026 20:18
PowerShell high-accuracy time synchronization script using HTTP headers (Google) to bypass restricted or blocked NTP/UDP 123 ports. Developed for system clock recovery during the Iran internet shutdowns of January 2026. Features dynamic outlier trimming and latency compensation.
# ==============================================================================
# SCRIPT NOTE:
# This script was developed to synchronize the system clock during the
# internet shutdowns in Iran in January 2026. During this period, NTP servers
# were restricted, and only a limited number of sites (like Google) were
# accessible. This script uses HTTP headers to bypass those restrictions.
#
# ACCURACY NOTE:
# Standard HTTP 'Date' headers only provide precision to the nearest second.
# While this script compensates for network latency (RTT/2), the base data
@5j9
5j9 / Fusion_StickyInput_Buffer.ahk
Created January 25, 2026 19:50
AutoHotkey v2 script for Fusion.exe: Emulates "Sticky Keys" for navigation (ASDQWE/Arrows) to maintain input states during paused frame-advance workflows. Includes a CapsLock toggle and status indicator.
/*
================================================================================
FUSION 3D FRAME-ADVANCE INPUT BUFFER
================================================================================
USAGE:
1. Press [Pause] to halt the simulation/emulation in Fusion.
2. Toggle [A,S,D,Q,W,E,Arrows] to set the desired movement/action state.
3. Use the [Insert] key to advance frame-by-frame.
(The keys will remain "digitally held" thanks to this script).
4. Toggle [CapsLock] to instantly release all keys and disable sticky mode.
@5j9
5j9 / Fix-Windows-DisplayPort-Resizing.ps1
Last active January 7, 2026 04:36
Automates the fix for Windows windows resizing/shrinking to the top-left corner after the monitor sleeps. Dynamically detects current resolution and applies it to the "Simulated" and "NOEDID" registry profiles under GraphicsDrivers.
# Run this script as Administrator to fix the "DisplayPort/Sleep Resizing" bug.
# It syncs your active resolution with the Windows 'Simulated' fallback profiles.
# Check for Administrator privileges
if (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
Write-Warning "Please run this script as an Administrator!"
break
}
# 1. Get current screen resolution automatically
@5j9
5j9 / show_all_icons.py
Created August 15, 2025 17:28
PyQt6 List of Standard Icons
# A fork of https://joekuan.wordpress.com/2015/09/23/list-of-qt-icons/
# Modified to work with PyQt6 and also avoids using a hardcoded list.
# of icons.
from PyQt6.QtWidgets import (
QApplication,
QGridLayout,
QPushButton,
QStyle,
QWidget,
)
@5j9
5j9 / tg-link-handler-install.cmd
Last active November 3, 2025 12:12
telegram link default app handler installer/uninstaller .cmd
@5j9
5j9 / is_unique_time_complexity.py
Created November 27, 2024 02:53
time complexity of `pandas.DataFrame.index.is_unique` looks to be constant for unique index and linear for non-unique index
from timeit import timeit
import matplotlib.pyplot as plt
import pandas as pd
df = pd.DataFrame(range(10), columns=['A'])
times = []
lengths = []
for i in range(26):
# بیشترین بازده درصدی فصلی برای زمستان سال 1401 مربوط به کدام سبد دارایی زیر بوده است؟
# https://bashgah.com/Question/140201029/
from asyncio import run
from tsetmc.instruments import Instrument
from iranetf.sites import RayanHamafza
from iranetf import Session as IranETFSession
from tsetmc import Session
from jdatetime import date
import pandas as pd
# بیشترین بازده درصدی فصلی برای تابستان سال 1401 مربوط به کدام سبد دارایی زیر بوده است؟
# https://bashgah.com/Question/140201027/
from asyncio import run
from tsetmc.instruments import Instrument
from iranetf.sites import RayanHamafza
from iranetf import Session as IranETFSession
from tsetmc import Session
from jdatetime import date
import pandas as pd
@5j9
5j9 / bashgah.com_competition_140201025_solution.py
Last active April 25, 2023 15:54
A script to find the answer of bashgah.com's competition number 140201025
# بیشترین بازده درصدی فصلی برای بهار سال 1401 مربوط به کدام سبد دارایی زیر بوده است؟
# https://bashgah.com/Question/140201025/
from asyncio import run
from tsetmc.instruments import Instrument
from iranetf.sites import RayanHamafza
from iranetf import Session as IranETFSession
from tsetmc import Session
from jdatetime import date
import pandas as pd
@5j9
5j9 / bashgah.com_competition_140201013_solution.py
Last active April 4, 2023 16:15
A script to find the answer of bashgah.com's competition number 140201013
# a short script to solve the following problem
# https://bashgah.com/Question/140201013/%D8%B3%D9%88%D8%A7%D9%84%D8%A7%D8%AA-%D9%88%DB%8C%DA%98%D9%87-%D9%86%D9%88%D8%B1%D9%88%D8%B2-1402
# اگر شخصی از 1 بهمن 1400 و در اولین روز کاری هر ماه مبلغ 1میلیون تومان صندوق سرمایه‌گذاری با پشتوانه طلای زرین آگاه (با نماد مثقال) خریداری کرده باشد، در تاریخ 20 اسفند 1401 ارزش روز دارایی وی چقدر است؟
from itertools import pairwise
import pandas as pd
from jdatetime import date
# download history from
# http://www.tsetmc.com/loader.aspx?ParTree=151311&i=32469128621155736#