Skip to content

Instantly share code, notes, and snippets.

View pangyuteng's full-sized avatar

pangyuteng

View GitHub Profile
@coltonbh
coltonbh / docker-swarm-gpu.md
Last active February 12, 2025 14:30
Docker Swarm GPU Support

GPU Support For Docker Swarm

Docker compose has nice support for GPUs, K8s has moved their cluster-wide GPU scheduler from experimental to stable status. Docker swarm has yet to support the device option used in docker compose so the mechanisms for supporting GPUs on swarm are a bit more open-ended.

Basic documentation

@arrogantrabbit
arrogantrabbit / vps.md
Last active February 4, 2025 08:49
Hosting services, like Storj, behind firewall/GNAT, using Wireguard on a VPS and DNAT (Port Forwarding) with iptables.

DNAT with iptables over wireguard hosted on a VPS to host services behind a firewall/GNAT.

This is a short description of how to host services, using STORJ node as an example, on a host behind GNAT, or otherwise restrictive firewall, by forwarding packets through WireGuard endpoint on a relatively fast nearby VPS. This is not specific to Storj, and can be adopted to hosting other services.

As an example we will use an Oracle Cloud instance. Free tier still provides 10TB of monthly traffic that is sufficient for most node operators. Just make sure to create an account in a closest datacenter to minimize extra latency.

Notes on configuring the cloud instance

  1. Create the oracle compute instance (ideally, Ampere, because they are awesome, but if that is not availabe, any other will do too).
  2. Pick any OS you prefer, here we'll describe Ubuntu, as a most popular one.
@aewhite
aewhite / example.py
Created January 8, 2022 14:03
Inverse of extract Image Patches for TF 2.x
# Solution based on https://stackoverflow.com/a/51785735/278836
import tensorflow as tf
def extract_patches(images):
return tf.image.extract_patches(
images,
(1, 3, 3, 1),
(1, 1, 1, 1),
(1, 1, 1, 1),
padding="VALID")
@gjreasoner
gjreasoner / README.md
Last active November 10, 2024 14:36
Expand Ubuntu 20 Proxmox Disk
# Resize the file system in UI, under VM -> Hardware -> Click on the disk to resize, click "Resize disk" button

# Confirm increase in disk space (1TB in my case)
$ lsblk
NAME                      MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda                         8:0    0    1T  0 disk
├─sda1                      8:1    0    1M  0 part
├─sda2                      8:2    0    1G  0 part /boot
└─sda3                      8:3    0    1T  0 part
@RafaelWO
RafaelWO / docker-swarm-gpu.md
Last active February 17, 2025 14:09 — forked from tomlankhorst/docker-swarm-gpu.md
Instructions for Docker swarm with GPUs
@jsoma
jsoma / CORS.json
Last active May 11, 2023 09:21
CORS public access (new JSON version)
{
"Version":"2012-10-17",
"Statement":[
{
"Sid":"PublicRead",
"Effect":"Allow",
"Principal": "*",
"Action":["s3:GetObject","s3:GetObjectVersion"],
"Resource":["arn:aws:s3:::YOUR_BUCKET_NAME_GOES_HERE/*"]
}
@ih2502mk
ih2502mk / list.md
Last active March 13, 2025 22:37
Quantopian Lectures Saved
@kissgyorgy
kissgyorgy / listen.py
Created September 4, 2020 16:37
How to use PostgreSQL's LISTEN/NOTIFY as a simple message queue with psycopg2 and asyncio
import asyncio
import psycopg2
# dbname should be the same for the notifying process
conn = psycopg2.connect(host="localhost", dbname="example", user="example", password="example")
conn.set_isolation_level(psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT)
cursor = conn.cursor()
cursor.execute(f"LISTEN match_updates;")
@alexlib
alexlib / README.md
Created August 27, 2020 13:58 — forked from amroamroamro/README.md
[Python] Fitting plane/surface to a set of data points

Python version of the MATLAB code in this Stack Overflow post: http://stackoverflow.com/a/18648210/97160

The example shows how to determine the best-fit plane/surface (1st or higher order polynomial) over a set of three-dimensional points.

Implemented in Python + NumPy + SciPy + matplotlib.

quadratic_surface