Skip to content

Instantly share code, notes, and snippets.

Avatar
👨‍💻
(OwO)

Mazen sudomaze

👨‍💻
(OwO)
View GitHub Profile
@sudomaze
sudomaze / blockchain.py
Created Nov 19, 2021
A blockchain made from scratch in ~50 lines
View blockchain.py
# source: https://twitter.com/PrasoonPratham/status/1461267623266635778/photo/1 (@PrasoonPratham on Twitter)
import datetime
import hashlib
class Block:
def __init__(self, data):
self.data = data
self.blockNo = 0
self.next = None
self.nonce = 0
View working-on.md

Sudomaze - Currently working on

Discord

Join our community of people interested in Software Engineering. link

Today

  • Setup nodejs/express/mongodb codebase
  • Day 8, 2021 AoC

Later

@sudomaze
sudomaze / main.ipynb
Last active Aug 22, 2021
Refactored code from Effective Pandas by Matt Harrison talk
View main.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sudomaze
sudomaze / README.md
Last active Aug 12, 2021
Quick and play PyTorch Profiler example
View README.md

Intro

It wasn't obvious on PyTorch's documentation of how to use PyTorch Profiler (as of today, 8/12/2021), so I have spent some time to understand how to use it and this gist contains a simple example to use.

Instructions

  • Install the required packages:
python>=1.9.0
torchvision>=0.10.0
numpy
matplotlib
@sudomaze
sudomaze / ngrok.yml
Last active Aug 9, 2021 — forked from maximiliano/ngrok.yml
Ngrok, running multiple ports at once (works for free version)
View ngrok.yml
# Create 4 tunnels, each for different ports, with only https enabled
# This way the ngrok process stays bellow the Free plan limit (4 tunnels)
# command: ngrok start --all # to start all of them
# command: ngrok start note tb # to run jupyter notebook server and tensorboard server only
# refer to this page for more info: https://ngrok.com/docs#multiple-tunnels
authtoken: ...
log: ngrok.log
tunnels:
# to run jupyter notebook server
@sudomaze
sudomaze / ci.yaml
Created Jul 7, 2021
Example for my jobs setup
View ci.yaml
name: Automated Experiments
on:
push:
branches: [ main ]
jobs:
build_on_cn-gpu5:
runs-on: [ cn-gpu5 ]
timeout-minutes: 4320
defaults:
run:
@sudomaze
sudomaze / vscode-jupyter-remote.md
Last active May 16, 2021
How to use a remote Jupyter notebook in VS code
View vscode-jupyter-remote.md

To run access a remote jupyter notebook, you will need to do the following:

  1. Setting ssh config file (~/.ssh/config):
Host FLIP # access point server
    HostName access.engr.oregonstate.edu
    User ONIDusername
Host DGX # target server
    HostName submit-b.hpc.engr.oregonstate.edu
    User ONIDusername
@sudomaze
sudomaze / sampler_class.py
Created Apr 14, 2021
A simple example of Sampler class usage to have mini-batches to contain a sequence of frames from the same videos
View sampler_class.py
import math
from torch.utils.data.sampler import Sampler
class BatchSampler(Sampler):
def __init__(self, dataset, batch_size, offset=1, drop_last=True, *args, **kwargs):
super(BatchSampler, self).__init__(dataset, *args, **kwargs)
self.batch_size = batch_size
self.dataset = dataset
self.offset = offset
self.drop_last = drop_last
@sudomaze
sudomaze / README.md
Last active Jun 23, 2021
Streamlit + Flask example
View README.md

A simple example for Streamlit and Flask project

  • server.py contains the API code for the Flask server (back-end)
  • main.py contains the streamlit code (front-end)

Requirements

pip install plotly streamlit pandas requests flask
@sudomaze
sudomaze / multithreading.ipynb
Created Apr 3, 2021
Multi-threading skeleton code
View multithreading.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.