| Title | Description
This file contains hidden or 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
# pass through AWS credentials to docker container | |
# and provide OpenSSL with indication of SSL Certs location | |
# (based on https://gist.githubusercontent.com/cameck/9ce71ba3e447444bf7f799d92c46c171/raw/4f15f5a5073843a17a38c27bbe10e99747015d60/start.sh) | |
AWS_ACCESS_KEY_ID=$(aws --profile default configure get aws_access_key_id) | |
AWS_SECRET_ACCESS_KEY=$(aws --profile default configure get aws_secret_access_key) | |
docker run -it \ | |
-e AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID \ | |
-e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY \ |
This file contains hidden or 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
import com.fasterxml.jackson.databind.ObjectMapper | |
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory | |
import com.fasterxml.jackson.module.scala.DefaultScalaModule | |
object Json_Yaml_Demo { | |
case class Album(title: String) | |
def object_to_json(album: Album): String = { | |
val mapper = new ObjectMapper() | |
mapper.registerModule(DefaultScalaModule) |
This file contains hidden or 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
// ## Save DF as CSV | |
val path = "s3://foo/bar/bat" | |
df | |
.repartition(1) | |
.write | |
.format("csv") | |
.option("header", "true") | |
.save(path) | |
// ## Save DF as Parquet |
This file contains hidden or 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
# Save as client.py | |
# Message Sender | |
import os | |
from socket import * | |
host = "192.168.0.105" # set to IP address of target computer | |
port = 13000 | |
addr = (host, port) | |
UDPSock = socket(AF_INET, SOCK_DGRAM) | |
while True: | |
data = input("Enter message to send or type 'exit': ") |
-
Data School
-
Jake VanderPlas
Just testing out creating a simple D3 Block
D3 Lorum Ipsum....
- one
- two
- three
This file contains hidden or 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
import numpy as np | |
import pandas as pd | |
def contingencyTable(df, var1, var2): | |
# isolate to just our 2 variables for the crosstab | |
df = df.loc[:, [var1, var2]] | |
# build a crosstab with marginal totals | |
ct = pd.crosstab(df[var1], df[var2], margins=True) |
This file contains hidden or 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
POST /_bulk | |
{"index": {"_type": "album", "_id": "1", "_index": "rolling-stone-500"}} | |
{"title": "Sgt. Pepper's Lonely Hearts Club Band", "url": "http://www.rollingstone.com/music/lists/500-greatest-albums-of-all-time-20120531/the-beatles-sgt-peppers-lonely-hearts-club-band-20120531", "imageUrl": "http://assets.rollingstone.com/assets/images/list/8f5a817710d65dcedfe55ca22a7d79c2e7259e6c.JPG", "artist": "The Beatles", "rank": 1, "label": "Capitol", "year": 1967, "summary": "Sgt. Pepper's Lonely Hearts Club Band is the most important rock & roll album ever made, an unsurpassed adventure in concept, sound, songwriting, cover art and studio technology by the greatest rock & roll group of all time. From the title song's regal blasts of brass and fuzz guitar to the orchestral seizure and long, dying piano chord at the end of \"A Day in the Life,\" the 13 tracks on Sgt. Pepper's Lonely Hearts Club Band are the pinnacle of the Beatles' eight years as recording artists. John Lennon, Paul McCartney, George Harrison and R |
This file contains hidden or 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
string elastic_oldindexname = "so_v1"; | |
string elastic_newindexname = "so_v2"; | |
var node = new Uri("http://localhost:9200"); | |
var settings = new ConnectionSettings( | |
node, | |
defaultIndex: elastic_oldindexname | |
); |
NewerOlder