Roll your own iPython Notebook server with Amazon Web Services (EC2) using their Free Tier.
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 FBshares(url) { | |
var jsondata = UrlFetchApp.fetch("http://graph.facebook.com/"+url); | |
var object = Utilities.jsonParse(jsondata.getContentText()); | |
return object.shares; | |
} | |
function Tweets(url) { | |
var jsondata = UrlFetchApp.fetch("http://urls.api.twitter.com/1/urls/count.json?url="+url); | |
var object = Utilities.jsonParse(jsondata.getContentText()); | |
return object.count; |
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
// Create the test | |
var pixelRatio = (window.devicePixelRatio >= 1.5) ? "high" : "normal"; | |
.. | |
// Pass it along through GA | |
var _gaq = _gaq || []; | |
_gaq.push(['_setAccount', 'UA-xxxxxxxx-x']); | |
// --- IMPORTANT LINE! | |
// params: event method, custom variable slot, variable name, variable value, scope level |
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
# ipak function: install and load multiple R packages. | |
# check to see if packages are installed. Install them if they are not, then load them into the R session. | |
ipak <- function(pkg){ | |
new.pkg <- pkg[!(pkg %in% installed.packages()[, "Package"])] | |
if (length(new.pkg)) | |
install.packages(new.pkg, dependencies = TRUE) | |
sapply(pkg, require, character.only = TRUE) | |
} |
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
#!/bin/sh | |
TABLE_SCHEMA=$1 | |
TABLE_NAME=$2 | |
mytime=`date '+%y%m%d%H%M'` | |
hostname=`hostname | tr 'A-Z' 'a-z'` | |
file_prefix="trimax$TABLE_NAME$mytime$TABLE_SCHEMA" | |
bucket_name=$file_prefix | |
splitat="4000000000" | |
bulkfiles=200 |
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
# | |
# PREDICTING LONG TERM CUSTOMER VALUE WITH BTYD PACKAGE | |
# Pareto/NBD (negative binomial distribution) modeling of | |
# repeat-buying behavior in a noncontractual setting | |
# | |
# Matthew Baggott, [email protected] | |
# | |
# Accompanying slides at: | |
# http://www.slideshare.net/mattbagg/baggott-predict-customerinrpart1# | |
# |
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 Anomalies() { | |
/************************************** | |
* Find the Anomalies | |
* Created By: Russ Savage | |
* Version: 1.2 | |
* Changelog v1.2 | |
* - Fixed divide by 0 errors | |
* - Changed SIG_FIGS to DECIMAL_PLACES | |
* Changelog v1.1 | |
* - Added ability to tag ad anomalies as well |
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 main() { | |
//See http://goo.gl/KvINmD for an example spreadsheet. | |
var scriptConfigId = 'Your Spreadsheet Id Goes Here'; | |
var sheet = SpreadsheetApp.openById(scriptConfigId).getActiveSheet(); | |
var data = sheet.getRange('A:C').getValues(); | |
for(var i in data) { | |
if(i == 0) { continue; } | |
var [description, location, classname] = data[i]; | |
if(!location) { continue; } | |
Logger.log('Running "'+description+'" from location: '+location); |
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 main() { | |
Logger.log('AdWordsApp.extensions().sitelinks() list.'); | |
logSitelinks(AdWordsApp); | |
Logger.log('Campaign and AdGroup list.'); | |
var campIter = AdWordsApp.campaigns().get(); | |
while(campIter.hasNext()) { | |
var camp = campIter.next(); | |
logSitelinks(camp); | |
var agIter = camp.adGroups().get(); |
OlderNewer