$ bin/pyspark --packages com.databricks:spark-csv_2.11:1.2.0
# load data from csv into a data frame
>>> df1 = sqlContext.read.format('com.databricks.spark.csv').options(header='true',inferschema='true').load('/home/oxclo/datafiles/wind2014/*.csv')
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
const myAlert = () => { | |
const x = "Foo Bar"; | |
let count = 0; | |
const alerter = () => { | |
console.log(`${x} ${++count}`); | |
}; | |
return alerter; | |
}; |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> |
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
// For the data set given below, find room which is false for all suspects (objects in the newDevelopment array) | |
const newDevelopment = [ | |
{ | |
name: 'Miss Scarlet', | |
present: true, | |
rooms: [ | |
{kitchen: false}, | |
{ballroom: false}, | |
{conservatory: true}, | |
{'dining room': true}, |
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
################ | |
# Test script | |
################ | |
#!/bin/bash | |
echo "fastlyTime,awsGatewayTime" >> responsetimes.log | |
while true | |
do | |
fastlyTime=`curl -o /dev/null -s -w %{time_total} -H 'X-Api-Key: 8Glz7vn2pM47AzzKmrXDU82h3S0Iud9n7wDgp3wM' https://round-trippa.ft.com/callback` |
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
// Java 8 | |
SendFaxOptions sendFaxOptions = new SendFaxOptions(); | |
sendFaxOptions.setReplyAddress(Optional.of("reply@example.com")); | |
InterFAXClient interFAXClient = new InterFAXJerseyClient(); | |
APIResponse apiResponse = interFAXClient.sendFax( | |
faxNumber, | |
"https://rest.interfax.net/outbound/documents/90bd5477d5944c6d884c610171b75258", | |
Optional.of(sendFaxOptions)); |
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
import sys | |
import json | |
from datetime import datetime | |
from dateutil.parser import parse | |
import paho.mqtt.client as mqtt | |
from pyspark import SparkContext | |
from pyspark.streaming import StreamingContext | |
from pyspark.streaming.mqtt import MQTTUtils |
#AWS CLI Cheatsheet
aws ec2 describe-instances
aws ec2 describe-instances --filter "Name=tag:Name,Values=oxclo06"
aws ec2 describe-instances --filter "Name=tag:Name,Values=oxclo06" --query "Reservations[*].Instances[0].InstanceId"
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
if ( request from US ) { | |
route to US origin (-H Host:myapp-us.herokuapp.com) | |
if (response.status == 5xx) | |
route to EU origin | |
} else if ( request !from US ) { | |
route to EU origin (-H Host:myapp-eu.herokuapp.com) | |
if (response.status == 5xx) |
NewerOlder