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
# load packages & custom functions --------------------------------------------- | |
today_date <- Sys.Date() | |
from_date <- as.Date("2015-06-01") | |
to_date <- as.Date("2020-05-31") | |
library(tidyverse) | |
library(httr) | |
library(cranlogs) | |
library(ggrepel) |
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
options(stringsAsFactors = FALSE) | |
library(rjson) | |
library(RDSTK) | |
street2coordinates <- function (address, session = getCurlHandle()) | |
{ | |
api <- paste(getOption("RDSTK_api_base"), "/street2coordinates/", | |
sep = "") | |
get.addy <- getURL(paste(api, URLencode(address), sep = ""), |
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
**Convert .ipynb to Slides** | |
cd "test" | |
ipython nbconvert "test.ipynb" --to slides --reveal-prefix "http://cdn.jsdelivr.net/reveal.js/2.6.2" --post serve --config slides_config.py | |
* To print slides add ?print-pdf at the end of the URL and print | |
**Convert .ipynb to LaTex/PDF** | |
ipython nbconvert MyFirstNotebook.ipynb --to latex --post PDF | |
**Convert .ipynb to HTML** |
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(RSelenium) | |
appURL <- "XXXXXX.com" | |
username <- "myusername" | |
password <- "mypassword" | |
RSelenium::startServer() | |
library(RSelenium) | |
RSelenium::startServer() | |
pJS <- phantom(pjs_cmd='path/to/phantomjs', |
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
curl -u userName:password -H "Accept: application/json" http://locahost:8080/pentaho/api/userroledao/users | |
curl -u userName:password -H "Accept: application/json" http://locahost:8080/pentaho/api/userroledao/roles | |
curl -X PUT -u userName:password http://locahost:8080/pentaho/api/userroledao/createUser \ | |
-H "Accept: application/json" \ | |
-H "Content-Type: application/json" \ | |
-d '{ "userName" : "Test1", "password" : "test" }' | |
curl -X PUT -u userName:password http://locahost:8080/pentaho/api/userroledao/createUser \ | |
-H "Accept: application/json" \ | |
-H "Content-Type: application/json" \ |
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
res <- sendmail(from="{my_gmail_account}", | |
to='[email protected]', | |
subject='Test', | |
msg=doc, | |
headers=list(`Content-Type` = "text/html; charset=\"utf-8\""), | |
smtp = list(host.name = "smtp.gmail.com", port = 465, | |
ssl=TRUE, user.name = "{my_gmail_account}", | |
passwd = "{my_gmail_password}")) | |
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
# BELOW IS THE FORMAT OF A CRONTAB THAT WILL: | |
# EXECUTE AN R SCRIPT COMMAND, SEND STDERR AND STDOUT TO A TEMP FILE | |
# WHILE ONLY SENDING THE CONTENTS OF THE TEMP FILE TO SCREEN, WHICH TRIGGERS AN EMAIL, | |
# IF THE EXIT CODE OF THE RSCRIPT WAS NON-ZERO | |
# ESSENTIALLY CONFIGURATION LOGS EVERYTHING WHILE EMAILING ONLY ON ERROR | |
# | |
# To install a cron from this file use: | |
# dos2unix < mycrontab.txt | crontab - | |
# NOTE: mycrontab.txt must have everything needed since it completely wipes the existing crontab | |
# |
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 a rule that will ignore dupe inserts | |
-- this is done on a table-by-table basis | |
CREATE OR REPLACE RULE db_table_ignore_duplicate_inserts AS | |
ON INSERT TO schema.table | |
WHERE EXISTS ( | |
SELECT 1 | |
FROM schema.table | |
WHERE id = NEW.id | |
) | |
DO INSTEAD NOTHING; |
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
# request the report | |
# this returns a reportID that's used for retrieving the results | |
curl https://api5.omniture.com/admin/1.4/rest/?method=Report.Queue \ | |
-H "Accept: application/json" \ | |
-H 'Authorization: WSSE profile="UsernameToken"' \ | |
-H 'X-WSSE: UsernameToken Username="my.username:My Company", PasswordDigest="{sha1 encrypted password goes here}", Nonce="1450112360.27583", Created="2015-12-14T16:59:20Z"' \ | |
-X POST \ | |
-d '{ | |
"reportDescription":{ |
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
# in existing base R the dataframe method of duplicated won't do multiple incomparables at a time | |
# this function implements that | |
myduplicatedfunc <- function(x, incomparables = FALSE, fromLast = FALSE, ...) { | |
n <- ncol(x) | |
nmx <- names(x) | |
nmincomparables <- names(incomparables) | |
lincomparables <- length(incomparables) | |
if(is.null(nmincomparables)) { |
NewerOlder