Skip to content

Instantly share code, notes, and snippets.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pyetras
pyetras / chunkUntil.scala
Created September 9, 2015 15:04
chunkUntil for scalaz-stream
def chunkUntil[I](emit: I => Boolean): Process1[I, Vector[I]] = {
def go(acc: Vector[I]): Process1[I, Vector[I]] =
Process.receive1Or[I,Vector[I]](Process.emit(acc)) { i =>
val chunk = acc :+ i
if (emit(i)) Process.emit(chunk) ++ go(Vector())
else go(chunk)
}
go(Vector())
}
@pyetras
pyetras / #0 Readme.md
Created August 22, 2015 00:31
Installing git2r on OS X

Install openssl with brew, add the following to ~/.R/Makevars

@pyetras
pyetras / Readme.md
Created August 20, 2015 17:31
Installing rnlopt

Add

CC=gcc-5
CXX=g++-5
PKG_CFLAGS=  -I/Users/Pietras/Downloads/nloptr-master/nlopt-2.4.2/include
PKG_LIBS=  -lm /Users/Pietras/Downloads/nloptr-master/nlopt-2.4.2/lib/libnlopt_cxx.a

to ~/.R/Makevars

@pyetras
pyetras / 0Readme.md
Last active March 23, 2018 21:21
Installing caffe (digits version) on OS X
  • Virtualenv

Create a new virtualenv with conda. Install digits' requirements:

conda create -n digits --file requirements.txt -c https://conda.binstar.org/slobodan -c https://conda.binstar.org/dougal -c https://conda.binstar.org/pyetras
  • Dependencies

First apply brew-boost.patch to brew repository (patches boost to version 1.5.5)

@pyetras
pyetras / LiftUnliftType.scala
Created April 21, 2015 13:34
Lift or unlift type from shapeless' hlist element type
object UnliftType {
def apply[L <: HList, M[_]](implicit unlift: UnliftType[L, M]) = unlift
type Aux[L <: HList, M[_], R <: HList] = UnliftType[L, M] { type Out = R }
implicit def unliftType[H, L <: HList, R <: HList, M[_]]
(implicit ev: Aux[L, M, R]) :
Aux[M[H] :: L, M, H :: R] =
new UnliftType[M[H] :: L, M] { type Out = H :: R }
implicit def unliftNoType[H, L <: HList, R <: HList, M[_]]
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDlx7plcFbtfnGBLr8oKm02hBANckhOwSp0wXfVznaJ3Azlr4a5gduT2Vpb/F5Ja9WYKnQe5QrOusE2ZPvn/oxAtKRlum1aHjySb8sTLw/Zfd2HPW1FdCCY1DsQE0A2ltuXZYDxc/oAzlHQcZWFcUKy6QyWQ4Z8bi4MVCukJPcxjFebh1hg5a0gNgQ8DzvkE9RE8mf/vfb2ONfPes6Zzz/CVNqO4pVuqTJKv6993gh7e8bklYBxuGeOiJNBHJ4yFr/cAdo2+B1LlLYmXBWoNV5eehLdY4K9yuwI5/YdLMYIby9M7cx5EWLMT7ORFpRqGW8u36fq8xtuVl5AmYgPIROT Pietras@your-ass-is-mine.local
@pyetras
pyetras / 0bootstrap.sh
Last active September 13, 2016 22:00
OS X dotfiles
#AppStore: Install XCode
#install homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew doctor
brew update
curl https://gist.githubusercontent.com/pyetras/4b59e1902cfaf9af3c98/raw/Caskfile > Caskfile
curl https://gist.githubusercontent.com/pyetras/4b59e1902cfaf9af3c98/raw/Brewfile > Brewfile

why is this interesing?

[RPlot14.pdf]

This diagram visualizes top 100 contributors to rails/rails collaborating on other open-source projects on github. Each cell represents two projects that shared some contributors; darker cells indicate that more rails/rails people collaborated in both projects.

This data was pulled from GitHub Archive stored in Google BigQuery. It contains a total number of over 227 * 10^6 events from 2011 till the present day. BigQuery enables querying this huge dataset with a SQL-like language and reasonable performance. We would start by finding all GitHub users (or actors) that were involved with the rails/rails repository and counting their activities.

select
all.actor,
datediff(all.last_at, all.first_at) as length,
all.cnt as all, all.cnt_meaningful as meaningful,
datediff(all.last_at, all.first_at)/all.cnt as freq,
all.cnt_contributions > 0 as is_contributor,
all.cnt_contributions as contributions
from
(SELECT
actor_attributes_login as actor,