Skip to content

Instantly share code, notes, and snippets.

View enric1994's full-sized avatar

Enric Moreu enric1994

View GitHub Profile
@enric1994
enric1994 / blender_intro.py
Last active October 10, 2023 15:59
Introduction to Blender's Python API
"""
Required files:
https://github.com/mrdoob/three.js/blob/c8549a524bde688e8a55b32faa0a69b3308c4034/examples/models/stl/binary/pr2_head_tilt.stl
https://sipi.usc.edu/database/download.php?vol=misc&img=4.2.03
https://sipi.usc.edu/database/database.php?volume=misc&image=5#top
"""
import bpy
base_path = '/Users/enric/Downloads/'
@enric1994
enric1994 / config.yaml
Created May 17, 2022 15:23
VSCode in the browser with docker
bind-addr: 127.0.0.1:8080
auth: password
password: yourpassword
cert: false
@enric1994
enric1994 / config.yaml
Last active November 12, 2021 10:44
VSCode in the browser
# Config file
bind-addr: 127.0.0.1:8080
auth: password
password: yourpassword
cert: false
@enric1994
enric1994 / config
Last active March 2, 2021 18:37
Gateway configuration: create a file at ~/.ssh/config
# Use this command to avoid the password prompt
# First generate an SSH key pair with: ssh-keygen
# Second, run this command on your system
# ssh-copy-id YOUR_GATEWAY_USER@gateway.computing.dcu.ie
# To open server's tensorboard from my computer
# ssh myserver -L 6006:127.0.0.1:6006
# Note that 'myserver' is the alias I use to connect to my server (see below)
# Acces to my server using the gateway using an alias:
@enric1994
enric1994 / loader.py
Created April 19, 2020 22:12
Pytorch Dataloader boilerplate
from __future__ import print_function, division
import os
import torch
from skimage import io
import numpy as np
from torch.utils.data import Dataset, DataLoader
from torchvision import transforms, utils
import json
from sklearn import preprocessing
from PIL import Image
@enric1994
enric1994 / classifier.py
Created April 19, 2020 22:11
Pytorch boilerplate
from tqdm import tqdm
import torch
import torch.nn as nn
import torch.optim as optim
from torch.optim import lr_scheduler
import numpy as np
import torchvision
from torchvision import datasets, models, transforms
import time
#!/bin/bash
function gdrive_download () {
CONFIRM=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate "https://docs.google.com/uc?export=download&id=$1" -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')
wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$CONFIRM&id=$1" -O $2
rm -rf /tmp/cookies.txt
}
gdrive_download 1E1lLxMKtLZwSBappJ9EIaOwo2shpk_Pb file.zip
@enric1994
enric1994 / linkpython.sh
Created October 8, 2019 11:49
Linux link python to python3
ln -s /usr/bin/python3 /usr/bin/python
@enric1994
enric1994 / network.py
Last active September 5, 2019 11:00
Mentions Network
#Usage: python3 network.py input.csv output.csv
import csv
import re
import sys
input_file = sys.argv[1]
output_file = sys.argv[2]
@enric1994
enric1994 / scrap_twitter_ads_ie.py
Created May 4, 2019 20:12
Scrapping the promoted Tweets from some political parties in Ireland
from selenium import webdriver
import time
from bs4 import BeautifulSoup
import csv
import sys
reload(sys)
sys.setdefaultencoding('utf8')
#write header