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 / 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 / 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()
@ricardodeazambuja
ricardodeazambuja / draw_neural_net.py
Created February 3, 2019 19:15 — forked from craffel/draw_neural_net.py
Draw a neural network diagram with matplotlib!
import matplotlib.pyplot as plt
def draw_neural_net(ax, left, right, bottom, top, layer_sizes):
'''
Draw a neural network cartoon using matplotilb.
:usage:
>>> fig = plt.figure(figsize=(12, 12))
>>> draw_neural_net(fig.gca(), .1, .9, .1, .9, [4, 7, 2])
#!/usr/bin/env bash
# Create isolated ROS Workspace
cd ~
mkdir ros_py35
cd ros_py35
# Unset sourced workspace
# Go to ~/.bashrc and comment out lines from previous installation of ROS (Lunar)
@ricardodeazambuja
ricardodeazambuja / ffmpeg.md
Created March 6, 2019 19:43 — forked from protrolium/ffmpeg.md
using ffmpeg to extract audio from video files

ffmpeg

Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

Convert WAV to MP3, mix down to mono (use 1 audio channel), set bit rate to 64 kbps and sample rate to 22050 Hz: