Skip to content

Instantly share code, notes, and snippets.

View matheustguimaraes's full-sized avatar

Mat G. matheustguimaraes

View GitHub Profile

Fast way to enable CORS in Flask

Cross-Origin Resource Sharing (CORS) is a mechanism that uses additional HTTP headers to tell browsers to give a web application running at one origin, access to selected resources from a different origin. A web application executes a cross-origin HTTP request when it requests a resource that has a different origin (domain, protocol, or port) from its own. [1]

Lets create a simple Flask server called app.py:

from flask import Flask, jsonify
@matheustguimaraes
matheustguimaraes / signature.html
Created August 15, 2019 16:59
Email signature
--
<div style="font-weight: bold">
Matheus T. Guimarães
</div>
<br>
<div>
<div style="font-weight: 500">
Graduando no Bacharelado em Ciência da Computação
</div>
Universidade Federal do Ceará (UFC)
@matheustguimaraes
matheustguimaraes / env_jupyter.sh
Last active March 19, 2020 04:21
Use virtualenv on jupyter notebook
# Install the necessary packages
pip install ipykernel
# This commands will set the env name as 'env'
python -m ipykernel install --user --name env --display-name "env"
@matheustguimaraes
matheustguimaraes / install-cuda-cudnn.md
Last active March 20, 2023 05:08
Install CUDA 10.0 and cuDNN v7.4.2 on Ubuntu 16.04

Install CUDA 10.0 and cuDNN v7.4.2 on Ubuntu 16.04

Install the latest NVIDIA driver

Update package lists, download and install NVIDIA driver

sudo apt-get update
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt install nvidia-410
@matheustguimaraes
matheustguimaraes / convert-dot-raw-images.md
Last active January 17, 2019 17:54
Convert .raw image in other image formats

Convert .raw image in other image formats

Install ImageMagick

sudo apt-get update
sudo apt-get install imagemagick

Convert the .raw image in other formats

@matheustguimaraes
matheustguimaraes / keybase.md
Created January 11, 2019 13:17
Keybase proof

Keybase proof

I hereby claim:

  • I am matheustguimaraes on github.
  • I am matheusguimaraes (https://keybase.io/matheusguimaraes) on keybase.
  • I have a public key ASA65LR1fXhdtiSNdifyfryUDYvH0dvTgaU28pOnWCxHHQo

To claim this, I am signing this object:

@matheustguimaraes
matheustguimaraes / dcm_information.py
Created October 10, 2018 19:56
Read dicom image information
import numpy as np
import pydicom
import matplotlib.pyplot as plt
from pydicom.data import get_testdata_files
print(__doc__)
def get_database(filename, indent=0):
"""Go through all items in the dataset and print them with custom format