#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"
################ | |
# 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` |
const myAlert = () => { | |
const x = "Foo Bar"; | |
let count = 0; | |
const alerter = () => { | |
console.log(`${x} ${++count}`); | |
}; | |
return alerter; | |
}; |
<!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"> |
// 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}, |
#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"
// 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)); |
public boolean isBalancedMessage(String msg) { | |
boolean isBalanced = true; | |
int minOpen = 0, maxOpen = 0; | |
char[] msgChars = msg.toCharArray(); | |
for (int i = 0; i < msgChars.length; i++) { | |
if(msgChars[i] == '(') { | |
maxOpen ++; |
public boolean isBalancedMessage(String msg) { | |
boolean isBalanced = true; | |
int countSmileys = 0; | |
// cleanup message string | |
char[] characters = msg.toCharArray(); | |
StringBuffer cleanedMessageBuffer = new StringBuffer(); | |
for (int i = 0; i < characters.length; i++) { | |
if(characters[i] == '(') { |
public int maxScoreForString(String str) { | |
//Init frequency of chars | |
int frequencyOfChars[] = new int[26]; | |
//Case insensitive logic | |
str = str.toLowerCase(); | |
//Populate frequencyOfChars based on characters of input string | |
for (int i = 0; i < str.length(); i++) { | |
char c = str.charAt(i); |
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 |