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
# Tag Prod version | |
git tag -a v1.0 -m "v1.0 deployed to $ENV" | |
git push origin v1.0 |
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 argparse | |
from sqlalchemy import create_engine, Column, Integer, String | |
from sqlalchemy.ext.declarative import declarative_base | |
from sqlalchemy.dialects.postgresql import TSVECTOR | |
from sqlalchemy.orm import sessionmaker | |
# Create DB Session | |
engine = create_engine('postgresql://iain:password@localhost:5432/Real-World') | |
Session = sessionmaker(bind=engine) | |
session = Session() |
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
CREATE TABLE IF NOT EXISTS sports_articles( | |
id BIGSERIAL PRIMARY KEY, | |
title VARCHAR(100), | |
article VARCHAR(2000)); | |
Insert into sports_articles (title, post) values('Francesco Totti brings down curtain on "something beautiful" at Roma', 'Francesco Totti tried to raise a smile. Striding out on to the Stadio Olimpico pitch for a farewell address at the end of his last-ever match for Roma, he shushed the home crowd and then teased that staying quiet “ought to be easy for you”.'); | |
Insert into sports_articles (title, post) values('Brendan Rodgers pays tribute to Barcelona after Celtic are thrashed', 'Brendan Rodgers said that Barcelona “beat you up with the ball” on a night on which he likened the Camp Nou pitch to an ice-rink, the game whizzing past his helpless players. Celtic fell to a 7-0 defeat but their manager insisted that there was “no embarrassment” and that he could not have asked for any more from his team.'); | |
Insert into sports_articles (title, post) values('Arsenal board expected to ru |
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
pg_restore --host=<youHost>.eu-west-1.rds.amazonaws.com --port=5432 --username=<yourAdminUser> --password --dbname=<yourDB> /data-loader/dumpfile.dmp |
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
mkdir data-load | |
vi Dockerfile # Copy Docker commands listed above into your local Dockerfile | |
docker build -t postgres-db . | |
docker run -d -v /Users/iainhunter/dev/docker/postgres/data-load:/data-loader -p 5432:5432 postgres-db | |
docker ps | |
docker exec -it <imageId> bash |
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 postgres | |
ENV POSTGRES_USER postgres | |
ENV POSTGRES_PASSWORD password |
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
@manager.command | |
def profile(length=500, profile_dir=None): | |
"""Start the application under the code profiler.""" | |
from werkzeug.contrib.profiler import ProfilerMiddleware | |
application.wsgi_app = ProfilerMiddleware(application.wsgi_app, restrictions=[length], profile_dir=profile_dir, | |
sort_by=('time', 'calls')) | |
application.run() |
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
docker run --name my-local-mongo -v mongo-data:/data/db -p 27017:27017 -d mongo |
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 tornado.ioloop | |
import tornado.web | |
class MainHandler(tornado.web.RequestHandler): | |
def get(self): | |
self.write("Hello, Python3") | |
application = tornado.web.Application([ | |
(r"/", MainHandler), | |
]) |
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
export PATH=/Library/Frameworks/Python.framework/Versions/3.3/bin:$PATH |
NewerOlder