This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.
To capture the video (filesize: 19MB), using the free "QuickTime Player" application:
# vim mode | |
# also need to edit .inputrc | |
set -o vi | |
bind '"kj":vi-movement-mode' | |
alias rm=rmtrash | |
export CLICOLOR=1 | |
export LSCOLORS=GxFxCxDxBxegedabagaced |
""" Trains an agent with (stochastic) Policy Gradients on Pong. Uses OpenAI Gym. """ | |
import numpy as np | |
import cPickle as pickle | |
import gym | |
# hyperparameters | |
H = 200 # number of hidden layer neurons | |
batch_size = 10 # every how many episodes to do a param update? | |
learning_rate = 1e-4 | |
gamma = 0.99 # discount factor for reward |
import os | |
from moviepy.editor import ImageSequenceClip | |
def gif(filename, array, fps=10, scale=1.0): | |
"""Creates a gif given a stack of images using moviepy | |
Notes | |
----- | |
works with current Github version of moviepy (not the pip version) |
# A simple cheat sheet of Spark Dataframe syntax | |
# Current for Spark 1.6.1 | |
# import statements | |
from pyspark.sql import SQLContext | |
from pyspark.sql.types import * | |
from pyspark.sql.functions import * | |
#creating dataframes | |
df = sqlContext.createDataFrame([(1, 4), (2, 5), (3, 6)], ["A", "B"]) # from manual data |
from numpy.linalg import solve | |
class ExplicitMF(): | |
def __init__(self, | |
ratings, | |
n_factors=40, | |
item_reg=0.0, | |
user_reg=0.0, | |
verbose=False): | |
""" |
# Implements Create, Debug, and Delete Lattice Instance usable from within a Python app | |
# | |
import os, jsonr | |
import requests | |
# Note these are only a few variables, closer inspection of this Gist will show that there is alot of possibility here based on your app container. | |
# needed to make requests | |
auth_header = {'Authorization':'Basic YmJlcnRrYTprYXJtYTE5NzY='} |
""" | |
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy) | |
BSD License | |
""" | |
import numpy as np | |
# data I/O | |
data = open('input.txt', 'r').read() # should be simple plain text file | |
chars = list(set(data)) | |
data_size, vocab_size = len(data), len(chars) |