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
## You may choose to remove --recursive if is required only for the bucket or folder and not for objects within. | |
s3cmd setacl --acl-private --recursive s3://mybucket-name | |
s3cmd setacl --acl-private --recursive s3://mybucket-name/folder-name | |
s3cmd setacl --acl-private --recursive s3://mybucket-name/folder-name/object-name | |
s3cmd setacl --acl-public --recursive s3://mybucket-name | |
s3cmd setacl --acl-public --recursive s3://mybucket-name/folder-name | |
s3cmd setacl --acl-public --recursive s3://mybucket-name/folder-name/object-name |
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 schema_name, | |
relname, | |
pg_size_pretty(table_size) AS size, | |
table_size | |
FROM (SELECT pg_catalog.pg_namespace.nspname AS schema_name, | |
relname, | |
pg_relation_size(pg_catalog.pg_class.oid) AS table_size | |
FROM pg_catalog.pg_class |
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
# /etc/systemd/system/blackd.service | |
# sudo systemctl start blackd | |
# sudo systemctl enable blackd | |
# sudo systemctl status blackd | |
[Unit] | |
Description=Black Formatter Service | |
[Service] | |
# User=<user> # specify user if black[d] installed into local pythonpath |
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
# Backup | |
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql | |
# Restore | |
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE | |
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 __future__ import unicode_literals | |
from django.apps import apps | |
from django.contrib.admin.utils import NestedObjects | |
from django.core import serializers | |
from django.core.exceptions import ObjectDoesNotExist | |
from django.utils.encoding import force_unicode | |
def restore(model, pk, srl_format='json'): |
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
# -*- coding: utf-8 -*- | |
import logging | |
from threading import local | |
from django.contrib.auth.models import AnonymousUser | |
_thread_locals = local() | |
logger = logging.getLogger(__name__) |
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 requests | |
import json | |
import time | |
import math | |
from copy import copy | |
from django.conf import settings | |
from django.utils.log import AdminEmailHandler | |
from django.views.debug import ExceptionReporter | |
class SlackExceptionHandler(AdminEmailHandler): |