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
SELECT pg_terminate_backend(pg_stat_activity.pid) | |
FROM pg_stat_activity | |
WHERE pg_stat_activity.datname = 'TARGET_DB' | |
AND pid <> pg_backend_pid(); |
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
background: url("<img>"); | |
background-size: cover; | |
background-position: center center; | |
background-repeat: no-repeat; |
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
# Connect to machine | |
eval $(docker-machine env machine-name) | |
# Clean docker images | |
docker rm $(docker images -q) | |
# Clean all docker images | |
docker rmi $(docker images -q) | |
# Clean docker containers /all |
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
SELECT pg_terminate_backend(pg_stat_activity.pid) | |
FROM pg_stat_activity | |
WHERE pg_stat_activity.datname = 'TARGET_DB' | |
AND pid <> pg_backend_pid(); |
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
sudo certbot certonly --standalone -d website.com -d www.website.com | |
sudo letsencrypt certonly --standalone --standalone-supported-challenges http-01 --http-01-port 63443 --text --expand --agree-tos -d api.dopplr2.com |
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
class AppHandler(object): | |
@classmethod | |
def create(cls, name, description): | |
return CreateAppService(name, description).call() | |
@classmethod | |
def update(cls, app_id, name, description): | |
app = AppFinder.get_from_id(app_id) | |
return UpdateAppService(app, name, description).call() |
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
@bp.route('/create/', methods=['POST'], endpoint='create') | |
def create(): | |
form = AppForm(request.form) | |
name = form.name.data | |
description = form.description.data | |
app = AppHandler.create(name, description) | |
return redirect(url_for('app.show', app_id=app.id), code=301) |
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
class CreateAppService(object): | |
def __init__(self, name, description): | |
self._name = name | |
self._description = description | |
def call(self): | |
app = App.create(name=self._name, description=self._description) | |
return app |
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
class RoleFinder(object): | |
@classmethod | |
def get_from_id(cls, role_id): | |
return Role.query.get(role_id) | |
@classmethod | |
def get_from_app(cls, app_id): | |
return Role.query.filter_by(app_id=app_id).first() |
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
class UserValue(ValueComposite): | |
def __init__(self, username, email, first_name, last_name): | |
super(UserValue, self).initialize({}) | |
self.serialize_with(username=username) | |
self.serialize_with(email=email) | |
self.serialize_with(first_name=first_name) | |
self.serialize_with(last_name=last_name) |
OlderNewer