This file contains hidden or 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 logging | |
| logger = logging.getLogger('some_logger') | |
| def log_uncaught_exceptions(*exc_info): | |
| logger.critical('Unhandled Exception:', exc_info=exc_info) | |
| sys.excepthook = log_uncaught_exceptions |
This file contains hidden or 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
| git log branch_a ^branch_b --no-merges |
This file contains hidden or 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
| find . -name '*.py' | xargs wc -l | sort -k1 -rg | less |
This file contains hidden or 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
| awk '{ print $9, $7}' access.log | grep -C 10 '^500' |
This file contains hidden or 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
| find . -name "*.pyc" -exec rm '{}' ';' |
This file contains hidden or 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
| --- | |
| - hosts: django | |
| user: root | |
| vars: | |
| - runit_app_dir: /etc/sv | |
| - runit_enabled_dir: /etc/service | |
| - dj_manage_daemons: | |
| - slug: "unique_name_slug_1" |
This file contains hidden or 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
| env TZ=Australia/Melbourne ls -al |
This file contains hidden or 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
| \pset pager |
This file contains hidden or 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 os | |
| import django | |
| os.environ.setdefault("DJANGO_SETTINGS_MODULE", "myapp.settings") | |
| django.setup() | |
| ################################################################################ |
This file contains hidden or 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 rest_framework.renderers import JSONRenderer | |
| from rest_framework.response import Response | |
| from rest_framework.views import APIView | |
| class SimpleView(APIView): | |
| renderer_classes = (JSONRenderer,) | |
| permission_classes = (IsAuthenticated,) | |
| def get(self, request): | |
| content = {'testing': 123} |
OlderNewer