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 / loadtime_webpage_stats.py
Last active March 25, 2021 18:02
compute load time stats for web page
import os
import sys
import json
import pprint
import argparse
import subprocess
"""
Reference: https://blog.cloudflare.com/a-question-of-timing/
@RodrigoCMoraes
RodrigoCMoraes / format_points_list_to_visualization.py
Last active May 16, 2020 19:42
useful snippets to data related to maps visualization
def format_points_list_to_visualization(points, to_print=True):
"""
Format a list of Points of Django to able visualization on:
https://mobisoftinfotech.com/tools/plot-multiple-points-on-map/
Usage:
from django.contrib.gis.geos import Point
sample_lat_lng = [
(19.0760,72.8777),
@RodrigoCMoraes
RodrigoCMoraes / amount_django_queries.py
Last active March 22, 2020 02:02
Function to get the amount of queries of django query
def amount_queries():
"""Usage:
start_num_queries = amount_queries()
... plent of code with django orm queries
end_num_queries = amount_queries()
num_queries = end_num_queries - start_num_queries
@RodrigoCMoraes
RodrigoCMoraes / postgres_queries_and_commands.sql
Last active September 11, 2019 14:49 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- all databases and their sizes
select * from pg_user;
-- Dump database on remote host to file
$ pg_dump -U username -h hostname databasename > dump.sql
-- Import dump into existing database
$ psql -d newdb -f dump.sql
@RodrigoCMoraes
RodrigoCMoraes / tensorflow_shutup.py
Created July 15, 2019 14:56
Make tensorflow less verbose
# source : https://stackoverflow.com/a/54950981/7195250
def tensorflow_shutup():
"""
Make Tensorflow less verbose
"""
try:
# noinspection PyPackageRequirements
import os
from tensorflow import logging
@RodrigoCMoraes
RodrigoCMoraes / spec-file-pytorch-gpu.txt
Created July 3, 2019 22:04
Specification file for PyTorch GPU
# This file may be used to create an environment using:
# $ conda create --name <env> --file <this file>
# platform: linux-64
@EXPLICIT
https://repo.anaconda.com/pkgs/main/linux-64/_tflow_select-2.1.0-gpu.tar.bz2
https://repo.anaconda.com/pkgs/main/linux-64/blas-1.0-mkl.tar.bz2
https://conda.anaconda.org/conda-forge/linux-64/ca-certificates-2019.6.16-hecc5488_0.tar.bz2
https://repo.anaconda.com/pkgs/main/linux-64/cudatoolkit-10.0.130-0.tar.bz2
https://repo.anaconda.com/pkgs/main/linux-64/gmp-6.1.2-h6c8ec71_1.tar.bz2
https://repo.anaconda.com/pkgs/main/linux-64/icu-58.2-h9c2bf20_1.tar.bz2
@RodrigoCMoraes
RodrigoCMoraes / .vimrc
Last active September 1, 2021 18:55 — forked from wdsrocha/.vimrc
Minimal .vimrc
" remap escape key to jk
imap jk <Esc>
" when possible cursor is in center of screen
nnoremap j jzz
nnoremap k kzz
nnoremap `` ``zz
" general settings
set rnu et ts=4 sw=4 sts=4 ai cindent nowrap noswapfile cursorline splitbelow splitright
@RodrigoCMoraes
RodrigoCMoraes / dl-setup.md
Last active July 3, 2019 22:01
The steps described here was made and tested in **Ubuntu 18.04 x64**, and it's main purpose is make easy to prepare environment from scratch to play with Deep Learning on TensorFlow/PyTorch.

TensorFlow/PyTorch + GPU + Docker

The steps described here was made and tested in Ubuntu 18.04 x64, and it's main purpose is make easy to prepare environment from scratch to play with Deep Learning on TensorFlow/PyTorch.

Steps to prepare environment

  1. Update system

    $> sudo apt-get -y update

@RodrigoCMoraes
RodrigoCMoraes / spec-file-tensorflow-gpu.txt
Last active January 14, 2021 12:12
Conda environment specs TensorFlow GPU
# This file may be used to create an environment using:
# $ conda create --name <env> --file <this file>
# platform: linux-64
@EXPLICIT
https://repo.anaconda.com/pkgs/main/linux-64/_tflow_select-2.1.0-gpu.tar.bz2
https://repo.anaconda.com/pkgs/main/linux-64/blas-1.0-mkl.tar.bz2
https://repo.anaconda.com/pkgs/main/linux-64/ca-certificates-2019.5.15-0.tar.bz2
https://repo.anaconda.com/pkgs/main/linux-64/cudatoolkit-10.0.130-0.tar.bz2
https://repo.anaconda.com/pkgs/main/linux-64/intel-openmp-2019.4-243.tar.bz2
https://repo.anaconda.com/pkgs/main/linux-64/libgcc-ng-9.1.0-hdf63c60_0.tar.bz2
@RodrigoCMoraes
RodrigoCMoraes / install-nvidia-driver.sh
Created June 11, 2019 18:16
install nvidia drivers Ubuntu 18.04
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt update
sudo ubuntu-drivers autoinstall
sudo reboot