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 Parent(Model): | |
__tablename__ = "parent" | |
id = db.Column(db.Integer, primary_key=True) | |
name = db.Column(db.String) | |
class Child(Model): | |
__tablename__ = "child" |
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 decimal import Decimal | |
import sys | |
import time | |
import boto3 | |
from boto3.dynamodb.conditions import Key | |
session = boto3.Session(profile_name='anil') | |
client = session.resource('dynamodb') |
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
heroku run 'pg_dump -xO $DATABASE_URL' -a myapp | psql mydb |
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
[ req ] | |
default_bits = 4096 | |
prompt = no | |
encrypt_key = no | |
default_md = sha256 | |
distinguished_name = dn | |
req_extensions = req_ext | |
[ dn ] | |
CN = example.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
/opt/bitnami/php/etc/php.ini | |
; Maximum allowed size for uploaded files. | |
upload_max_filesize = 40M | |
; Must be greater than or equal to upload_max_filesize | |
post_max_size = 40M | |
sudo /opt/bitnami/ctlscript.sh restart php-fpm |
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
#!/bin/bash | |
pip install -r requirements.txt --target ./packages | |
if [ -d packages ]; then | |
cd packages | |
find . -name "*.pyc" -delete | |
find . -name "*.egg-info" | xargs rm -rf | |
zip -9mrv packages.zip . | |
mv packages.zip .. | |
cd .. | |
rm -rf packages |
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 base64 | |
from datetime import datetime | |
import urllib.request | |
import urllib.parse | |
data = urllib.parse.urlencode({'recorded': datetime.utcnow(), 'product': 'LALA', 'amount': 20000}).encode() | |
url = 'http://localhost:8000/api/' | |
request = urllib.request.Request(url) | |
credentials = ('%s:%s' % ('user', 'pass!')) | |
encoded_credentials = base64.b64encode(credentials.encode('ascii')) |
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
<!DOCTYPE html> | |
<html lang="ja"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<title>MQTT console for AWS IoT Core with MQTT over WebSocket</title> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/aws-sdk/2.404.0/aws-sdk.min.js" integrity="sha256-5j5NcghceMlKBa2qXSGw6l24mOkiXOsdi9sB21pBips=" crossorigin="anonymous"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/paho-mqtt/1.0.2/mqttws31.min.js" integrity="sha256-UplsBBNj5zR16Nyo1bVLLVd0ndtLYs0A5c4WrbK/etU=" crossorigin="anonymous"></script> | |
<script>/* from https://docs.aws.amazon.com/ja_jp/iot/latest/developerguide/protocols.html */ | |
/** |
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
<!-- | |
AWS IoT's Thing Shadow access w/ Websocket over MQTT and Cognito | |
--> | |
<script type="text/javascript" src="https://sdk.amazonaws.com/js/aws-sdk-2.3.9.min.js"></script> | |
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.13.0/moment.min.js"></script> | |
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/rollups/sha256.js"></script> | |
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/rollups/hmac-sha256.js"></script> | |
<script type="text/javascript" src="https://cdn.rawgit.com/ma2shita/2c5a4c29242dd5382b05ce941731fd41/raw/eb4bc16c02e7a72bbd0086e937050c258da09a20/sigv4utils.js"></script> | |
<script type="text/javascript" src="https://cdn.rawgit.com/ma2shita/63fb1dfd07753dc1ff67fe98132c0bc0/raw/ef50f3ec3276dd1c5dd90a3003e5105045b837e2/mqttws31.js"></script> | |
<script> |
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 PathOverrideable(object): | |
def get_template(self, request, mode='', **kwargs): | |
try: | |
return self._path_overrideable_template | |
except AttributeError: | |
if not self.url: | |
return get_template(self.template) |
NewerOlder