Skip to content

Instantly share code, notes, and snippets.

View DrLeucine's full-sized avatar
💎

Leonardo Castorina DrLeucine

💎
View GitHub Profile
@DrLeucine
DrLeucine / longjob.md
Last active January 8, 2021 11:05
Leaving a long job running on CDT Machines

Preface

If you need to leave a long job, such as a program that will run for longer than 5 hrs, or a jupyter notebook you might have noticed errors such as "Broken Pipe" or about your access to AFS being expired.

rm: cannot remove '/afs/inf.ed.ac.uk/user/s20/UUN/.last_login': Permission denied
-bash: /afs/inf.ed.ac.uk/user/s20/UUN/.last_login: Permission denied
-bash: cd: /afs/inf.ed.ac.uk/user/s20/UUN: Permission denied
-bash: /afs/inf.ed.ac.uk/user/s20/UUN/.bash_profile: Permission denied
@DrLeucine
DrLeucine / Pymol show b-factor as thickness and occupancy as color
Last active November 17, 2020 11:19
[Pymol show b-factor as thickness and occupancy as color] #Pymol
# Disable shadow
set ray_shadows,off
# Set occupancy as color
spectrum q, blue_yellow
# Set B-factor as thickness
show cartoon
cartoon putty
unset cartoon_smooth_loops
@DrLeucine
DrLeucine / Docker Jupyter code + Poetry
Last active November 17, 2020 11:18
[Run poetry in Docker] #Docker
docker exec -it {DOCKER_CONTAINER_ID} /root/.poetry/bin/poetry run jupyter notebook list
@DrLeucine
DrLeucine / resize_all_imgs_in_dir.py
Last active November 17, 2020 11:29
[Resize all imgs in a directory] #Python
import os
import pandas as pd
from cv2 import imread, resize, imwrite, IMREAD_GRAYSCALE, INTER_AREA
# Extension of files needed:
ext = '.jpg'
label_ext = '.txt'
# Directory of interest:
dir_path = 'dataset'
@DrLeucine
DrLeucine / test.py
Last active November 17, 2020 11:29
[Test if Tensorflow is running on GPU] #Python #Tensorflow
import tensorflow as tf
mnist = tf.keras.datasets.mnist
(x_train, y_train),(x_test, y_test) = mnist.load_data()
x_train, x_test = x_train / 255.0, x_test / 255.0
model = tf.keras.models.Sequential([
tf.keras.layers.Flatten(input_shape=(28, 28)),
tf.keras.layers.Dense(512, activation=tf.nn.relu),
tf.keras.layers.Dropout(0.2),