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
main.py | |
src/ | |
- controller.py # This will do most of the heavy work | |
- intents/ | |
- order_pizza.py # These are kind of interface | |
- book_car.py | |
- helpers/ | |
- responseCards.py | |
- aws_api/ | |
- cognito_api.py |
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
# pizza_order.py | |
flow = { | |
"slots": { | |
"pizza_type": { | |
"prompt": "What type of pizza you like?", | |
"data": [ | |
{ | |
"label": "Non-Veg", | |
"value": "non veg" | |
}, |
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
def lambda_handler(event, context): | |
if event["request"]["type"] == "LaunchRequest": | |
return handleLaunchRequest(event) | |
if event["request"]["type"] == "IntentRequest": | |
if ('AMAZON.' in event["request"]["intent"]["name"]): | |
return handleInBuiltIntents(event) | |
else: | |
return handleCustomIntents(event) | |
elif event["request"]["type"] == "Display.ElementSelected": | |
tokenValue = event["request"]["token"] |
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
def caps(text): | |
words = text.split() | |
capswords = [] | |
for word in words: | |
if ('<b>' in word): | |
wd = word.split('<b>') | |
word = wd[0].capitalize()+'<b>'+wd[1].capitalize() | |
elif ('</b>' in word): | |
wd = word.split('</b>') | |
word = wd[0].capitalize()+'</b>'+wd[1].capitalize() |
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
engine = create_engine('postgresql://username:password@host/dbname') | |
scope = ['https://spreadsheets.google.com/feeds'] | |
creds = ServiceAccountCredentials.from_json_keyfile_name('credentials.json', scope) | |
client = gspread.authorize(creds) | |
workbook = client.open_by_url('google-sheet-url') | |
sheet = workbook.worksheet("Tab/sheet to import") | |
data = sheet.get_all_records(head=1, default_blank=None) | |
data = pd.DataFrame(data) | |
data.to_sql(name='table-name', con= engine, if_exists='replace') |
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 boto3 | |
def handler(event, context): | |
# TODO implement | |
client = boto3.client('ssm') | |
ssmKey = 'myparams' | |
ssmParam = client.get_parameters(Names=[ssmKey],WithDecryption=True) | |
print('param', ssmParam['Parameters'][0]['Value']) | |
return 'param -> ' + ssmParam['Parameters'][0]['Value'] |
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
#Install pip | |
`curl -O https://bootstrap.pypa.io/get-pip.py` | |
` python get-pip.py --user` | |
# Install cli | |
`pip install awscli --upgrade --user` | |
Read More: http://docs.aws.amazon.com/cli/latest/userguide/awscli-install-linux.html | |
# Add to path | |
Add following line to bash profile: |
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
{ | |
"variables": { | |
"aws_access_key": "{{env `AWS_ACCESS_KEY`}}", | |
"aws_secret_key": "{{env `AWS_SECRET_KEY`}}" | |
}, | |
"builders": [ | |
{ | |
"type": "amazon-ebs", | |
"ssh_pty": true, | |
"access_key": "{{user `aws_access_key`}}", |
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
<?php | |
$config = array( | |
// This is a authentication source which handles admin authentication. | |
'admin' => array( | |
'core:AdminPassword', | |
), | |
'drupal-userpass' => array( | |
'drupalauth:External', | |
// The filesystem path of the Drupal directory. | |
'drupalroot' => '/var/www/<Drupal-Root-Path>', |
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
<VirtualHost *:80> | |
ServerName mysite.com | |
DocumentRoot /var/www/html/mysite/ | |
DirectoryIndex index.php index.html | |
ProxyPass / http://localhost:3000/ | |
#ErrorLog ${APACHE_LOG_DIR}/error.log | |
ErrorLog ${APACHE_LOG_DIR}/hcah-error.log | |
CustomLog ${APACHE_LOG_DIR}/access.log combined | |
</VirtualHost> |