Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
# HOWTO:
# replace ps292408/s292408 with your logins
# put "cd zad2/ && chmod +x run.sh && ./run.sh" in .bashrc on nvidia1/nvidia2
# generate pubkey on nvidia-host and put in on students and vice versa. add server fingerprint etc
# on students:
# # mkdir repo && cd repo && git init --bare
# put this file in hooks/post-receive and chmod +x it
# on your dev station:
@pyetras
pyetras / plot.R
Last active August 29, 2015 14:05
library(igraph)
library(ggplot2)
rails <- read.csv("data/rails_edges.csv")
rails$repository1 <- substring(rails$repository1, 20)
rails$repository2 <- substring(rails$repository2, 20)
cntrb <- cbind(rails$repository2, rails$contributor_cnt)
rails <- rails[, c("repository1", "repository2", "actors_cnt")]
rbind(cntrb, c("rails/rails", 2049)) -> cntrb
cntrb <- as.data.frame(cntrb)
cntrb$V2 <- as.numeric(as.character(cntrb$V2))
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,

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.

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDlx7plcFbtfnGBLr8oKm02hBANckhOwSp0wXfVznaJ3Azlr4a5gduT2Vpb/F5Ja9WYKnQe5QrOusE2ZPvn/oxAtKRlum1aHjySb8sTLw/Zfd2HPW1FdCCY1DsQE0A2ltuXZYDxc/oAzlHQcZWFcUKy6QyWQ4Z8bi4MVCukJPcxjFebh1hg5a0gNgQ8DzvkE9RE8mf/vfb2ONfPes6Zzz/CVNqO4pVuqTJKv6993gh7e8bklYBxuGeOiJNBHJ4yFr/cAdo2+B1LlLYmXBWoNV5eehLdY4K9yuwI5/YdLMYIby9M7cx5EWLMT7ORFpRqGW8u36fq8xtuVl5AmYgPIROT Pietras@your-ass-is-mine.local
@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[_]]
@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 / #0 Readme.md
Created August 22, 2015 00:31
Installing git2r on OS X

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

#include <iostream>
#include <stack>
using namespace std;
stack<int> liczby;
int main (int argc, char const *argv[])
{
char c = 0;
while(true){
#!/bin/bash
username=$(whoami)
proc="$(ps aux | grep $username | grep -v $0 | grep firefox | grep -v grep)"
if [ "$proc" != "" ]
then
echo "shutdown firefox first!"
exit 1
fi