Skip to content

Instantly share code, notes, and snippets.

View jonnyrobbie's full-sized avatar

jonnyrobbie

View GitHub Profile
adobe-source-han-sans-otc-fonts
alsa-utils
amarok
appmenu-qt
arch-wiki-docs
archey3
ark
autoconf
automake
bash
bdf-tewi-git
compton
csv2latex
firefox-nightly
gimp-git
gimp-plugin-resynthesizer-git
glxinfo
gnome-breeze-git
gohufont
google-earth
library("ggplot2");
setwd("~/RWD");
data <- read.csv("hofstede_europe.csv", row.names=1);
pca <- prcomp(data);
pca.dims <- as.data.frame(pca$x)
pca.dims$lab <- row.names(pca.dims)
distance <- dist(data, method = "euclidean");
clust <- hclust(distance, method="ward");
groups <- cutree(clust, k=4);
pca.dims$group <- as.factor(groups);
/*@namespace url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul);*/
@-moz-document url("about:newtab") {
.newtab-link[href*="youtube.com"] > .newtab-thumbnail {
background-image: url("file:///home/marek/.mozilla/firefox/wwfdk369.new/chrome/youtube.png") !important;
}
.newtab-link[href*="seznam.cz"] > .newtab-thumbnail {
background-image: url("file:///home/marek/.mozilla/firefox/wwfdk369.new/chrome/seznam.png") !important;
}
.newtab-link[href*="facebook.com"] > .newtab-thumbnail {
@jonnyrobbie
jonnyrobbie / metro.csv
Last active December 27, 2016 14:58
R script for simple OLS
We can make this file beautiful and searchable if this error is corrected: It looks like row 9 should actually have 14 columns, instead of 11. in line 8.
Year,M_1_length_of_routes,M_2_vehicles,M_3_passengers,M_4_avg_speed,M_5_place_km,S_6_length_of_routes,S_7_vehicles,S_8_passengers,S_9_avg_speed,S_10_place_km,T_11_passengers,T_12_Prague_population,T_13_avg_income_Prague
2001,50.1,490,442448000,35.36,7132399000,2703.8,2266,661891000,22.54,10359943000,1104339000,1160118,18442
2002,50.1,491,416516000,35.36,6443208000,2725.7,2308,699093000,22.71,11075738000,1115609000,1161938,19926
2003,50.1,514,458642000,35.7,7290246000,2731.1,2290,672146000,22.95,10720017000,1130788000,1165581,21114
2004,54,490,496013000,34.6,8215418000,2677.3,2221,664519000,22.7,10661613000,1160532000,1170571,22204
2005,54,420,515098000,34.6,8632642000,2643.8,2149,632302000,22.9,10661296000,1147400000,1181610,23367
2006,54.9,555,531239000,34.6,8703277000,2682.7,2161,650166000,22.35,10702364000,1181405000,1188126,25001
2007,54.9,567,537266000,35.8,8721653000,2655.9,2138,655660000,22.25,10690456000,1192926000,1212097,26566
2008,59.4,576,596893000,35.51,9801991000,2452.6,2094,664946000,22.05,1089
require("plm")
require("nlme")
data(Grunfeld)
pooled.plm <- plm(inv~value+capital, data=Grunfeld, model="pooling")
summary(pooled.plm) #Gujarati 16.3.1
fixed.firm.plm <- plm(inv~value+capital, data=Grunfeld, model="within",
index=c("firm", "year"), effect="individual")
summary(fixed.firm.plm) #Gujarati 16.3.4
#!/usr/bin/python
# brute force solution for https://www.youtube.com/watch?v=1lHDCAIsyb8
def reverse(number):
s_number = str(number)
l_number = len(s_number)
return(int(s_number[l_number-1:] + s_number[:l_number-1]))
correct = 105263157894736842 # yeah...that brute force might took longer than I expected :)
print("Correct solution: %i, reversed: %i or doubled: %i." % (correct, reverse(correct), correct*2))
#i = 1 # it was immediately shown that the solution works with i=0 :)
#!/usr/bin/python
#python3
#Gambling simulator based on Looking Glass Universe's https://www.youtube.com/watch?v=t8L9GCophac
import argparse
import logging
from random import random
from matplotlib import pyplot as plt
#argument parser
parser = argparse.ArgumentParser(description='Gambling simulator based on Looking Glass Universe\'s https://www.youtube.com/watch?v=t8L9GCophac.')
@jonnyrobbie
jonnyrobbie / os_share.R
Last active October 2, 2017 11:55
Generates plots from netstat on OS or Browser market share
#!/usr/bin/RScript
require(ggplot2)
require(reshape2)
require(gtable)
require(grid)
rm(list=ls())
#https://www.netmarketshare.com/operating-system-market-share.aspx?qprid=9&qpcustomb=0&qpsp=197&qpnp=24&qptimeframe=M
#https://www.netmarketshare.com/browser-market-share.aspx?qprid=1&qpcustomb=0&qpsp=197&qpnp=24&qptimeframe=M
#select the time range as wide as you want and then export to csv either as `osshare.csv` or `browsershare.csv` to your WD.