Skip to content

Instantly share code, notes, and snippets.

View universvm's full-sized avatar
💎

Leonardo Castorina universvm

💎
View GitHub Profile
@universvm
universvm / 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),
@universvm
universvm / 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'
@universvm
universvm / 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
@universvm
universvm / 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
@universvm
universvm / 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
@universvm
universvm / wikipapers.txt
Created January 16, 2021 11:04
Full list of Biology-related papers obtained manually from Wikipedia
Acta Biológica Colombiana
Alces
American Journal of Physical Anthropology
The American Naturalist
Annual Review of Physiology
BioEssays
Biologia
The Biological Bulletin
Biological Communications
Biological Reviews
@universvm
universvm / wandb
Created May 10, 2021 10:47
Start Wandb
docker run --rm -d -v /opt/wandb:/vol -p 9988:8080 --name wandb-local wandb/local
@universvm
universvm / convert_to_json.py
Last active July 26, 2021 14:01
Convert TIMED-style benchmark predictions to json file
# Written by Rokas Petrenas (https://github.com/rokaske199)
from benchmark import get_cath
from pathlib import Path
import json
PATH_TO_PDB=Path('/scratch/datasets/pdb/')
cath_location = "cath-domain-description-file.txt"
cath_df = get_cath.read_data(cath_location)
#select only monomers
new_df=get_cath.filter_with_user_list(cath_df,"/home/s1706179/project/sequence-recovery-benchmark/monomers_af2.txt")
@universvm
universvm / monomers_af2.txt
Created July 26, 2021 14:00
Sequence Recovery Benchmark Monomers
4le7A
4ozwA
3e8tA
3zh4A
1o7iA
6baqA
3q1nA
1x8qA
3klkA
5b1rA
@universvm
universvm / monomers
Created July 28, 2021 12:55
monomers AF2
3e3vA, 5dicA, 1dvoA, 3cxbA, 3rf0A, 2ra1A, 1a41A, 3giaA, 3dadA, 2of3A, 4y5jA, 4ozwA, 1uzkA, 3klkA, 1g3pA, 2dyiA, 3zbdA, 3kyfA, 1o7iA, 1x8qA, 4i1kA, 2bhuA, 3q1nA, 1jovA, 2v3iA, 4efpA, 4le7A, 3kstA, 3o4pA, 2w18A, 1l0sA, 2j8kA, 1hxrA, 3maoA, 4a6qA, 5b1rA, 3oajA, 4m4dA, 6baqA, 3e8tA, 2v3gA, 5c12A, 3kluA, 3gohA, 3dkrA, 2imhA, 1hq0A, 1ds1A, 3zh4A, 3swgA, 5bufA, 3hvmA, 1h70A, 4fs7A, 3e4gA, 4fcgA, 4wp6A, 4ecoA, 3essA,