Skip to content

Instantly share code, notes, and snippets.

View jmxpearson's full-sized avatar

John Pearson jmxpearson

View GitHub Profile
@jmxpearson
jmxpearson / Default (OSX).sublime-keymap
Last active December 27, 2015 13:49
My settings for Sublime Text 2
[
{ "keys": ["ctrl+enter"], "command": "repl_transfer_current", "args": {"scope": "lines"}},
{ "keys": ["ctrl+shift+enter"], "command": "repl_transfer_current", "args": {"scope": "selection"}}
]
@jmxpearson
jmxpearson / ethojoin.sql
Last active December 28, 2015 17:19
Sample join command to get spike info for Geoff's data
select count(*), var, unit, sum(start - stop)
from (
select movie, montime, mofftime
from (spikes, showings
where spikes.time > ontime and spikes.time < offtime)
join etho on movie )
group by etho.var, unit
@jmxpearson
jmxpearson / ggplot_grid.R
Created May 5, 2014 19:35
ggplot2 grid plot of regression coefficients
ddir <- '~/data/bartc' # data directory
load(file=paste(ddir, 'fitdata', sep='/'))
extractfun <- function(x) {
outs <- c(x$baseline, x$effects)
names(outs)[1] = 'baseline'
return (outs)
}
dat <- as.data.frame(t(sapply(fitobjs, FUN=extractfun, simplify=TRUE)))
@jmxpearson
jmxpearson / gist:b5535198e09ab528bd47
Last active August 29, 2015 14:24
Coursera scala setup

Getting Eclipse/Scala-IDE set up for the Coursera Scala class was a pain. This is because the course materials were created for Scala 2.10, but the editor and IDE are set up with 2.11. Plus lots of other versions, dependencies, etc. have changed.

So here's what I needed to do for the example assignment:

  • Do this:
    • However, I did not comment out the Eclipse plugin line in project/buildSettings.sbt. Instead, I changed it to version 2.2.0, which worked. (I think 2.1.0 is deprecated and no longer hosted.)
  • After this, sbt built (command sbt eclipse) and the package imported in Eclipse, but I had errors, and my Scala tests wouldn't run.
  • Finally, I needed to right click the project and do Properties -> Scala Compiler -> Scala Installation and choose 2.10. I got this tip from here
srand(12345)
function makeLtri(x)
l = length(x)
p = round(Int, (sqrt(1 + 8l) - 1) / 2)
L = zeros(eltype(x), (p, p))
k = 1
for j in 1:p
for i in j:p
L[i, j] = x[k]
@jmxpearson
jmxpearson / Outline.md
Last active March 17, 2017 15:07
Git Workshop Notes

#Outline:

Why are we doing this? (software in teams)

Shell

What is the shell?

  • a program
  • for talking to the os
  • a scripting language
from psychopy import core, visual
from psychopy.visual.circle import Circle
class Flicker(Circle):
"""
Creates a flickering circle in the upper right corner of the screen.
This is to be used as a timing marker by a photodiode.
The presence or absence of the circle marks out an 8-bit binary pattern,
flanked at the beginning and end by a 1 (e.g., 5 is 1000001011).
"""
@jmxpearson
jmxpearson / spiking_power.ipynb
Last active January 24, 2017 16:29
Sample power analysis for firing rate task
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jmxpearson
jmxpearson / reading_plx_spike_data.ipynb
Last active February 7, 2023 09:28
Reading Plexon data with Neo
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jmxpearson
jmxpearson / tf_edward_example.ipynb
Created February 20, 2017 18:07
Example of Poisson GLM in TensorFlow/Edward
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.