Skip to content

Instantly share code, notes, and snippets.

@frangipane
frangipane / visualize_actor_critic.py
Created May 8, 2020 03:36
Visualize actor critic agent in mini gridworld
"""Visualize actor critic agent in mini gridworld
Plot (dynamic):
- agent navigating gridworld env
- bar plot of discrete actions
- line plot of value function over time
"""
import matplotlib.pyplot as plt
@frangipane
frangipane / ffmpeg commands
Created May 8, 2020 02:17
ffmpeg commands to convert gif to mp4, to rescale mp4 dimensions, to stack (vertically/horizontally) mp4s into a single video
# convert gif to mp4
ffmpeg -i gifts.gif -movflags faststart -pix_fmt yuv420p -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" gifts.mp4
# create mp4 from images (*_value.png) in current dir
ffmpeg -framerate 2 -pattern_type glob -i '*.png' -c:v libx264 -r 30 -pix_fmt yuv420p -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" value.mp4
# create mp4 from images (*_policy.png) in current dir
ffmpeg -framerate 2 -pattern_type glob -i '*.png' -c:v libx264 -r 30 -pix_fmt yuv420p -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" policy.mp4
# create vertically stacked single video from the individual value and policy videos (they have the same width)
@frangipane
frangipane / Vagrantfile
Created March 22, 2016 21:18
tweaks to Vagrantfile for vagrant box malthejorgensen/caffe-deeplearning
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# Every Vagrant development environment requires a box. You can search for
@frangipane
frangipane / jupyter_userdata.sh
Last active April 27, 2017 00:24
configure jupyter notebook server (to be passed as user data when you launch an aws ec2 instance)
#!/bin/bash
CERTIFICATE_DIR="/home/ubuntu/certificate"
JUPYTER_CONFIG_DIR="/home/ubuntu/.jupyter"
if [ ! -d "$CERTIFICATE_DIR" ]; then
mkdir $CERTIFICATE_DIR
openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout "$CERTIFICATE_DIR/mykey.key" -out "$CERTIFICATE_DIR/mycert.pem" -batch
chown -R ubuntu $CERTIFICATE_DIR
fi