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
# install Java | |
apt-get install openjdk-8-jdk -y | |
# download and extract Kafka | |
mkdir ~/Downloads | |
curl "https://www.apache.org/dist/kafka/2.1.1/kafka_2.11-2.1.1.tgz" -o ~/Downloads/kafka.tgz | |
mkdir ~/kafka && cd ~/kafka | |
tar -xvzf ~/Downloads/kafka.tgz --strip 1 | |
# test installation with: |
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 First(object): | |
def __init__(self): | |
super(First, self).__init__() | |
print("first") | |
class Second(First): | |
def __init__(self): | |
super(Second, self).__init__() | |
print("second") |
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 rq import Queue as RedisQueue | |
from redis import Redis | |
from rq.job import Job | |
from urllib.request import urlopen, Request | |
from xml.etree import ElementTree | |
def get_news(): | |
headers = {'User-Agent': 'Mozilla/5.0'} | |
url = 'https://news.yahoo.com/rss/all' |
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
RUN apt-get update && \ | |
apt-get install -y openjdk-8-jdk && \ | |
apt-get install -y ant && \ | |
apt-get clean && \ | |
rm -rf /var/lib/apt/lists/ && \ | |
rm -rf /var/cache/oracle-jdk8-installer; | |
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64/ | |
RUN export JAVA_HOME |
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 |
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
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
#!/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
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
#app.py | |
import logging | |
from logging.handlers import TimedRotatingFileHandler | |
from flask import Flask | |
import new_module1 | |
import new_module2 | |
def create_app(): | |
app = Flask(__name__) |
OlderNewer