Skip to content

Instantly share code, notes, and snippets.

View IronistM's full-sized avatar
🏗️
Under construction

Manos Parzakonis IronistM

🏗️
Under construction
View GitHub Profile
function onOpen(){
// example send for Sheets
sendGAMP("UA-XXXX-1", SpreadsheetApp.getActiveSpreadsheet().getUrl());
// example send for Documents
//sendGAMP("UA-XXXX-1", DocumentApp.getActiveDocument().getUrl());
// example send for Forms *NOTE* getUrl not implemented yet in New Sheets
//sendGAMP("UA-XXXX-1", FormApp.getActiveForm().getUrl());
}
require(redshift)
conn <- redshift.connect("jdbc:postgresql://mycluster.redshift.amazonaws.com:5439/data", "user", "pass")
# we can retrieve a list of tables
tables <- redshift.tables(conn)
# and get some info about the columns in one of those tables
cols <- redshift.columns(conn, "weblog")
library(RCurl)
library(XML)
library(plyr)
#' get the Qualys SSL Labs rating for a domain+cert
#'
#' @param site domain to test SSL configuration of
#' @param ip address of \code{site} (will resolve it and take\cr
#' first response if not specified, but that may not always work as you expect)
#' @param pause timeout between tries (default 5s)
# http://learnr.wordpress.com/2009/05/18/ggplot2-three-variable-time-series-panel-chart/
# http://www.talkstats.com/showthread.php/21228-time-series-in-ggplot2
# http://had.co.nz/ggplot2/
# http://stats.stackexchange.com/questions/14513/align-multiple-ggplot2-plots-with-grid
# http://wiki.stdout.org/rcookbook/Graphs/Facets%20(ggplot2)
# colors: red: "730202", lightyellow: D5D95B, lightgreen: 4F7302 midgreed=274001 darkgreen=092601
setwd('~/repositories/uni/thesis-repos/Opad4lsssExperiments/r_scripts/')
library(ggplot2)
library(gridExtra)
@IronistM
IronistM / pullJSON.js
Last active August 29, 2015 14:18 — forked from varun-raj/pullJSON.js
function pullJSON() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheets = ss.getSheets();
var sheet = ss.getActiveSheet();
var url="http://example.com/feeds?type=json"; // Paste your JSON URL here
var response = UrlFetchApp.fetch(url); // get feed
var dataAll = JSON.parse(response.getContentText()); //
require(RMySQL)
require(ggplot2)
require(scales)
myusername = "peter"
mypassword = "sekret"
system('ssh -f pe@192.168.0.10 -L 3306:localhost:3306 -N -o ExitOnForwardFailure=yes')
con <- dbConnect(MySQL(),
user=myusername, password=mypassword,
SELECT orders.customerid,
orders.transactiondate,
orders.transactionamount,
cohorts.cohortdate
FROM orders
JOIN (SELECT customerid,
Min(transactiondate) AS cohortDate
FROM orders
GROUP BY customerid) AS cohorts
ON orders.customerid = cohorts.customerid;
@IronistM
IronistM / costdata.gs
Last active September 18, 2015 13:03 — forked from chipoglesby/costdata.gs
Cost Data Upload via Google Analytic's Management API with Google Sheets
function uploadData() {
var accountId = "xxxxxxxx";
var webPropertyId = "UA-xxxxxxxx-x";
var customDataSourceId = "xxxxxxxx";
var ss = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var maxRows = ss.getLastRow();
var maxColumns = ss.getLastColumn();
var data = [];
for (var i = 1; i < maxRows;i++) {
data.push(ss.getRange([i], 1,1, maxColumns).getValues());
###############################################
##
## Attempt no 2 at building a shiny web app
## for AB Testing use - using global.R
##
## global.R - loading and defining variables for the global environment
##
###############################################
# Pallette used in some charts as a general indicator color for better or worse that the control group
var https = require('https'),
key = 'key',
url = 'http://www.igvita.com/',
strategy = 'desktop';
https.get({
host: 'www.googleapis.com',
path: '/pagespeedonline/v1/runPagespeed?url=' + encodeURIComponent(url) +
'&key='+key+'&strategy='+strategy
}, function(res) {