ssh-keygen -t ed25519 -f bastion -C "" -N ""
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 numpy as np | |
def l2_norm(vec): | |
return np.sqrt(np.square(vec).sum()) | |
def test_l2_norm(): | |
for _ in range(1000): | |
ref = np.random.rand(100, 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
BaseException | |
+-- SystemExit | |
+-- KeyboardInterrupt | |
+-- GeneratorExit | |
+-- Exception | |
+-- StopIteration | |
+-- StopAsyncIteration | |
+-- ArithmeticError | |
| +-- FloatingPointError | |
| +-- OverflowError |
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 | |
role_name=`curl -s http://169.254.169.254/latest/meta-data/iam/security-credentials/` | |
creds=`curl -s http://169.254.169.254/latest/meta-data/iam/security-credentials/$role_name` | |
current_region=`curl -s http://169.254.169.254/latest/dynamic/instance-identity/document | jq -c -r .region` | |
export AWS_ACCESS_KEY_ID=`printf "%s" "$creds" | jq -r .AccessKeyId` | |
export AWS_SECRET_ACCESS_KEY=`printf "%s" "$creds" | jq -r .SecretAccessKey` | |
export AWS_SESSION_TOKEN=`printf "%s" "$creds" | jq -r .Token` | |
export AWS_DEFAULT_REGION=$current_region |
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
# Put this in an S3 bucket and invoke it like this: | |
# https://us-east-1.console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/create/review?templateURL=https://s3.amazonaws.com/yourbucketname/BillingAlerts.yml&stackName=My-Billing-Alarms | |
AWSTemplateFormatVersion: 2010-09-09 | |
Description: 'Billing Alerts for AWS Account' | |
Parameters: | |
EmailAddress: | |
Type: String | |
Description: "Enter email address for billing alerts" |
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
# To create a conda environment: | |
conda create --name <environment-name> python=<version:2.7/3.5> | |
# To create a requirements.txt file: | |
conda list | |
conda list -e > requirements.txt | |
# To export environment to a file: | |
activate <environment-name> | |
conda env export > <environment-name>.yml |
NewerOlder