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
## Make sure your Subnet has internet access | |
variable "subnet" {} | |
variable "vpc" {} | |
provider "aws" { | |
region = "us-east-1" | |
} | |
data "aws_vpc" "sample" { | |
id = "${var.vpc}" |
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
from pyhive import hive | |
def connect_to_pyhive(): | |
""" Connects to Pyhive with HTTP mode | |
""" | |
conn = hive.connect(thrift_transport=add_http_mode_support()) | |
cursor = conn.cursor() | |
cursor.execute("show databases") | |
print cursor.fetchone() |
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
# server.R | |
library("shiny") | |
shinyServer( | |
function(input, output, session) { | |
# Debug Area | |
output$Console <- renderUI({ |
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
.DS_Store | |
Gemfile.lock | |
*.pem | |
node.json | |
tmp/* | |
!tmp/.gitignore |
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(shiny) | |
library(datasets) | |
library(ggplot2) # load ggplot | |
# Define server logic required to plot various variables against mpg | |
shinyServer(function(input, output) { | |
# Compute the forumla text in a reactive function since it is | |
# shared by the output$caption and output$mpgPlot functions | |
formulaText <- reactive(function() { |
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 for arranging ggplots. use png(); arrange(p1, p2, ncol=1); dev.off() to save. | |
require(grid) | |
vp.layout <- function(x, y) viewport(layout.pos.row=x, layout.pos.col=y) | |
arrange_ggplot2 <- function(..., nrow=NULL, ncol=NULL, as.table=FALSE) { | |
dots <- list(...) | |
n <- length(dots) | |
if(is.null(nrow) & is.null(ncol)) { nrow = floor(n/2) ; ncol = ceiling(n/nrow)} | |
if(is.null(nrow)) { nrow = ceiling(n/ncol)} | |
if(is.null(ncol)) { ncol = ceiling(n/nrow)} | |
## NOTE see n2mfrow in grDevices for possible alternative |
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
# -*- coding: utf-8 -*- | |
""" | |
example use of pandas with oracle mysql postgresql sqlite | |
lightly tested. | |
to do: | |
save/restore index (how to check table existence? just do select count(*)?), | |
finish odbc, | |
add booleans?, | |
sql_server? |