Skip to content

Instantly share code, notes, and snippets.

### put this in your .bash_profile, .zshrc or whatever
pman () { man -t "$*" | open -fa Preview; }
pman pthread
s = "en3pG3+nz+A2acXKrsyDouhViP9EDQS4JQK6uJqM3rBjKEBKC3yc=AA1=LUQqRPHvQ4dopgkbb/axClP3smzVcaTkRsCqHSG5aKFQ2TbOae0t5r4nWrCVesGK1Z3yEq+dClrDwXXOiAMyW09WdCS+CaKcfu=6kv9dUFBcS4KsUIgwMiXimoBpJZSWlBzILVf4zVA=7GjRP8RXn6uKjbjAPkpFEs/mYJpeOpEnhQfPhjoscgjfL5/SQsU6+jaAf5pg9MQzZdQAEJt7Jm1541fEmnumpjmJMd/MTJ5vzBttBBA7b5rbjDX0nHdTWn8C5suYKfNyYzc6x8S6FIepoEBsMS2mKhx5BRH5jSBrYRem4iQgYARzGnCFot3jPhp3cHj7qjXBWfZZASz8YJqi2d+r393AmdGm1L9NfU2f=FJprbLwJpuE7uT7xAlQA3Ry8aHRNgNkffP29Iqb2DSoQ0PK+9LX0t37HIAhI5zvoP6b4J7yQZEQDgeNlnPQMvSjw9pLWAxQ1VUY+NMU5BLZ2Bxuma1cIsHxcx4PwHcg0u1HYPJAWM2WK=xhJP5aQSc6oNMQK4s2=6guQRVFll6rvWkXTebrdsws7m/Kpa29spUFl8XzFx0ondEMCF3byAyWj875wAI3Hn8ZY92ddTAKj0s+a4X7qSti2lA0GzePHjBjMCD5g9kZYLtB94kkbVZ6eCle/xtto4LHH8GElc5YoUi=mk3nmQ5iOL1zMWfDyRUMLq+HCXbQL9NTejNa/yTdL3sayJOlMW1T7/Jmaz1FMbfBRFzruHeMT41=Zu3nYZJ3nIP22qKrFzNkt/24RuQ+7IMVCI2ngh2Yr8qLiL7QjSThRJPxA1wIJXwR2wqGiMhOqpun4DyQ5b/fTw1eTavpbFg6+tvqS4GKOt6p=bPoTV0GHIBBlXgHF/GUss90N0mXMKKiGwHhn/kyz=FxN0j=mfQUuUQa7lrZLjr10sqflWTwskIUkp1Cd8GYU4PaeWxiMBYFne4/8gJDt+dcZj
cat in40 | awk '{$1=""; print $0}' > in0
name=`echo -n $1 | sed s/' '//g`
echo $name
mkdir models${name}
for file in labels/*; do
echo $file
i=`echo -n $file | sed s/labels.//`
paste $file in0 -d " " > "in${i}"
../svmlight/svm_perf_learn "$1" "in${i}" "models${name}/model${i}"
rm "in${i}";
@pyetras
pyetras / datepicker.js
Last active April 15, 2016 07:17
Kilka komponentów z beecar.pl, angularJS w wersji 1.0 RC10. Drzewiej wiele rzeczy działało dość dziwnie/kapryśnie (np. nasłuchiwanie na wartości ngModel) a dokumentacja była biedna, także miejscami nie obyło się bez paru średnio optymalnych hacków.
//prosty datepicker, np. do daty urodzenia. Template na dole strony
.directive('datePicker', function($locale){
var strToDate = function(date){
if (_.isString(date)){
var parts = date.split('-');
return new Date(Date.UTC(parseInt(parts[0]), parseInt(parts[1], 10) - 1, parseInt(parts[2])));
}
return date;
};
@pyetras
pyetras / ng_if.js
Created January 10, 2014 18:47
ng-if for older (1.0.X) angularjs versions
angular.module('future', []).directive('ngIf', [function() {
return {
transclude: 'element',
priority: 600,
terminal: true,
restrict: 'A',
$$tlb: true,
compile: function ($element, $attr, $transclude) {
return function link($scope, $element, $attr, ctrl){
var block, childScope;
@pyetras
pyetras / gist:8362125
Last active January 2, 2016 21:18
first element visible in viewport
#first element visible onscreen
el = $(".entity").filter((i, e) -> $(e).offset().top + $(e).outerHeight() - $(".entity").first().offset().top > $(window).scrollTop()).first()
prev = el.offset().top
#!/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.