Skip to content

Instantly share code, notes, and snippets.

View morenoh149's full-sized avatar
💭
Working from 🛰

Harry Moreno morenoh149

💭
Working from 🛰
View GitHub Profile
@morenoh149
morenoh149 / deploy-django.md
Created September 28, 2022 05:35 — forked from rmiyazaki6499/deploy-django.md
Deploying a Production ready Django app on AWS

Deploying a Production ready Django app on AWS

In this tutorial, I will be going over to how to deploy a Django app from start to finish using AWS and EC2. Recently, my partner Tu and I launched our app Hygge Homes (a vacation home rental app for searching and booking vacation homes based off Airbnb) and we wanted to share with other developers some of the lessons we learned along the way.

Following this tutorial, you will have an application that has:

  • An AWS EC2 server configured to host your application
  • SSL-certification with Certbot
  • A custom domain name
  • Continuous deployment with Github Actions/SSM Agent
@morenoh149
morenoh149 / user-data.sh
Last active September 28, 2022 19:56
aws solution architect certification user data script for ec2 instances
#!/bin/bash
yum update -y
yum install -y httpd
systemctl start httpd
systemctl enable httpd
echo "<h1>Hello World from $(hostname -f)</h1>" > /var/www/html/index.html
@morenoh149
morenoh149 / binary-tree.py
Last active September 8, 2022 17:24
quick binary tree
class Tree:
def __init__(self, data):
self.left = None
self.right = None
self.data = data
def insert(self, data):
if self.data:
if isinstance(self.data, int):
if self.left is None:
@morenoh149
morenoh149 / gmail_imap_python3.py
Last active April 4, 2025 21:59 — forked from robulouski/gmail_imap_example.py
Basic example of using Python3 and IMAP to read emails in a gmail folder/label. Remove legacy email.header api use
#!/usr/bin/env python
#
# Basic example of using Python3 and IMAP to read emails in a gmail folder/label.
# Remove legacy email.header api use.
import sys
import imaplib
import getpass
import email
import datetime
@morenoh149
morenoh149 / django-update-half.py
Last active February 27, 2020 21:32
Django update alternate model instances in shell
"""
Update alternate instances of a model in the database.
"""
from app.models import Post
ids_to_update = list(Post.objects.all().values_list('id', flat=True))[1::2]
Post.objects.filter(id__in=ids_to_update).update(some_field='some value')
$ ./k
2020.02.25 (c) shakti
/
/
\
$k a.k
Verb Adverb Noun Type System
: set ' each char " a" c \l a.k
+ plus flip / over/right i enc name ``ab n *\d [d]
@morenoh149
morenoh149 / smart-contracts.md
Last active February 1, 2020 17:59
Intro to smart contract programming in solidity Oct 2019
@morenoh149
morenoh149 / intro-blockchain-programming.md
Last active January 27, 2020 19:12
Intro to blockchain programming in js

Introduction to Blockchain Programming, Jan 2020

Explain blockchain

Chain of blocks

@morenoh149
morenoh149 / dp01.js
Created February 26, 2019 20:31
Dynamic programming example
// The following was translated from python.
// See https://codility.com/media/train/15-DynamicProgramming.pdf
const dynamicCoinChanging = (coins, target) => {
let n = coins.length;
let dp = [0];
for (let i=0; i < target; i++) {
dp.push(Number.POSITIVE_INFINITY);
}
for (let i=0; i <= n; i++) {
@morenoh149
morenoh149 / save-model-to-sagemaker.py
Created February 12, 2019 10:35
Tensorflow serve on Sagemaker
def export_h5_to_pb(path_to_h5, export_path):
# Set the learning phase to Test since the model is already trained.
K.set_learning_phase(0)
# Load the Keras model
keras_model = load_model(path_to_h5)
# Build the Protocol Buffer SavedModel at 'export_path'
builder = saved_model_builder.SavedModelBuilder(export_path)