Skip to content

Instantly share code, notes, and snippets.

View AmirMohamadBabaee's full-sized avatar

Amir01 AmirMohamadBabaee

View GitHub Profile
@pourmand1376
pourmand1376 / sharif_login.sh
Last active March 29, 2025 08:03
Sharif Login
function sharif_login
{
curl -d "username=$1&password=$2" -X POST "https://net2.sharif.edu/login" > /dev/null
curl -s https://net2.sharif.edu/status | grep -o '<td>.*</td>'
sleep 1s # To See login status
}
function sharif_ip
{
# from ping net2.sharif.edu
# this is written since sometimes DNS server doesn't work!
@Flunzmas
Flunzmas / pygt_loader.py
Created September 27, 2021 12:25
DataLoader for pytorch-geometric-temporal (direct extension of the loader from pytorch-geometric)
from typing import Union, List, Optional
from collections.abc import Mapping, Sequence
import torch.utils.data
from torch.utils.data.dataloader import default_collate
from torch_geometric.data import Data, HeteroData, Dataset, Batch
from torch_geometric_temporal.signal import StaticGraphTemporalSignal as SGTS
from torch_geometric_temporal.signal import DynamicGraphTemporalSignal as DGTS
from torch_geometric_temporal.signal import DynamicGraphStaticSignal as DGSS
@yanqd0
yanqd0 / dl_requests_tqdm.py
Last active November 15, 2025 15:24
Python requests download file with a tqdm progress bar
import requests
from tqdm import tqdm
def download(url: str, fname: str, chunk_size=1024):
resp = requests.get(url, stream=True)
total = int(resp.headers.get('content-length', 0))
with open(fname, 'wb') as file, tqdm(
desc=fname,
total=total,
@jjwatt
jjwatt / yplay.scm
Last active December 25, 2025 23:58
The Y Combinator explained in a runnable Scheme file
;;; The Y Combinator explained in scheme.
;;; with credits to:
;;; https://mvanier.livejournal.com/2897.html
;;; Status: WIP
(define fibonacci
(lambda (n)
(cond ((= n 0) 0)
((= n 1) 1)
(else (+ (fibonacci (- n 1)) (fibonacci (- n 2)))))))
@sadimanna
sadimanna / clahe.py
Last active May 14, 2025 08:04
Contrast Limited Adaptive Histogram Equalization in Python
'''
"Contrast Limited Adaptive Histogram Equalization"
by Karel Zuiderveld, karel@cv.ruu.nl
in "Graphics Gems IV", Academic Press, 1994
_Author_ -- Siladittya Manna
The below implementation does not assume that the
X- and Y image resolutions are an integer multiple
of the X- and Y sizes of the contextual regions.
@foowaa
foowaa / position_encoding_transformer.py
Last active May 3, 2023 18:46
position encoding of Transformer on numpy
'''
numpy sinusoid position encoding of Transformer model.
params:
n_position(n):number of positions
d_hid(m): dimension of embedding vector
padding_idx:set 0 dimension
return:
sinusoid_table(n*m):numpy array
@bmershon
bmershon / .block
Last active January 13, 2023 13:06
Y Combinator
border: no
@kingspp
kingspp / logging.py
Created April 22, 2017 07:14
Python Comprehensive Logging using YAML Configuration
import os
import yaml
import logging.config
import logging
import coloredlogs
def setup_logging(default_path='logging.yaml', default_level=logging.INFO, env_key='LOG_CFG'):
"""
| **@author:** Prathyush SP
| Logging Setup
@oliveratgithub
oliveratgithub / made-with-love.html
Last active July 4, 2025 09:08
Various snippets to add "Made with love" to your website using HTML, CSS and JavaScript
<!-- Example #1 - no styling -->
Made with ❤ in Switzerland
Made with ♥ in Switzerland
Made with ♡ in Switzerland
Made with ❤️ in Switzerland
Made with ♥️ in Switzerland
<!-- Example #2 - inline-styled ❤ -->
Made with <span style="color: #e25555;">&#9829;</span> in Switzerland
Made with <span style="color: #e25555;">&hearts;</span> in Switzerland
@0xjac
0xjac / private_fork.md
Last active March 16, 2026 01:53
Create a private fork of a public repository

The repository for the assignment is public and Github does not allow the creation of private forks for public repositories.

The correct way of creating a private frok by duplicating the repo is documented here.

For this assignment the commands are:

  1. Create a bare clone of the repository. (This is temporary and will be removed so just do it wherever.)

git clone --bare git@github.com:usi-systems/easytrace.git