Code for Keras plays catch blog post
python qlearn.py- Generate figures
Code for Keras plays catch blog post
python qlearn.py| /* | |
| * Set up your Git configuration | |
| */ | |
| git config --global user.email "you@yourdomain.com" | |
| git config --global user.name "Your Name" | |
| git config --global core.editor "nano" |
| # 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() |
| #!/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 |
| 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 git@github...my-fork.git |
| 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() |
| 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) |
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: