Skip to content

Instantly share code, notes, and snippets.

View jonnyrobbie's full-sized avatar

jonnyrobbie

View GitHub Profile
Computer Information:Manufacturer: Gigabyte Technology Co., Ltd.
Model: AB350-Gaming-CF
Form Factor: Desktop
No Touch Input Detected
Processor Information:CPU Vendor: AuthenticAMD
CPU Brand: AMD Ryzen 5 1600X Six-Core Processor
CPU Family: 0x17
CPU Model: 0x1
CPU Stepping: 0x1
CPU Type: 0x0
#!/usr/bin/env RScript
#require(ggplot2)
require(plotly)
require(reshape2)
data <- data.frame(
y=c(13, 5, 22),
x1=c(4, 13, 15),
x2=c(35, 24, 67))
require("ggplot2")
require("reshape2")
data <- t(read.table("allgenres.tsv", sep="\t", header=T, row.names=1))
data <- as.data.frame(data)
data <- subset(data, select= -`\\N`)
data <- data[24:124,]
data$Total <- rowSums(data)
data <- as.matrix(data)
share.data <- data/data[,"Total"]
share.data <- subset(share.data, select= -Total)
#/usr/bin/env RScript
require("readODS")
require("reshape2")
require("ggplot2")
rm(list=ls())
setwd("~/RWD")
sheet <- read_ods("gfx_linux_comp.ods", sheet="data", col_names=TRUE)
melted <- melt(sheet, id.vars=c("model", "brand", "manufacturer", "price", "price-msrp", "price-low"))
lm_model <- lm(log(value)~log(price)+brand, data=melted)
@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.
#!/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.')
#!/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 :)
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
@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