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
@IronistM
IronistM / exportSheetAsJSON.gs.js
Created April 8, 2015 21:05
Google Sheet as JSON
// Credit Christian Boutin
function exportSheetAsJSON() {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
var numCols = rows.getNumColumns();
var values = rows.getValues();
var output = "";
output += "{\""+sheet.getName()+"\" : {\n";
@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()); //
@IronistM
IronistM / connect_to_database.gs
Created March 31, 2015 13:22
A function to connect to a database using Google Apps and viewing data in Google Sheets (source : http://www.mousewhisperer.co.uk/drivebunny/connecting-to-mysql-databases-using-apps-script/)
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();
# 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)
library(ggplot2)
library(ggmap)
library(plyr)
library(grid)
library(gridExtra)
# read in cleaned up data
dat <- read.table("quakes.dat", header=TRUE, stringsAsFactors=FALSE)
# map decimal magnitudes into an integer range
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)
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")
@IronistM
IronistM / magic_script_modified.js
Last active March 31, 2019 11:48
A mash-up of the Magic Script with Measument protocol hits to track usage of the Spreadsheet and log events. #analytics #drive
/**
* A script to automate requesting data from Google Analytics.
*
* @author nickski15@gmail.com (Nick Mihailovski)
*/
/**
* The name of the configration sheet.
* And various parameters.
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());
}
@IronistM
IronistM / load_all_files_in_folder.qvs
Created February 11, 2014 08:29
The snippet below loads all .csv files in my desired folder...#qlikview
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);