Skip to content

Instantly share code, notes, and snippets.

View iandanforth's full-sized avatar

Ian Danforth iandanforth

View GitHub Profile
@iandanforth
iandanforth / externalPIDControl.py
Created October 27, 2013 17:07
An exploration of PID control external to that provided by the AX-12 Dynamixel servo.
#!/usr/bin/env python
import os
import dynamixel
import time
import sys
import subprocess
import optparse
import yaml
@iandanforth
iandanforth / focusmate-start.js
Created October 6, 2020 16:08
Greasemonkey Focusmate Session Start Alert
// ==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 / batch-import.py
Created November 29, 2012 21:40 — forked from ajcronk/batch-import.py
Python CSV batch import example
import dateutil.parser
import optparse
import csv
import tempodb
from threading import Thread
from Queue import Queue
class Worker(Thread):
"""Thread executing tasks from a given tasks queue"""
@iandanforth
iandanforth / ai-thoughts.md
Last active July 28, 2020 16:26
A late night conversation between two AI's about humans.

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 / clean_plotly.py
Created May 15, 2019 16:14
Remove all files from plotly account
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 / beep.js
Last active January 29, 2020 03:09
Add beep(); method to jupyter notebooks
%%javascript
// Source - https://stackoverflow.com/a/23395136
Jupyter.beep = () => {
var snd = new Audio("data:audio/wav;base64,//uQRAAAAWMSLwUIYAAsYkXgoQwAEaYLWfkWgAI0wWs/ItAAAGDgYtAgAyN+QWaAAihwMWm4G8QQRDiMcCBcH3Cc+CDv/7xA4Tvh9Rz/y8QADBwMWgQAZG/ILNAARQ4GLTcDeIIIhxGOBAuD7hOfBB3/94gcJ3w+o5/5eIAIAAAVwWgQAVQ2ORaIQwEMAJiDg95G4nQL7mQVWI6GwRcfsZAcsKkJvxgxEjzFUgfHoSQ9Qq7KNwqHwuB13MA4a1q/DmBrHgPcmjiGoh//EwC5nGPEmS4RcfkVKOhJf+WOgoxJclFz3kgn//dBA+ya1GhurNn8zb//9NNutNuhz31f////9vt///z+IdAEAAAK4LQIAKobHItEIYCGAExBwe8jcToF9zIKrEdDYIuP2MgOWFSE34wYiR5iqQPj0JIeoVdlG4VD4XA67mAcNa1fhzA1jwHuTRxDUQ//iYBczjHiTJcIuPyKlHQkv/LHQUYkuSi57yQT//uggfZNajQ3Vmz+Zt//+mm3Wm3Q576v////+32///5/EOgAAADVghQAAAAA//uQZAUAB1WI0PZugAAAAAoQwAAAEk3nRd2qAAAAACiDgAAAAAAABCqEEQRLCgwpBGMlJkIz8jKhGvj4k6jzRnqasNKIeoh5gI7BJaC1A1AoNBjJgbyApVS4IDlZgDU5WUAxEKDNmmALHzZp0Fkz1FMTmGFl1FMEyodIavcCAUHDWrKAIA4aa2oCgILEBupZgHvAhEBcZ6joQBxS76AgccrFlczBvKLC0QI2cBoCFvfTDAo7eoOQInqDPBtvrDEZBNYN5xwNwxQRfw8ZQ5wQVLvO8OYU+mHvFLlDh05Mdg7BT6YrRPpCBznMB2r//xKJjyyOh+cImr2/4do
@iandanforth
iandanforth / rlreproducibilitychecklist.md
Last active May 11, 2019 01:34
RL Reproducibility Checklist

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 / empty.py
Created February 22, 2019 02:32
XML viewer for DeepMind Control Suite
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 December 7, 2018 20:11
Error Metric Table

Follow along with visualizations

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

@iandanforth
iandanforth / cartpole_utils.py
Last active May 25, 2018 16:45
Cartpole implemented using Pymunk 2D physics
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)