Skip to content

Instantly share code, notes, and snippets.

View MohamedElashri's full-sized avatar

Mohamed Elashri MohamedElashri

View GitHub Profile
@kklemon
kklemon / iterable_dataset_dist.py
Last active February 24, 2025 06:16
PyTorch IterableDataset implementation with multiprocessing and distributed training support
import torch
import torch.distributed as dist
import torch.multiprocessing as mp
from torch.utils.data import IterableDataset, DataLoader
class DistributedIterableDataset(IterableDataset):
"""
Example implementation of an IterableDataset that handles both multiprocessing (num_workers > 0)
@NiklasGollenstede
NiklasGollenstede / !openwrt-config.md
Last active April 23, 2025 19:34
OpenWRT on GL.iNET GL-AR750/MT300N_V2 with eduroam, openVPN client, and hardware switch

This shows how to flash OpenWRT to a GL.iNET GL-AR750 or GL-MT300N_V2 and how to set up eduroam, openVPN client, and their hardware switch.

Please read the content for more information.

@LeiHao0
LeiHao0 / Adguard.js
Last active October 16, 2024 15:25
Batch add block list in Adguard Home
// https://github.com/AdguardTeam/AdGuardHome/blob/master/openapi/openapi.yaml
old_blist = [];
blist = [
"https://raw.githubusercontent.com/FadeMind/hosts.extras/master/add.Spam/hosts",
"https://v.firebog.net/hosts/static/w3kbl.txt",
"https://raw.githubusercontent.com/matomo-org/referrer-spam-blacklist/master/spammers.txt",
"https://someonewhocares.org/hosts/zero/hosts",
"https://raw.githubusercontent.com/VeleSila/yhosts/master/hosts",
@paulo-amaral
paulo-amaral / install-latest-docker-compose.sh
Created June 1, 2020 06:21
Install latest version of Docker and Docker Compose
#!/bin/bash
set -e
#apt-get install -y curl
cat << "EOF"
___ _ _ ____ _____ _ _ _
|_ _| \ | / ___|_ _|/ \ | | | |
| || \| \___ \ | | / _ \ | | | |
| || |\ |___) || |/ ___ \| |___| |___
|___|_| \_|____/ |_/_/ \_\_____|_____|
@ishad0w
ishad0w / sources.list
Created April 30, 2020 16:55
Ubuntu 20.04 LTS (Focal Fossa) -- Full sources.list
deb http://archive.ubuntu.com/ubuntu/ focal main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ focal main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse
@arvati
arvati / Backup Everything.txt
Last active November 22, 2024 12:49
Backup OpenWrt Systems
opkg update
opkg install tar
cd /
tar -cvpzf /mnt/data/rootfs.tar.gz --exclude=/mnt/data/rootfs.tar.gz --one-file-system /
tar -cvpzf /mnt/data/overlay.tar.gz --exclude=/mnt/data/overlay.tar.gz --one-file-system /overlay-boot/
# if not full tar package just busybox tar
cat <<EOT >> /tmp/exclude.list
sys
tmp
@korakot
korakot / kernel.py
Last active April 2, 2025 14:08
Install rust, cargo in Colab
# run this once, then reload, and then skip this
!apt install rustc
!gdown --id 1PULtTc-2e9z4bswh_SQqL5oy_4JpfV7c
!chmod +x evcxr_jupyter
!./evcxr_jupyter --install
// install dependency
:dep cmd_lib
use cmd_lib::run_cmd as sh;
@chaosbunker
chaosbunker / self-host-padloc-with-docker.md
Created January 5, 2020 10:17
How to self-host padloc 3

I couldn't wait until the official guide on how to do this is released, so I tried to figure it out and this is how I got it working.

The .env file for docker-compose

[email protected]
PL_SERVER_PORT=3000
PL_SERVER_URL=https://example.com/api
PL_PWA_PORT=8080
PL_PWA_URL=https://example.com
@ryan-blunden
ryan-blunden / reset_sourcegraph_admin_password.md
Last active February 6, 2025 07:27
Instructions for resetting the Sourcegraph admin password

Presuming you have access to the Sourcegraph Docker container and the container name is sourcegraph:

  1. Get the id for the admin account (should be 1 in most cases):
docker container exec sourcegraph psql -U postgres sourcegraph -c 'SELECT id, username, passwd FROM users'
  1. Set the $ID variable: