Skip to content

Instantly share code, notes, and snippets.

View martinetmayank's full-sized avatar
🎮
Gaming

Mayank Garg martinetmayank

🎮
Gaming
View GitHub Profile
@martinetmayank
martinetmayank / ngrok.py
Last active March 25, 2021 01:32
Install and authenticate NGROK
TOKEN = "YOUR TOKEN HERE"
def install_ngrok():
import os
from zipfile import ZipFile
from urllib.request import urlretrieve
url = 'https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip'
urlretrieve(url, 'ngrok-amd64.zip')
@martinetmayank
martinetmayank / torrent_server.py
Last active May 16, 2020 20:30
Start Torrent Server
import threading
import time
import requests
import json
import subprocess
def torrent(port):
command = subprocess.Popen(['qbittorrent-nox', f'--webui-port={port}'])
def ngrok(port):
[program:jupyter]
directory=/home/ubuntu/jupyter-notebooks/
command=sudo jupyter notebook --allow-root --config=/home/ubuntu/.jupyter/jupyter_notebook_config.py
autostart=true
autorestart=true
stderr_logfile=/var/log/jupyter.err.log
stdout_logfile=/var/log/jupyter.out.log
server {
listen 1222;
listen [::]:1222;
location / {
proxy_pass http://0.0.0.0:8888;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_http_version 1.1;
proxy_redirect off;
@martinetmayank
martinetmayank / Colab_LibTorrent.ipynb
Last active August 1, 2020 10:38
Use Colab and libtorrent to download Torrent files.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@martinetmayank
martinetmayank / group.py
Last active September 4, 2021 15:24
Copying images to training, testing and validation directories
DATASET_DIR = 'your-dataset-directory'
BASE_DIR = os.getcwd() + '\\trainset'
os.mkdir(BASE_DIR)
TRAIN_DIR = os.path.join(BASE_DIR, 'train')
TRAIN_DOGS_DIR = os.path.join(TRAIN_DIR, 'dogs')
TRAIN_CATS_DIR = os.path.join(TRAIN_DIR, 'cats')
os.mkdir(TRAIN_DIR)
from keras import models
from keras import layers
model = models.Sequential()
model.add(layers.Conv2D(
filters=32,
kernel_size=(3, 3),
strides=(1, 1),
padding='valid',
@martinetmayank
martinetmayank / images.py
Created September 4, 2021 18:56
Using ImageDataGenerator to read images form the directories
from keras.preprocessing.image import ImageDataGenerator
# Rescaling all images by 1/255
train_datagen = ImageDataGenerator(rescale=1./255)
test_datagen = ImageDataGenerator(rescale=1./255)
train_generator = train_datagen.flow_from_directory(
directory=TRAIN_DIR,
target_size=(150, 150), # Resizing all images to 150 x 150
batch_size=20,