Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Manos Parzakonis IronistM

🎯
Focusing
View GitHub Profile
@IronistM
IronistM / sql.export.randomForest.R
Created May 24, 2017 — forked from shanebutler/sql.export.randomForest.R
Deploy your RandomForest models in SQL! This tool enables in-database scoring of Random Forest models built using R. To use it, you simply call the function with the Random Forest model, output filename, SQL input data table and the name of the unique key on that table. For example:sql.export.rf(rf.mdl, file="model_output.SQL", input.table="sour…
View sql.export.randomForest.R
# sql.export.rf(): save a randomForest model as SQL
# v0.04
# Copyright (c) 2013-2014 Shane Butler <shane dot butler at gmail dot com>
#
# sql.export.rf is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# sql.export.rf is distributed in the hope that it will be useful, but
@IronistM
IronistM / s3.sh
Created Apr 11, 2017 — forked from chrismdp/s3.sh
Uploading to S3 in 18 lines of Shell (used to upload builds for http://soltrader.net)
View s3.sh
# You don't need Fog in Ruby or some other library to upload to S3 -- shell works perfectly fine
# This is how I upload my new Sol Trader builds (http://soltrader.net)
# Based on a modified script from here: http://tmont.com/blargh/2014/1/uploading-to-s3-in-bash
S3KEY="my aws key"
S3SECRET="my aws secret" # pass these in
function putS3
{
path=$1
@IronistM
IronistM / install-rstudio-daily.sh
Last active Jun 23, 2017 — forked from aronatkins/install-rstudio-daily.sh
Install RStudio daily build on OSX/macOS or Elementary OS
View install-rstudio-daily.sh
#!/bin/bash
#
# Installs the latest RStudio daily desktop build for OSX/macOS and Ubuntu(amd64)
#
# https://support.rstudio.com/hc/en-us/articles/203842428-Getting-the-newest-RStudio-builds
set -e
install_macos_daily() {
REDIRECT_URL="https://www.rstudio.org/download/latest/daily/desktop/mac/RStudio-latest.dmg"
@IronistM
IronistM / setup-elementary.sh
Last active Oct 31, 2020 — forked from floriancourgey/setup-elementary.sh
Things to do after installing elementary OS Loki 0.4
View setup-elementary.sh
#Start with a dist upgrade
sudo apt dist-upgrade
# Get chrome
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo dpkg -i ./google-chrome*.deb
sudo apt-get install -f
# dev (php, docker, git, node, bower, electron, composer)
sudo apt install -y \
@IronistM
IronistM / github.gs
Created Oct 3, 2016 — forked from chipoglesby/github.gs
A Google Apps Script that automatically opens a pull request on a Github Repo.
View github.gs
function github() {
username = "xxx"
repo = "xxx"
url = "https://api.github.com/repos/"+username+"/"+repo+"/issues"
payload = {
"title": "xxx",
"body": "xxx",
"assignee": "xxx"
}
sendToGithub(url, payload)
@IronistM
IronistM / r_script_to_read_basic_info_from_all_available_views.r
Created Sep 28, 2016
R Script to read basic info from all available views
View r_script_to_read_basic_info_from_all_available_views.r
library("RGoogleAnalytics")
library("ggplot2")
library("dplyr")
#Google Auth Codes
clientid = "USE YOUR CLIENT ID HERE"
clientsecret = "CLIENT SECRET GOES HERE"
#Fire off an AUTH request to Google. This will actually kick off a browser opening to do the OAuth2 transaction.
oauth_token <- Auth(clientid,clientsecret)
@IronistM
IronistM / custom_dimension_check.r
Created Sep 28, 2016
A function to check if custom dimensions work (via Pawel Kapuscinski)
View custom_dimension_check.r
library(Rcpp)
library(RGA)
profiles <- list_profiles()
webIDs <- unique(profiles$webPropertyId)
col <- c("id","accountId","webPropertyId","name","index","scope","active","working")
for(i in webIDs){
assign("dims", list_custom_dimensions(accountId = unlist(profiles[which(profiles$webPropertyId==i)[1],2]),webPropertyId = i,token=token))
for(j in dims$id){
test<-get_ga(unlist(profiles[which(profiles$webPropertyId==i)[1],1]),
start.date=start,
@IronistM
IronistM / gtm_checker.R
Created Sep 28, 2016
Check a list of URLs for existence of the Google Tag Manager Container code (via Donal Phipps)
View gtm_checker.R
#' Check a list of URLs for existence of the Google Tag Manager Container code
#'
#' @param containers
#' A character vector of the container IDs for Google Tag Manager
#' @param urlFile
#' A character vector providing the path to a csv file with 2 columns: url, the full url to the page to be checked; country, the country where the URL is hosted.
#'
#' @param outputdir
#' A character vector providing the path to the desired output directory for the csv of results. If not provided, the csv will be output to the current working directory.
View simulating_sales.R
# *--------------------------------------------------------------------
#Adstock functions
adstock_calc_1<-function(media_var,dec,dim){
length<-length(media_var)
adstock<-rep(0,length)
for(i in 2:length){
adstock[i]<-(1-exp(-media_var[i]/dim)+dec*adstock[i-1])
}
adstock
}
@IronistM
IronistM / finSim.R
Last active Sep 22, 2016 — forked from coppeliaMLA/finSim.R
Uncertainty in a financial model
View finSim.R
#First we are going to set up probability distributions for our beliefs about the inputs
#We've been told ARPU is about £7 and it's very unlikely to be higher than £10 or lower than £4
#So we'll go for a normal distribution centred at 7 with 5% and 95% quantiles at 4 and 10
#Show how we get the variance
arpu.sd<-3/1.96
x<-seq(0, 15,by=0.5)
d<-dnorm(x, 7, arpu.sd)
plot(x, d, type='l')