View sig_figs.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from math import floor, log10 | |
def sig_figs(x: float, precision: int): | |
""" | |
Rounds a number to number of significant figures | |
Parameters: | |
- x - the number to be rounded | |
- precision (integer) - the number of significant figures |
View ssh-gpu.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
ssh -L 8888:localhost:8888 -L 6006:localhost:6006 bob@192.168.1.199 |
View mount_gpu.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
remotedir="bob@192.168.1.199:/gpu" # TODO Add directory on the remote machine | |
mountdir="/Users/bob/gpu" # TODO Add local directory | |
echo "Mounting (${mountdir})..." | |
#Unmount if it's already mounted | |
if mount | grep "on $mountdir" > /dev/null; then | |
umount ${mountdir} |
View pytorch_mnist.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pytorch_mnist.py | |
# Simple MNIST training script on Pytorch to confirm installation is working correctly | |
import torch | |
import torch.nn as nn | |
import torch.nn.functional as F | |
import torch.optim as optim | |
import torchvision | |
n_epochs = 3 |
View benchmark.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# benchmark.py | |
from ai_benchmark import AIBenchmark | |
benchmark = AIBenchmark() | |
results = benchmark.run() |
View tensorflow_mnist.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# tensorflow_mnist.py | |
# A simple Tensorflow 2 MNIST training script to test installation is working correctly. | |
import tensorflow as tf | |
import tensorflow_datasets as tfds | |
(ds_train, ds_test), ds_info = tfds.load( | |
'mnist', | |
split=['train', 'test'], | |
shuffle_files=True, |
View docker-compose.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3.4" | |
services: | |
backend: | |
build: . | |
ports: | |
- 80:80 | |
env_file: .env | |
restart: unless-stopped |
View docker-compose.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
backend: | |
build: . | |
ports: | |
- 8999:80 | |
env_file: .env | |
restart: unless-stopped | |
labels: | |
- "traefik.enable=true" | |
- "traefik.http.routers.backend.rule=Host(`app.example.com`)" | |
- "traefik.http.routers.backend.entrypoints=websecure" |
View docker-compose.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
traefik: | |
image: "traefik:v2.5" | |
container_name: "traefik" | |
command: | |
#- "--log.level=DEBUG" | |
- "--api.insecure=true" | |
- "--providers.docker=true" | |
- "--providers.docker.exposedbydefault=false" | |
- "--entrypoints.websecure.address=:443" | |
- "--certificatesresolvers.myresolver.acme.tlschallenge=true" |
View get_current_module_path.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
CWD = os.path.dirname(os.path.abspath(__file__)) | |
#CWD then has the absolute path to this current file |
NewerOlder