Skip to content

Instantly share code, notes, and snippets.

terraform {
required_providers {
aws = {
source = "hashicorp/aws"
}
}
}
provider "aws" {
region = "us-west-1"

User Database Problem

You have been tasked with populating a lead database with information about people scraped from a social media website. The social media website includes a bio of the user on the user's profile page that looks like this:

"Derek's age is 35 and lives in Chicago".

The data will be provided in CSV (Comma Separated Values) format with each "value" being the entire sentence separated by a comma.

Your goal is to extract the name, age, and city and insert it into a dictionary using incrementing numbers as the "primary key". The primary key is used to ensure that each value has a unique identifier since the chance that someone's first name, city, and age matching someone else's is very high. This will ensure those entries in the database are unique.

wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
sudo chmod +x Miniconda3-latest-Linux-x86_64.sh
./Miniconda3-latest-Linux-x86_64.sh
source ~/.bashrc
conda create -n py3 python=3
source activate py3
conda install -y pip jupyter xlrd pandas numpy sqlalchemy plotly seaborn
wget http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/t/texlive-upquote-svn26059.v1.3-55.el7.noarch.rpm
sudo rpm -Uvh texlive-upquote-svn26059.v1.3-55.el7.noarch.rpm
sudo yum -y install texlive texlive-*.noarch
resource "kubernetes_pod" "ghost_alpine" {
metadata {
name = "ghost-alpine"
}
spec {
host_network = "true"
container {
image = "ghost:alpine"
name = "ghost-alpine"
# Download the latest Ghost Image
resource "docker_image" "image_id" {
name = "${var.image}"
}
# Start the Container
resource "docker_container" "container_id" {
name = "${var.container_name}"
image = "${docker_image.image_id.latest}"
ports {
internal = "${var.int_port}"
variable "container_name" {
description = "Name of container"
default = "blog"
}
variable "image" {
description = "image for container"
default = "ghost:latest"
}
variable "int_port" {
description = "internal port for container"
# Download the latest Ghost Image
resource "docker_image" "image_id" {
name = "ghost:latest"
}
# Start the Container
resource "docker_container" "container_id" {
name = "blog"
image = "${docker_image.image_id.latest}"
ports {
# Download the latest Ghost image
resource "docker_image" "image_id" {
name = "ghost:latest"
}
# Start the Container
resource "docker_container" "container_id" {
name = "blog"
image = "${docker_image.image_id.latest}"
ports {
# Download the latest Ghost image
resource "docker_image" "image_id" {
name = "ghost:latest"
}