Skip to content

Instantly share code, notes, and snippets.

View Btibert3's full-sized avatar

Brock Tibert Btibert3

View GitHub Profile
@Btibert3
Btibert3 / plumber-swagger-example.json
Created November 22, 2017 19:08
Example Swagger Output from R
{
"swagger": "2.0",
"info": {
"description": "API Description",
"title": "API Title",
"version": "1.0.0"
},
"host": "localhost:8000",
"schemes": [
"http"
@Btibert3
Btibert3 / test-report.csv
Last active July 5, 2017 18:36
Test file to encode a CSV for attachment via Sendgrid's API, which requires base64 encoding
first pvs
A 1
B 2
C 3
D 4
E 5
@Btibert3
Btibert3 / upload_rest.py
Created June 26, 2017 15:09 — forked from wadewegner/upload_rest.py
Upload attachment to Salesforce using Python
import requests
import base64
import json
from simple_salesforce import Salesforce
userName = ''
password = ''
securityToken = ''
instance = ''
@Btibert3
Btibert3 / writeTDE.r
Created June 15, 2017 20:30 — forked from devmacrile/writeTDE.r
Write R data.frame to a Tableau data extract file (.tde)
# Write R data.frame to a Tableau data extract file (.tde) by building and executing
# a python script which utilizes the Tableau data extract API (a hack, yes).
#
# This, naturally, has a hard dependency on the TDE API, so is only available for
# Windows and Linux systems (unfortunately)
#
# Devin Riley
# October, 2014
@Btibert3
Btibert3 / RetroPie-setup.md
Last active January 7, 2017 17:28
RetroPIe : its on dropbox, huge. NES, SMS, Sega Master System,
## read the file in using read_delim from readr package
chegg2 = read_delim("data/Bentley University-export10-17-2016_16628777.txt", delim="\t")
## hopefully there are patterns where the bad characters exist
## for example
chegg2$first_name = str_replace_all(chegg2$first_name, "'", "")
## what it comes down to are the options on the various functions
## the readr package is pretty handy, and gets the data in without issues
## from there, you can clean the data, but like I said, hopefully there are some standard columns where the bad data exist
@Btibert3
Btibert3 / parse-data.r
Created April 24, 2016 21:12
Parse js files. Had to split into two.
options(stringsAsFactors = F)
library(jsonlite)
library(stringr)
library(data.table)
##################### high schools
dfRaw = readLines("hs.json")
options(stringsAsFactors = F)
library(jsonlite)
setwd("~/Downloads/")
x = readLines("school-codes.txt")
library(stringr)
## fix the keys to add quotes around them
tmp = str_sub(x, 1, 121)
y = str_replace_all(tmp, 'id:', '\\"id\\":')
y = str_replace_all(y, 'Cb:', '\\"Cb\\":')
y = str_replace_all(y, 'N:', '\\"N\\":')
@Btibert3
Btibert3 / shortest-path.adoc
Last active February 19, 2016 19:45
Shortest Path Question

Shortest Path Question

Problem Statement

In my use-case, I am modeling a marketing campaign by which I want to find the shortest path to a click. Simply, the first outreach that generated a click through.

@Btibert3
Btibert3 / summary-stats.adoc
Last active February 6, 2016 17:31
Cypher query help: Summary stats for email marketing

Email Marketing Analytics App

Problem Statement

I want to summarize the email engagement for a particular contact in my database. The summary stats that I am looking for are: