Skip to content

Instantly share code, notes, and snippets.

@jranil
jranil / Crowd_Estimator_polygons.py
Created July 6, 2026 16:56
Crowd Estimator using OSM & Folium
"""
Advanced Crowd Estimator — robust OSM land-use analysis
"""
import json, time, webbrowser, requests
from threading import Timer
from flask import Flask, request, jsonify, render_template_string
from pyproj import Geod, Transformer
from shapely.geometry import Polygon, LineString
from shapely.ops import unary_union, transform as shp_transform
@jranil
jranil / reset_to_minimal.sh
Created March 23, 2026 22:20
"reset" a ubuntu server to a minimal state without doing a full reinstall
#!/bin/bash
set -e
echo "=== Step 1: Preserve critical configs ==="
# Backup SSH and network configs
cp -r /etc/ssh /root/ssh_backup
cp -r /etc/netplan /root/netplan_backup 2>/dev/null || true
cp /etc/network/interfaces /root/interfaces_backup 2>/dev/null || true
echo "=== Step 2: Stop and disable non-essential services ==="
@jranil
jranil / TeamTrack.py
Created April 5, 2025 15:05
A Python script that generates a comprehensive Excel/Google Sheets Kanban-style task tracking (To Do, In Progress, Blocked, Done) compatible task tracking system with automated dashboards.
import pandas as pd
import os
from datetime import datetime, timedelta
import openpyxl
from openpyxl.styles import PatternFill, Font, Alignment, Border, Side
from openpyxl.utils import get_column_letter
from openpyxl.chart import BarChart, Reference, LineChart
from openpyxl.worksheet.datavalidation import DataValidation
@jranil
jranil / ps-file-merger.ps1
Created March 19, 2025 12:51
PowerShell script that creates a comprehensive project snapshot by generating a single text file containing directory structure and file contents. Useful for code reviews, documentation, and sharing project snapshots without version control.
# Get current date in YYYY-MM-DD format
$currentDate = Get-Date -Format "yyyy-MM-dd"
# Get the current folder name
$currentFolderName = Split-Path -Path (Get-Location).Path -Leaf
# Define output file path one folder above the current location with date prefix
$parentFolder = Split-Path -Path (Get-Location).Path -Parent
$outputFile = Join-Path -Path $parentFolder -ChildPath "$currentDate-$currentFolderName`_merged.txt"
@jranil
jranil / EventLogSummary.ps1
Created March 15, 2025 16:22
This PowerShell script analyzes Windows System event logs for the last 30 days and generates a CSV report showing the first and last event time for each day.
# Script to extract first and last event times from Windows System logs for the last 30 days
# For Temporary bypass (single session) run the command below
# Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
# Get current date for calculation
$today = Get-Date
$startDate = $today.AddDays(-30)
# Initialize array to store results
$results = @()
@jranil
jranil / network-test-neshan.ps1
Created September 6, 2024 21:24
PowerShell script to check neshan.org connectivity
# Test-Neshan.ps1
# Function to get the public IP address
function Get-PublicIP {
try {
$ip = Invoke-RestMethod -Uri 'https://api.ipify.org'
return $ip
} catch {
return "Unable to determine"
}
@jranil
jranil / .deps...npm...@openzeppelin...contracts...access...Ownable.sol
Created July 12, 2024 19:43
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.26+commit.8a97fa7a.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)
pragma solidity ^0.8.20;
import {Context} from "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
@jranil
jranil / Household TD-LTE for IPTV and VoD
Created October 26, 2023 15:42
Household TD-LTE for IPTV and VoD
Date, Usage , Billed , Free , Total , Weekday
2023-02-11," 2,352.0 "," 2,352.0 ", 70.0 ," 2,422.0 ",1
2023-02-12," 10,221.2 "," 10,221.2 ", 25.0 ," 10,246.2 ",2
2023-02-13," 3,843.3 "," 3,843.3 ", 2.5 ," 3,845.8 ",3
2023-02-14," 2,799.9 "," 2,799.9 ", 246.4 ," 3,046.3 ",4
2023-02-15," 3,372.5 "," 3,372.5 ", 174.5 ," 3,547.0 ",5
2023-02-16," 2,656.0 "," 2,656.0 ", 12.6 ," 2,668.6 ",6
2023-02-17," 4,987.1 "," 4,987.1 ", 5.0 ," 4,992.1 ",7
2023-02-18," 16,001.6 "," 16,001.6 ", 720.6 ," 16,722.3 ",1
2023-02-19," 1,861.7 "," 1,861.7 ", 0.6 ," 1,862.3 ",2
||cdn.asriran.com/files/adv/*.gif$image
*mediacdn.mediaad.org*$domain=www.varzesh3.com,image
www.digikala.com##li:nth-of-type(3) > .is-plp.js-product-box.c-promotion-box.c-product-box
||cdn.isna.ir/d/*.gif$image
ad.utop.ir$domain=www.namasha.com,image
||s*.namasha.com/videos/*.mp4$media
||storage.beytoote.com/images/adsbeytoote/*$image
||tavoos.net/*$image
||mediacdn.mediaad.org/*$subdocument
tejaratnews.com##.mediaad-notif-header
@jranil
jranil / Bolton-TheRoomWhereItHappened-WordCloud.svg
Created June 22, 2020 10:34
The Room Where It Happened - Word Cloud - John Bolton
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.