Skip to content

Instantly share code, notes, and snippets.

View smackesey's full-sized avatar

Sean Mackesey smackesey

  • Dagster Labs
  • Reston, VA
View GitHub Profile
@smackesey
smackesey / linkproof_expand_path
Created June 26, 2013 17:45
Like `File#expand_path(<rel_path>, __FILE__)` but works for symlinks
require 'pathname'
ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", Pathname.new(__FILE__).realpath)
# src: Bundler binstubs
@smackesey
smackesey / gegist.js
Created January 5, 2014 06:26
Code for automated generation of a basic test suite for a yeoman generator. generator-ember is used as an example.
// SPEC OF GENERATOR EMBER
// this object includes information about generator dependencies, expected
// files, and options. This data is needed for the dynamic generation of tests.
// This spec is only provided here for convenience; normally it would reside in
// a separate file from the logic used for test generation. All code after the spec
// constitutes a module whose functions should be run in the context of the spec.
var data = {
scriptsDir: 'app/scripts',
templatesDir: 'app/templates',
#!/usr/bin/env python
import numpy as np
import itertools
def extractSlicesOverThreshold(series, windowSize=100, sizeThreshold=100, lengthThreshold=10):
means = np.convolve(data, np.ones(windowSize) / windowSize)[windowSize-1:]
overThresholds, groupLengths = zip(*[(k,len(list(g)))
for k,g in itertools.groupby(means, lambda x: x > sizeThreshold)])
groupStarts = np.insert(np.cumsum(groupLengths)[:-2], 0, 0)

GistID: 9383275

Toast of Berkeley Videos

Videos of speeches each week are recorded and posted to the Toast of Berkeley YouTube channel. Additionally, individual table topics responses may be recorded at the request of the speaker, though they are not recorded by default to encourage people to take the risk of speaking.

All videos are uploaded to YouTube under the "toastofberkeley2009" YouTube account (password is available from s.mackesey@gmail.com), with "Unlisted" status. An unlisted video is a video that will not show up in search results but that is accessible to anyone with the link (Google account not required). “Private” videos are different. Toast of Berkeley videos should be posted as unlisted, not private.

How to Post Videos

Step 1: Record the Videos

@smackesey
smackesey / gist:10946309
Created April 17, 2014 01:08
kauferprosocial config file for windows
import os
import time
import cv2
config = {
'outputDataDir' : "C:\\Documents and Settings\\Kauferlab\\Desktop\\prosocial_output",
'audio': {
import os
import time
config = {
#######################
# app
#
# outputDataDir -- directory where all application output will be written
# keyBindings -- a dictionary where the keys are 'quit', 'toggleStimulator',
#!/usr/bin/env Rscript
library("GenSA")
ntrials = 60
nparams = 22
bounds_vector <- c(
300000, 4000000,
40, 2000,
#!/usr/bin/env ruby
require 'csv'
require 'optparse'
# This script reads a CSV representation of the "Constraints" sheet of the
# Google Sheet at:
#
# https://docs.google.com/spreadsheets/d/1lJX_YRI-YKAxQs4C8q3ykws5it-zokSEXXq6yl6-xYg/edit#gid=0
#
# The path to the CSV file should be provided with the option -p or --path. The
# output is a string encoding the objective function derived from this sheet.
#!/usr/bin/env Rscript
library("GenSA")
ntrials = 1
nparams = 22
bounds_vector <- c(
300000, 4000000,
40, 2000,
@smackesey
smackesey / spearmint_shunt.py
Created July 4, 2015 03:09
spearmint_shunt
#!/usr/bin/env python
import copy
import json
import numpy as np
import os
import os.path as osp
import sys
from spearmint.tasks.task_group import TaskGroup
from spearmint.choosers.default_chooser import DefaultChooser