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 pyspark.sql.functions import * | |
spark = (SparkSession | |
.builder | |
.appName("PythonMnMCount") | |
.getOrCreate()) | |
lines = (spark | |
.readStream.format("socket") | |
.option("host", "localhost") |
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 org.apache.spark.sql.functions._ | |
import org.apache.spark.sql.streaming._ | |
val spark = SparkSession | |
.builder | |
.appName("MnMCount") | |
.getOrCreate() | |
val lines = spark | |
.readStream.format("socket") |
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
Fetch configuration from SSM parameter store: | |
# /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m ec2 -c ssm:configuration-parameter-store-name -s | |
Fetch config from local path: | |
/opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m onPremise -s -c /etc/cwagentconfig/metrics.json | |
For check the status, run: | |
/opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -m ec2 -a status |
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
#! /bin/sh | |
yum update -y | |
amazon-linux-extras install docker | |
service docker start | |
usermod -a -G docker ec2-user | |
chkconfig docker on | |
sudo curl -L https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose | |
sudo chmod +x /usr/local/bin/docker-compose |
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 requests | |
import random | |
import sys | |
import argparse | |
def getClicked(rate): | |
if random.random() <= rate: | |
return True | |
else: | |
return False |
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
#!/bin/sh | |
while true | |
do | |
deviceID=$(( ( RANDOM % 10 ) + 1 )) | |
heartRate=$(jot -r 1 60 140) | |
echo "$deviceID,$heartRate" | |
aws kinesis put-record --stream-name <your_stream_name> --data "$deviceID,$heartRate"$'\n' --partition-key $deviceID --region us-east-1 | |
done |
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
class Pants: | |
"""The Pants class represents an article of clothing sold in a store | |
""" | |
def __init__(self, color, waist_size, length, price): | |
"""Method for initializing a Pants object | |
Args: | |
color (str) | |
waist_size (int) |
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
[package] | |
name = "graph" | |
version = "0.1.0" | |
authors = ["me"] | |
edition = "2020" | |
[lib] | |
name = "service" | |
path = "src/lib.rs" |
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 datetime | |
import logging | |
from airflow import DAG | |
from airflow.models import Variable | |
from airflow.operators.python_operator import PythonOperator | |
from airflow.hooks.S3_hook import S3Hook | |
def list_keys(): |
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 AWS = require('aws-sdk') | |
const axios = require('axios') | |
// Name of a service, any string | |
const serviceName = process.env.SERVICE_NAME | |
// URL of a service to test | |
const url = process.env.URL | |
// CloudWatch client |
NewerOlder