Skip to content

Instantly share code, notes, and snippets.

Phillip Alday palday

Block or report user

Report or block palday

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@palday
palday / talldatasim.jl
Created Sep 28, 2019
Tall data test for MixedModels.jl
View talldatasim.jl
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)),
@palday
palday / beyond-cran.R
Last active Feb 11, 2016
Useful R packages for mixed effects models
View beyond-cran.R
packages.rforge <- c(
"R2admb"
,"lme4.0"
,"glmmADMB"
)
rforge.prefix <- c(
""
,"lme4."
,"coefplot2."
View extractbib.py
#! /usr/bin/python2
import sys
import codecs
from bibtexparser.bparser import BibTexParser
non_local_fields = ['address',
'annote',
'author',
'booktitle',
View server.R
library(shiny)
library(ggplot2)
library(gridExtra)
library(scales)
library(reshape2)
library(zoo)
shinyServer(function(input, output) {
output$distribution <- renderPlot({
@palday
palday / regex.py
Last active Dec 30, 2015
Potential regex bug in python -- why isn't "o'clock" part of the match for re.findall()?
View regex.py
#! /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:
@palday
palday / atlas
Last active Dec 17, 2015
ATLAS for R on Debian and Ubuntu
View atlas
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
@palday
palday / purge-null
Created Jan 29, 2013
A few ways to find and get rid of NULL bites in documents.
View purge-null
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 }'
@palday
palday / hg push-all
Created Jan 29, 2013
bash-fu to push all mercurial bookmarks
View hg push-all
hg bookmarks | awk '{if (NF == 3) print $2; else print $1;}' | xargs -n 1 hg push -f -B
@palday
palday / restore_grub_refit.sh
Created Oct 4, 2012
Restore a damaged GRUB on Mac using rEFIt
View restore_grub_refit.sh
#! /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
You can’t perform that action at this time.