View load_all_files_in_folder.qvs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Table_1: | |
Load * | |
From C:\Users\m.parzakonis\Google Drive\MyCodeRants\QlikView repository\Applications\LivePricing\Data\*.csv | |
(txt, codepage is 1253, embedded labels, delimiter is ',', msq); |
View gist:9411376
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()); | |
} |
View redshift_noddy_example.r
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |
View qualys.R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
View gist:8c321a701ba2d288414a
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) |
View connect_to_database.gs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function connect_to_DB() { | |
// make the connection | |
var connection = Jdbc.getConnection("jdbc:mysql://[database URL or IP]:[port number]/[database name]", "[user name]", "[password]"); | |
// perform the query | |
var SQLstatement = connection.createStatement(); | |
var result = SQLstatement.executeQuery("SELECT * FROM users"); | |
// choose a range in sheet | |
var ss = SpreadsheetApp.getActiveSpreadsheet(); |
View pullJSON.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()); // |
View pagespeed.gs.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function pageSpeed(url) { | |
url = url || 'http://ctrlq.org/'; | |
var APIkey = 'XYZ'; // Get the API key from Google Dev Console | |
var strategy = 'desktop'; // 'desktop' or 'mobile' | |
var api = 'https://www.googleapis.com/pagespeedonline/v1/runPagespeed?url=' | |
+ url + '&key=' + APIkey + '&strategy=' + strategy; | |
View Popularity of analytics services
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT type, tagcount, ROUND(ratio*10000)/100 as percent FROM ( | |
SELECT | |
COUNT(DISTINCT(pageid)) tagcount, | |
RATIO_TO_REPORT(tagcount) OVER() AS ratio, | |
CASE | |
WHEN url CONTAINS "google-analytics.com" THEN "Google Analytics" | |
WHEN url CONTAINS "piwik" then "Piwik" | |
WHEN url CONTAINS "webtrends" then "WebTrends" | |
WHEN url CONTAINS "s_code" then "Omniture" | |
WHEN url CONTAINS "ntpagetag" THEN "Unica" |
View cohort_analysis.R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, |
OlderNewer