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
| { | |
| "title": "DosingSchedule", | |
| "type": "DynamoDB Object", | |
| "properties": { | |
| "id": { | |
| "type": "string" | |
| }, | |
| "days_of_week": { | |
| "type": "list[integer]" | |
| }, |
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
| """Republishes messages in an AWS SQS dead-letter queue (DLQ) | |
| Useful for moving messages in a DLQ back to a "normal" SQS queue | |
| (e.g. once bugs are fixed or initial error is otherwise resolved). | |
| Workflow: | |
| 1. Get a message from the configured source DLQ | |
| 2. Publish a new message to the configured destination queue, | |
| using the body of the message from #1 | |
| 3. After a successful publish, delete the message retrieved in #1 from the DLQ |
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 sqlalchemy.engine.default import DefaultDialect | |
| from sqlalchemy.sql.sqltypes import String, DateTime, NullType, Date | |
| # python2/3 compatible. | |
| PY3 = str is not bytes | |
| text = str if PY3 else unicode | |
| int_type = int if PY3 else (int, long) | |
| str_type = str if PY3 else (str, unicode) | |
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 json | |
| from azure.common.credentials import ServicePrincipalCredentials | |
| from azure.mgmt.keyvault import KeyVaultManagementClient | |
| from azure.mgmt.resource.resources import ResourceManagementClient | |
| from haikunator import Haikunator | |
| REGION = 'eastus' | |
| GROUP_NAME = 'azure-group-name' | |
| KV_NAME = 'vault-name' | |
| OBJECT_ID = '00000000-0000-0000-0000-000000000000' |
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 json | |
| from azure.common.credentials import ServicePrincipalCredentials | |
| from azure.mgmt.keyvault import KeyVaultManagementClient | |
| from azure.mgmt.resource.resources import ResourceManagementClient | |
| from haikunator import Haikunator | |
| REGION = 'eastus' | |
| GROUP_NAME = 'azure-group-name' | |
| KV_NAME = 'vault-name' | |
| OBJECT_ID = '00000000-0000-0000-0000-000000000000' |
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
| { | |
| "proxies": { | |
| "ListAll": { | |
| "desc": [ | |
| "This is the index of examples." | |
| ], | |
| "matchCondition": { | |
| "methods": [ | |
| "GET" | |
| ], |
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 django.db import models | |
| class Person(models.Model): | |
| name = models.CharField(max_length=200) | |
| groups = models.ManyToManyField('Group', through='GroupMember', related_name='people') | |
| class Meta: | |
| ordering = ['name'] | |
| def __unicode__(self): |
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
| # Add to .bashrc or init.zsh | |
| function backend(){ | |
| docker-compose exec backend bash -c "source /app/venv/bin/activate && cd /app/src/ && $*" | |
| } | |
| function frontend(){ | |
| docker-compose exec frontend bash -c "cd /app/ && $*" | |
| } | |
| function db(){ |
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
| # Remove all untagged containers | |
| docker rmi $(docker images | grep '^<none>'| awk '{print $3}') | |
| # Remove all stopped containers | |
| docker rm $(docker ps -a -q) |
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
| # https://stackoverflow.com/a/38996782 | |
| # All Databases | |
| SELECT SCHEMA_NAME 'database', default_character_set_name 'charset', DEFAULT_COLLATION_NAME 'collation' FROM information_schema.SCHEMATA; | |
| # For a single Database | |
| USE my_database; | |
| show variables like "character_set_database"; | |
| # Getting the collation for Tables: | |
| mysql> USE my_database; |