This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(shiny) | |
library(ggplot2) | |
library(gridExtra) | |
library(scales) | |
library(reshape2) | |
library(zoo) | |
shinyServer(function(input, output) { | |
output$distribution <- renderPlot({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/python2 | |
import sys | |
import codecs | |
from bibtexparser.bparser import BibTexParser | |
non_local_fields = ['address', | |
'annote', | |
'author', | |
'booktitle', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# prep and chroot into the existing system | |
sudo mkdir -p /mnt/root | |
sudo mount /dev/sda4 /mnt/root/ | |
sudo mount -t proc none /mnt/root/proc/ | |
sudo mount -o bind /dev /mnt/root/dev | |
sudo mount --bind /sys /mnt/root/sys | |
sudo chroot /mnt/root/ /bin/bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hg bookmarks | awk '{if (NF == 3) print $2; else print $1;}' | xargs -n 1 hg push -f -B |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get build-dep atlas | |
sudo apt-get install build-essential dpkg-dev cdbs devscripts gfortran liblapack-dev liblapack-pic | |
sudo apt-get source atlas | |
cd atlas* | |
sudo fakeroot debian/rules custom | |
# set n equal to the number of cpus (including virtual HT cpus) minus one | |
for i in {0..n}; do sudo cpufreq-set -g performance -c$i; done | |
sudo fakeroot debian/rules custom | |
sudo apt-get install libatlas-base-dev libatlas-base | |
sudo dpkg -i libatlas3gf-*.de |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# License: CC-BY-NC-SA 3.0 | |
import re | |
import codecs | |
# download kate_chopin_the_awakening_and_other_short_stories.txt | |
# from Project Gutenberg: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
packages.rforge <- c( | |
"R2admb" | |
,"lme4.0" | |
,"glmmADMB" | |
) | |
rforge.prefix <- c( | |
"" | |
,"lme4." | |
,"coefplot2." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tr < file-with-nulls -d '\000' > file-without-nulls | |
sed 's/\x0//g' file-with-nulls > file-without-nulls | |
sed 's/\x0/ /g' file-with-nulls > file-without-nulls | |
grep -P '\000' < file-with-nulls >file-without-nulls | |
awk '/\000/ { print }' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Random, DataFrames, MixedModels, PooledArrays | |
gendata(n::Int, nID::Int, nested=true) = gendata(MersenneTwister(42), n, nID, nested) | |
function gendata(rng::AbstractRNG, n::Int, nID::Int, nested::Bool) | |
df = DataFrame(y = zeros(n), | |
w = rand(rng, n), | |
x = rand(rng, n), | |
z = rand(rng, n), | |
sex = CategoricalArray([randstring(rng,"mf",1) for ii in 1:n]), | |
group = CategoricalArray(rand(rng, 1:5, n)), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using MixedModels, RCall, GLM | |
R"library(lme4)" | |
R"library(languageR)" | |
R"lexdec = as.data.frame(lexdec)"; | |
R"lexdec$rt_raw = exp(lexdec$RT)"; | |
R"ldform = rt_raw ~ 1 + Class * NativeLanguage + (1 | Subject) + (1 | Word)"; | |
R"""summary(ldmod <- glmer(ldform, lexdec, family=Gamma(link="identity"),nAGQ=0))""" | |
lexdec = rcopy(R"lexdec"); | |
ldform = @formula(rt_raw ~ 1 + Class * NativeLanguage + (1 | Subject) + (1 | Word)); |