Skip to content

Instantly share code, notes, and snippets.

View RodrigoCMoraes's full-sized avatar

RodrigoCMoraes RodrigoCMoraes

  • São Paulo, SP, Brazil
View GitHub Profile
@RodrigoCMoraes
RodrigoCMoraes / install-docker.sh
Last active November 15, 2019 22:03
Install docker Ubuntu 18.04
wget http://get.docker.com -O docker-install.sh
sudo chmod +x docker-install.sh
./docker-install.sh
sudo groupadd docker
sudo usermod -aG docker $USER
sudo systemctl enable docker
sudo apt-get install -y install docker-compose
sudo reboot
@RodrigoCMoraes
RodrigoCMoraes / install-nvidia-docker.sh
Last active May 10, 2024 10:13
Install nvidia docker in Ubuntu 18.04
#1. Update system
sudo apt-get update
#2.Install packages to allow apt to use a repository over HTTPS:
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
software-properties-common
@RodrigoCMoraes
RodrigoCMoraes / install-miniconda.sh
Created June 10, 2019 18:20
Install/Reinstall last Miniconda3
#!/bin/bash
if [ -d ~/miniconda3 ]
then
echo "Deleting directory ~/miniconda3..."
rm -rf ~/miniconda3 ~/.conda
@RodrigoCMoraes
RodrigoCMoraes / load_file_from_gdrive.py
Created May 27, 2019 00:37
Getting file from Google Drive by PyDrive
#@title Dataset info { form-width: "800px" }
# e.g GOOGLE_DRIVE_FILE_URL: https://drive.google.com/open?id=1CZyDkHHjS8SUVBF7fBwoTAF6xSpLmD4P7
LinkFile = "GOOGLE_DRIVE_FILE_URL" #@param {type:"string"}
# e.g GOOGLE_DRIVE_FILENAME_WITH_EXTENSION: Local History.csv
Filename = "GOOGLE_DRIVE_FILENAME_WITH_EXTENSION" #@param {type:"string"}
Filename = Filename.replace(' ', '\ ')
@RodrigoCMoraes
RodrigoCMoraes / docker-install-fedora30.md
Last active June 10, 2019 21:11
Docker installation on Fedora 30 (Unstable)

Run this commands

sudo dnf -y install dnf-plugins-core

sudo dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo

sudo dnf config-manager --set-enabled docker-ce-test

sudo dnf config-manager --set-disabled docker-ce-stable

@RodrigoCMoraes
RodrigoCMoraes / siamese.py
Created March 1, 2019 01:50 — forked from vbalnt/siamese.py
train on siamese graph - custom mini batches
'''Train a Siamese MLP on pairs of digits from the MNIST dataset.
It follows Hadsell-et-al.'06 [1] by computing the Euclidean distance on the
output of the shared network and by optimizing the contrastive loss (see paper
for mode details).
[1] "Dimensionality Reduction by Learning an Invariant Mapping"
http://yann.lecun.com/exdb/publis/pdf/hadsell-chopra-lecun-06.pdf
Run on GPU: THEANO_FLAGS=mode=FAST_RUN,device=gpu,floatX=float32 python mnist_siamese_graph.py
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import ImageGrid
import numpy as np
import PIL
import cv2
import glob
import os
def apply_plot_style(xlim, ylim, xlabel, ylabel, grid):
plt.clf()
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import ImageGrid
import numpy as np
import PIL
def thumb_grid(im_list, grid_shape, fname_out, scale=1.0, axes_pad=0.07, figsize=(7, 7), dpi=900):
assert len(grid_shape) == 2 # Grid must be 2D:
assert np.prod(grid_shape) >= len(im_list) # Make sure all images can fit in grid:
plt.figure(figsize=figsize, dpi=dpi)
import cv2
import numpy as np
screen_width, screen_height = 1920, 1080
window_width, window_height = 1270, 720
path = "template.jpeg"
image = cv2.imread(path)
image_width, image_height = image.shape[:2]
@RodrigoCMoraes
RodrigoCMoraes / delete_docker.sh
Last active February 18, 2019 15:07
Delete all images and containers in docker
#!/bin/bash
# Delete all containers
docker rm $(docker ps -a -q)
# Delete all images
docker rmi $(docker images -q)