Skip to content

Instantly share code, notes, and snippets.

View mja's full-sized avatar
💭
🙊

Mark James Adams mja

💭
🙊
View GitHub Profile
@mja
mja / .bashrc
Created January 17, 2009 13:28 — forked from boosty/git_status.sh
# http://henrik.nyh.se/2008/12/git-dirty-prompt
# http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/
#
# boosty likes it like that:
# ~/dev/dir[master]$ # clean working directory
# ~/dev/dir[master⚡]$ # dirty working directory
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "⚡"
}
*** caught bus error ***
address 0x8, cause 'non-existent physical address'
Traceback:
1: .C("MCMCglmm", as.double(data$MCMC_y), as.double(data$MCMC_y.additional), as.double(data$MCMC_liab), as.integer(mvtype), as.integer(length(data$MCMC_y)), as.integer(X@i), as.integer(X@p), as.double(X@x), as.integer(X@Dim), as.integer(length(X@x)), as.integer(Z@i), as.integer(Z@p), as.double(Z@x), as.integer(Z@Dim), as.integer(length(Z@x)), as.integer(A@i), as.integer(A@p), as.double(A@x), as.integer(A@Dim), as.integer(length(A@x)), as.double(MSsd), as.integer(id - 1), as.integer(dam - 1), as.integer(sire - 1), as.integer(PedDim), as.integer(Aterm), as.integer(nfl), as.integer(nrl), as.integer(update), as.integer(split - 1), as.integer(c(nG, nR)), as.double(GRinv), as.double(GRvpP), as.double(GRnpP), as.integer(nitt), as.integer(thin), as.integer(burnin), as.integer(c(pr, pl)), as.double(Loc), as.double(Var), as.double(PLiab), as.integer(data$MCMC_family.names),
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
survey_id
1
@mja
mja / ezproxy.rb
Created March 29, 2010 16:27
EZproxy Service Workflow
require 'uri'
ARGV.first.split.each do |f|
article = URI.parse(f)
article.host = article.host + ".ezproxy.YOUR-INSTITUTION"
puts article.to_s
end
@mja
mja / ggplot options.R
Created May 24, 2010 13:04
Options for ggplot2
# Options for ggplot + opts(...)
# These don't seem to be documented on the web. Listed here for reference.
# list current setting
theme_get()
# Make a plot
g <- ggplot(...)
# Print the plot with options
7/15/10 3:28:32 PM Papers[35823] Error saving context after finish import2: Error Domain=NSCocoaErrorDomain Code=133020 UserInfo=0x190937c0 "Could not merge changes." | Info: {
conflictList = (
{
cachedRow = {
name = "cross-culture";
parent = <null>;
predicateData = <62706c69 73743030 d4010203 040508e3 e4542474 6f705824 6f626a65 63747358 24766572 73696f6e 59246172 63686976 6572d106 0754726f 6f748001 af103809 0a11171a 1f273132 343c4045 464b4f55 5a5b6068 6d72777c 7d818485 888b8d92 969b9ea2 a7acadb1 b4b5b8b9 bdc4c7cb d0d5d6da dde0e155 246e756c 6cd30b0c 0d0e0f10 5f10174e 53436f6d 706f756e 64507265 64696361 74655479 70655f10 0f4e5353 75627072 65646963 61746573 5624636c 61737310 01800280 1fd2120d 13165a4e 532e6f62 6a656374 73a21415 80038020 801ed30b 0c0d0e18 10800480 1fd2120d 1b16a21c 1d800580 16801ed4 20210d22 23242526 5f10114e 53526967 68744578 70726573 73696f6e 5f10104e 534c6566 74457870 72657373 696f6e5f 10134e53 507
f <- function(a, b,...) {
as.list(match.call()[-1])
}
# > f(x, y, c=z)
# $a
# x
#
# $b
# y
@mja
mja / age_weight.csv
Created September 28, 2010 08:11
Data for UofE course on R
MALE AGE WEIGHT SMOKE1 SMOKE2
1 58 115.81 yes yes
0 62 101.22 no no
1 59 78.92 no yes
0 64 75.83 no yes
1 55 104.19 no yes
1 53 105.76 yes no
1 30 91.58 yes no
0 38 41.2 yes no
1 30 51.84 yes no
@mja
mja / fst-coda.R
Created October 22, 2010 21:09
Model output from from Beaumont & Balding, 2004
library(coda)
# data from Beaumont MA, Balding DJ 2004 Molecular Ecology, 13: 969-980
fst <- read.table("http://gist.github.com/raw/641378/020f716d2b96643201653eb62f7ee9387bebc136/fst.out")
# Turn the parameter for the first loci into an MCMC object
g6pd <- mcmc(fst[,2])
# print summary info
summary(g6pd)
@mja
mja / do-call-example.R
Created November 16, 2010 15:47
Using the ... arguments programmatically with do.call
do.call('+', list(1, 2))