Skip to content

Instantly share code, notes, and snippets.

View ricardodeazambuja's full-sized avatar

Ricardo de Azambuja ricardodeazambuja

View GitHub Profile
@ricardodeazambuja
ricardodeazambuja / CATCH_Keras_RL.md
Created November 21, 2016 16:28 — forked from EderSantana/CATCH_Keras_RL.md
Keras plays catch - a single file Reinforcement Learning example
@ricardodeazambuja
ricardodeazambuja / Fixing the USB2Dynamixel ttyUSB names problem
Created February 16, 2017 15:27
How to force Ubuntu to give the same name to the usb devices (ttyUSB)
http://unix.stackexchange.com/a/183492
http://rolfblijleven.blogspot.co.uk/2015/02/howto-persistent-device-names-on.html
$ dmesg | grep ttyUSB
[ 1173.771734] usb 2-1: FTDI USB Serial Device converter now attached to ttyUSB0
$ udevadm info --name=/dev/ttyUSBx --attribute-walk
Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
@ricardodeazambuja
ricardodeazambuja / GIF-Screencast-OSX.md
Created May 1, 2017 17:44 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@ricardodeazambuja
ricardodeazambuja / git.css
Created May 4, 2017 09:07 — forked from neilgee/git.css
Git Command Line Reference - Notes and reminders on set up and commands
/*
* Set up your Git configuration
*/
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
git config --global core.editor "nano"
@ricardodeazambuja
ricardodeazambuja / pydrive.py
Created April 28, 2018 15:42 — forked from korakot/pydrive.py
Google drive upload, read, update with Google Colab
# Install the PyDrive wrapper & import libraries.
!pip install -U -q PyDrive
from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
from google.colab import auth
from oauth2client.client import GoogleCredentials
# Authenticate and create the PyDrive client.
auth.authenticate_user()
gauth = GoogleAuth()
@ricardodeazambuja
ricardodeazambuja / opencv_live_webcam.ipynb
Last active May 12, 2018 21:00
Super simple example to test OpenCV inside a Jupyter notebook running through a docker container - https://ricardodeazambuja.com/deep_learning/2018/05/04/tuning_tensorflow_docker/
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ricardodeazambuja
ricardodeazambuja / graceful_shutdown_tornado_web_server.py
Created July 27, 2018 13:46 — forked from wonderbeyond/graceful_shutdown_tornado_web_server.py
The example to how to shutdown tornado web server gracefully...
#!/usr/bin/env python
"""
How to use it:
1. Just `kill -2 PROCESS_ID` or `kill -15 PROCESS_ID`,
The Tornado Web Server Will shutdown after process all the request.
2. When you run it behind Nginx, it can graceful reboot your production server.
"""
import time
@ricardodeazambuja
ricardodeazambuja / gist:dfb8e25d9e730dd87e540fd79f21c320
Created October 29, 2018 20:50 — forked from jagregory/gist:710671
How to move to a fork after cloning
So you've cloned somebody's repo from github, but now you want to fork it and contribute back. Never fear!
Technically, when you fork "origin" should be your fork and "upstream" should be the project you forked; however, if you're willing to break this convention then it's easy.
* Off the top of my head *
1. Fork their repo on Github
2. In your local, add a new remote to your fork; then fetch it, and push your changes up to it
git remote add my-fork [email protected]
@ricardodeazambuja
ricardodeazambuja / stats.py
Created January 27, 2019 15:04 — forked from benjaminmgross/stats.py
Predicted R-Squared (r2, r^2) Calculation in `python`
def press_statistic(y_true, y_pred, xs):
"""
Calculation of the `Press Statistics <https://www.otexts.org/1580>`_
"""
res = y_pred - y_true
hat = xs.dot(np.linalg.pinv(xs))
den = (1 - np.diagonal(hat))
sqr = np.square(res/den)
return sqr.sum()