Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View taiwotman's full-sized avatar
🎯
Focusing

Taiwo O. Adetiloye taiwotman

🎯
Focusing
View GitHub Profile
docker compose up run
$ docker build -t <image-name> .
@taiwotman
taiwotman / Dockerfile
Created October 5, 2022 19:46
Enabling Microservices on Postgres using Docker and Docker Compose.
FROM python:latest
WORKDIR app
COPY . /app
RUN python3 -m pip install -r requirements.txt
psycopg2==2.9.3
pytest== 7.1.2
version: "3.9"
services:
postgres:
image: postgres:10.5
restart: always
environment:
- POSTGRES_USER=<username>
- POSTGRES_PASSWORD=<password>
ports:
- '5433:5432'
@taiwotman
taiwotman / docker commands
Last active October 6, 2022 01:49
gist_docker-build
## Key Docker Commands
docker build --pull --no-cache --tag=<image-name> .
docker-compose up
docker-compose down
@taiwotman
taiwotman / capacity-optimization-heuristics-approach-for-the-bus-loading-problem.ipynb
Last active January 13, 2022 14:27
Capacity Optimization Heuristic for the Bus Loading Problem
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#Transformation
df = df.withColumn("latitude", col("latitude").cast(DoubleType()))\
.withColumn("longitude", col("longitude").cast(DoubleType()))
df.printSchema()
df.show(10)
#More Insight
from pyspark.sql import SparkSession
from pyspark.sql.types import DoubleType
from pyspark.sql.functions import col
jar_path = 'rds_jar_driver.jar'
spark = SparkSession \
.builder \
.appName("AWS REDSHIFT PYSPARK APP") \
.config("spark.jars", jar_path)\
.config('spark.driver.extraClassPath', jar_path) \
@taiwotman
taiwotman / rds_sql2.sql
Last active December 18, 2020 01:26
AWS REDSHIFT SQL
COPY seattle_emergence_calls from 's3://seattle-realtime-emergence-fire-call/Seattle_Real_Time_Fire_911_Calls.csv' FORMAT CSV
IGNOREHEADER 1
CREDENTIALS 'aws_iam_role=your_iam_role'
REGION 'us-east-1';