Skip to content

Instantly share code, notes, and snippets.

@carlochess
carlochess / main.tf
Created December 18, 2018 15:35
aws batch terraform example
## Make sure your Subnet has internet access
variable "subnet" {}
variable "vpc" {}
provider "aws" {
region = "us-east-1"
}
data "aws_vpc" "sample" {
id = "${var.vpc}"
@utkjad
utkjad / connect_to_pyhive_http_mode.py
Created December 18, 2017 20:23
Utility function to connect to Pyhive on HTTP mode.
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()
@ptoche
ptoche / server.R
Created January 13, 2014 18:14
Demo on debug panel, may be useful for large projects, something like this should be made into a convenience function and a basic part of shiny
# server.R
library("shiny")
shinyServer(
function(input, output, session) {
# Debug Area
output$Console <- renderUI({
.DS_Store
Gemfile.lock
*.pem
node.json
tmp/*
!tmp/.gitignore
@cengel
cengel / server.R
Created November 15, 2012 00:44
Shiny intro tutorial example rewritten for ggplot2
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() {
@stephenturner
stephenturner / arrange_ggplot2.R
Created September 14, 2012 21:30
Arrange ggplot2 plots
## 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
@szs8
szs8 / pandas_dbms.py
Created September 7, 2012 17:59 — forked from catawbasam/pandas_dbms.py
Python PANDAS : load and save Dataframes to sqlite, MySQL, Oracle, Postgres
# -*- 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?