Skip to content

Instantly share code, notes, and snippets.

@youngsoul
youngsoul / Dockerfile
Last active September 2, 2021 17:11
Docker file to dockerize a Python project directory
# pull official base image
FROM python:3.9.6
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
# Set working directory
WORKDIR /code
@youngsoul
youngsoul / postgres-Makefile
Created August 22, 2021 19:57
Makefile to help with postgres docker commands
# Containers ids
postgres-id=$(shell docker ps -a -q -f "name=postgres-container")
# Stop docker containers
stop-all:
@docker-compose stop
stop-db:
-@docker stop $(postgres-id)
@youngsoul
youngsoul / postgres-docker-compose.yml
Created August 22, 2021 19:56
Example docker-compose.yml to run postgres 12.2
version: '3.3'
services:
db:
image: postgres:12.2
container_name: 'postgres-container'
labels:
application: 'postgres-db'
volumes:
- postgres_data:/var/lib/postgresql/data/
@youngsoul
youngsoul / get_tello_state.py
Created July 16, 2021 01:18
Get the entire state for the Tello drone
from djitellopy import Tello
import time
from pprint import pprint
print("Create Tello object")
tello = Tello()
print("Connect to Tello Drone")
tello.connect()
@youngsoul
youngsoul / 02_test_setup_script.py
Created June 19, 2021 14:58
Script to fly the Tello to test installation
from djitellopy import Tello
import time
tello = Tello()
tello.connect()
time.sleep(2)
response = tello.get_battery()
print(response)
@youngsoul
youngsoul / 01_test_setup_script.py
Created June 19, 2021 14:58
Script to test the install of Tello libraries
# Test that the necessary imports and libraries are available
def print_setup_instructions():
print("Make sure your python virtual environment is activated")
print("Open a Terminal window (MacOS) or Command Prompt (Windows) and run:")
print("""
pip install -r requirements.txt
pip install https://github.com/damiafuentes/DJITelloPy/archive/master.zip
""")
@youngsoul
youngsoul / airflow-2.0.1-constraints-rpi4.txt
Created February 23, 2021 14:29
Airflow 2.0.1 constraint file for RPI4. Pendulum 2.1.2 does not install.. downgrading to 2.1.1 and hoping for the best
APScheduler==3.6.3
Authlib==0.15.3
Babel==2.9.0
Flask-AppBuilder==3.1.1
Flask-Babel==1.0.0
Flask-Bcrypt==0.7.1
Flask-Caching==1.9.0
Flask-JWT-Extended==3.25.1
Flask-Login==0.4.1
Flask-OAuthlib==0.9.5
@youngsoul
youngsoul / sign_language_deepstack_video.py
Created February 9, 2021 15:54
Script to read webcam and run capture image through DeepStack model
# USAGE
import argparse
import imutils
from imutils.video import VideoStream
import time
import cv2
import requests
"""
Script to run inference while following along with the blog:
https://gilberttanner.com/blog/tensorflow-object-detection-with-tensorflow-2-creating-a-custom-model
and YouTube
https://www.youtube.com/watch?v=cvyDYdI2nEI
"""
@youngsoul
youngsoul / run_reinforcement1.sh
Created October 18, 2020 16:14
Script to run Grid Reinforcement learning
python reinforcement_learning/GridEnvironmentQLearner.py --name simple --episodes 50000 --show-every 10000 --show-first-n 3 --show-last-n 15