Skip to content

Instantly share code, notes, and snippets.

View fredcallaway's full-sized avatar

Fred Callaway fredcallaway

View GitHub Profile
using Distributions
using Plots
gr(label="", dpi=200, size=(400,300), lw=2)
α, β = 1, 5
prior = Beta(α, β)
max_n = 25
n = 0:max_n
posterior = Beta.(α .+ n, β) # Assuming θ = 1, we always get heads
@fredcallaway
fredcallaway / Model01-Firmware.ino
Created November 19, 2020 17:13
Testing host keymaps
// -*- mode: c++ -*-
// Copyright 2016 Keyboardio, inc. <jesse@keyboard.io>
// See "LICENSE" for license details
#ifndef BUILD_INFORMATION
#define BUILD_INFORMATION "locally built"
#endif
/**
@fredcallaway
fredcallaway / Model01-Firmware.ino
Created May 31, 2020 06:30
Fred's Model01-Firmware.ino that worked previously
// -*- mode: c++ -*-
// Copyright 2016 Keyboardio, inc. <jesse@keyboard.io>
// See "LICENSE" for license details
#ifndef BUILD_INFORMATION
#define BUILD_INFORMATION "locally built"
#endif
/**
* These #include directives pull in the Kaleidoscope firmware core,
This file has been truncated, but you can view the full file.
BOARD_HARDWARE_PATH="/Users/fred/Documents/Arduino/hardware" /Users/fred/Documents/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope/bin//kaleidoscope-builder build-all
Building ./Model01-Firmware 0.0.0-gv1.22-75-g03be into /var/folders/n0/lkhl85vn0951js8ct7ld_1br0000gn/T//kaleidoscope-fred/sketch/12886325562-Model01-Firmware.ino/output
In file included from /Users/fred/Documents/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope/src/kaleidoscope/key_defs.h:22:0,
from /Users/fred/Documents/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope/src/kaleidoscope_internal/sketch_exploration/keymap_exploration.h:19,
from /Users/fred/Documents/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope/src/kaleidoscope_internal/sketch_exploration/sketch_exploration.h:19,
from /Users/fred/Documents/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope/src/kaleidoscope_internal/event_dispatch.h:41,
from /Users/fred/Documents/Arduino/hardware/ke
[HIT Configuration]
title = Block stacking experiment (~15 minutes)
description = Solve block stacking puzzles in this Psychology experiment
amt_keywords = Psychology
lifetime = 24
us_only = true
approve_requirement = 95
contact_email_on_error = cocosci.turk@gmail.com
ad_group = Default psiTurk
organization_name = Princeton University
@fredcallaway
fredcallaway / stochastic_matrix.py
Created November 10, 2016 06:11
Stochastic matrix in pymc3
import numpy as np
import pymc3 as pm
import theano
class StochasticMatrix(pm.Continuous):
"""A stochastic matrix has rows that sum to 1."""
def __init__(self, theta, *args, **kwargs):
shape = (theta.shape[-1], theta.shape[-1])
kwargs.setdefault('shape', shape)
super(StochasticMatrix, self).__init__(*args, **kwargs)
@fredcallaway
fredcallaway / ed_hmm.py
Last active November 8, 2018 03:06
Hidden Markov Model implemented in edward
#!/usr/bin/env python
"""Hidden Markov Models
Abstract base class for HMMs and an implementation of an HMM
with discrete states and gaussian emissions.
"""
import tensorflow as tf
import edward as ed
from edward.models import Bernoulli, Categorical, Normal
@fredcallaway
fredcallaway / classypedia.css
Created September 12, 2016 18:39
Classypedia with improved TOC
@font-face {
font-family: 'Cinzel';
font-style: normal;
font-weight: 400;
src: local('Cinzel-Regular'), url(//themes.googleusercontent.com/static/fonts/cinzel/v1/mLL0ZqnXRx3m16FnBy9gcg.woff) format('woff');
}
@font-face {
font-family: 'Droid Sans';
font-style: normal;
font-weight: 400;
@fredcallaway
fredcallaway / approve_and_bonus.py
Last active April 24, 2018 01:14
Approves and bonuses all participants in a psiturk experiment.
#!/usr/bin/env python2
"""
Approves and bonuses (if applicable) all workers in the database for the
current psiturk project.
"""
from __future__ import print_function
from psiturk.amt_services_wrapper import MTurkServicesWrapper, Participant, init_db, db_session
wrapper = MTurkServicesWrapper()
@fredcallaway
fredcallaway / 2afc_items.ipynb
Created February 22, 2018 02:54
Item level effects
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.