Need real-time/persistent connections?
→ WebSocket API
Need transformations, API keys, usage plans?
→ REST API
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 time | |
| import shutil | |
| from pathlib import Path | |
| from watchdog.observers import Observer | |
| from watchdog.events import FileSystemEventHandler | |
| import pandas as pd | |
| class ExtensionChangeHandler(FileSystemEventHandler): | |
| def __init__(self, watch_dir): |
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
| AWSTemplateFormatVersion: '2010-09-09' | |
| Description: Cognito Stack | |
| Parameters: | |
| AuthName: | |
| Type: String | |
| Description: Unique Auth Name for Cognito Resources | |
| Resources: | |
| # Creates a role that allows Cognito to send SNS messages | |
| SNSRole: |
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
| #!/bin/bash | |
| # Specify the desired volume size in GiB as a command-line argument. If not specified, default to 20 GiB. | |
| SIZE=${1:-20} | |
| # Get the ID of the environment host Amazon EC2 instance. | |
| INSTANCEID=$(curl http://169.254.169.254/latest/meta-data/instance-id) | |
| # Get the ID of the Amazon EBS volume associated with the instance. | |
| VOLUMEID=$(aws ec2 describe-instances \ |
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
| #!/bin/bash | |
| host=$1 | |
| user=$2 | |
| password=$3 | |
| echo '' > $0.queue | |
| databases=$(mysql -h $host -u $user -p$password -e "show databases" -sN | grep -v information_schema | grep -v mysql | grep -v sys) | |
| for database in $databases; do | |
| for table in $(mysql -h $host -u $user -p"$password" -N -B -e "show tables from \`$database\`"); do |
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
| // Run N workers in a WaitGroup until they complete | |
| package main | |
| import ( | |
| "flag" | |
| "fmt" | |
| "os" | |
| "sync" |
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
| AWSTemplateFormatVersion: "2010-09-09" | |
| Transform: AWS::Serverless-2016-10-31 | |
| Parameters: | |
| BucketName: | |
| Description: "Region-specific assets S3 bucket name (e.g. ee-assets-prod-us-east-1)" | |
| Type: String | |
| Default: "cf-templates-1xnac3rwgtxo7-us-west-2" | |
| EBSVolumeSize: | |
| Description: "Size of EBS Volume (in GB)" | |
| Type: Number |
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
| <template> | |
| <div> | |
| <b-container> | |
| <b-row align-h="center"> | |
| <div v-if="!signedIn"> | |
| <b-button variant="success" @click="signIn">Sign in with Cognito</b-button> | |
| </div> | |
| <div v-if="signedIn"> | |
| <h4>Welcome, {{ username }}!</h4> | |
| <b-button variant="danger" @click="signOut">Sign out</b-button> |
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
| const getCellValue = (tr, idx) => tr.children[idx].innerText || tr.children[idx].textContent; | |
| const comparer = (idx, asc) => (a, b) => ((v1, v2) => | |
| v1 !== '' && v2 !== '' && !isNaN(v1) && !isNaN(v2) ? v1 - v2 : v1.toString().localeCompare(v2) | |
| )(getCellValue(asc ? a : b, idx), getCellValue(asc ? b : a, idx)); | |
| // do the work... | |
| document.querySelectorAll('th').forEach(th => th.addEventListener('click', (() => { | |
| const table = th.closest('table'); | |
| Array.from(table.querySelectorAll('tr:nth-child(n+2)')) | |
| .sort(comparer(Array.from(th.parentNode.children).indexOf(th), this.asc = !this.asc)) | |
| .forEach(tr => table.appendChild(tr) ); |
NewerOlder