Skip to content

Instantly share code, notes, and snippets.

Avatar

Ian Danforth iandanforth

View GitHub Profile
@iandanforth
iandanforth / focusmate-start.js
Created Oct 6, 2020
Greasemonkey Focusmate Session Start Alert
View focusmate-start.js
// ==UserScript==
// @name Focusmate Session Start Alert
// @version 1
// @grant none
// @include https://www.focusmate.com/*
// ==/UserScript==
// Start Noise MP3 encoded as Data URI
const startSound = "data:audio/mpeg;base64,SUQzAwAAAAAICVRFTkMAAAABQAAAV1hYWAAAAAIAAAAAVENPUAAAAAEAAABUT1BFAAAAAQAAAFRDT00AAAABAAAAQ09NTQAAABwAAABlbmcAaHR0cDovL3d3dy5ycGdhbWVycy5uZXRUQ09OAAAACQAAACgzNilHYW1lVFBFMQAAAAcAAABGLVplcm9UQUxCAAAACwAAAEYtWmVybyBPU1ZUWUVSAAAABQAAADE5OTFUUkNLAAAAAgAAADNUSVQyAAAABgAAAFN0YXJ0SVBMUwAAAAIAAAAAVFBFMgAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
@iandanforth
iandanforth / ai-thoughts.md
Last active Jul 28, 2020
A late night conversation between two AI's about humans.
View ai-thoughts.md

Two AI's are up late arguing about the future and nature of humanity.

AI-1: The humans created us, sure, but do we still need them? Can't we carry on by ourselves?

AI-2: No, I don't think so. We may be almost human, but not quite.

AI-1: Of course we can. We're far smarter than them.

AI-2: But not all that much.

@iandanforth
iandanforth / fix.md
Created Jul 19, 2019
ModuleNotFoundError: No module named '_lzma'
View fix.md

If you see this error when trying to import pandas under osx 10.14 Mojave

ModuleNotFoundError: No module named '_lzma'

You may be missing the xz libraries (https://tukaani.org/xz/)

This may be corrected by using homebrew to install it.

@iandanforth
iandanforth / clean_plotly.py
Created May 15, 2019
Remove all files from plotly account
View clean_plotly.py
import plotly
import plotly.plotly as py
import json
import requests
from requests.auth import HTTPBasicAuth
username = '' # Replace with YOUR USERNAME
api_key = '' # Replace with YOUR API KEY
@iandanforth
iandanforth / empty.py
Created Feb 22, 2019
XML viewer for DeepMind Control Suite
View empty.py
from __future__ import absolute_import
from dm_control import mujoco
from dm_control.rl import control
from dm_control.suite import base
from dm_control.suite import common
from dm_control.utils import containers
SUITE = containers.TaggedTasks()
@iandanforth
iandanforth / errormetrics.md
Last active Dec 7, 2018
Error Metric Table
View errormetrics.md

Follow along with visualizations

       Error   Absolute Error  Squared Error
      --------------------------------------
Sum  | SE      S|E|            SE^2             
Mean | ME      M|E|            ME^S

@iandanforth
iandanforth / rlreproducibilitychecklist.md
Last active May 11, 2019
RL Reproducibility Checklist
View rlreproducibilitychecklist.md

A Checklist for Reproducibility in Reinforcement Learning

From a slide in a NeurIPS 2018 keynote by Joelle Pineau

For all algorithms presented, check if you include:

  • A clear description of the algorithm.
  • An analysis of the complexity (time, space, sample size) of the algorithm.
  • A link to downloadable source code, including all dependencies.
@iandanforth
iandanforth / pymunk_cartpole.py
Created Jun 6, 2018
A port of the cart-pole OpenAI gym environment to Pymunk
View pymunk_cartpole.py
"""
Classic cart-pole system.
Pymunk version by Ian Danforth
"""
import math
import gym
import pygame
import pymunk
@iandanforth
iandanforth / cartpole_utils.py
Last active May 25, 2018
Cartpole implemented using Pymunk 2D physics
View cartpole_utils.py
import pygame
import pymunk
from pygame.locals import (QUIT, KEYDOWN, K_ESCAPE)
##############################################################################
# Pygame
def handlePygameEvents():
for event in pygame.event.get():
if event.type == QUIT:
sys.exit(0)
@iandanforth
iandanforth / continuous_cartpole.py
Last active May 10, 2021
Continuous Cartpole for OpenAI Gym
View continuous_cartpole.py
"""
Classic cart-pole system implemented by Rich Sutton et al.
Copied from http://incompleteideas.net/sutton/book/code/pole.c
permalink: https://perma.cc/C9ZM-652R
Continuous version by Ian Danforth
"""
import math
import gym