<apex:page showHeader=”true”>
<head>
<style>
html .brandQuaternaryBgr {
background-color: transparent !important;
}
</style>
</head>
</apex:page>
Ouput IP
1 |
curl ipecho.net/plain; echo |
Copy files from S3 to local
1 |
aws s3 cp s3://{BucketName} {Local} --recursive |
jp zipcode insert sql
1 2 3 4 5 6 7 8 9 10 11 |
# step.1 convert character set iconv -f SHIFT-JIS -t UTF-8 KEN_ALL.CSV > KEN_ALL_UTF8.CSV # step.2 remove columns not to use cut -d ',' -f 3-9 KEN_ALL_UTF8.CSV > KEN_ALL_UTF8_MIN.CSV # step.3 convert txt to insert sql awk '{if ( NR % 5000 == 1 ) result="INSERT INTO zipcode VALUES ("$0"),"; else if ( NR % 5000 == 0 ) result="("$0");"; else result="("$0"),"; print result;}' KEN_ALL_UTF8_MIN.CSV | sed '$ s/.$/;/' > KEN_ALL_UTF8_MIN.SQL # step.4 prepend truncate sql { echo "TRUNCATE TABLE zipcode;"; cat KEN_ALL_UTF8_MIN.SQL; } > KEN_ALL_UTF8_MIN_WITH_TRUNCATE.SQL |
aws cognito authorization in shell
1 2 3 4 5 6 7 |
curl -v \ -X POST \ -H "Content-Type: application/x-amz-json-1.1" \ -H "X-Amz-Target: AWSCognitoIdentityProviderService.InitiateAuth" \ -H "X-Amz-User-Agent: aws-amplify/0.1.x js" \ -d '{"AuthFlow":"USER_PASSWORD_AUTH","AuthParameters":{"USERNAME":"[YOUR_COGNITO_USERS_USERNAME]","PASSWORD":"[YOUR_COGNITO_USERS_PASSWORD]"},"ClientId":"[YOUR_COGNITO_USER_POOL_APP_CLIENT_ID]","ClientMetadata":{}}' \ https://cognito-idp.[YOUR_COGNITO_REGION].amazonaws.com | jq |
Your Cognito app clients setting must be checked following option.
Enable username-password (non-SRP) flow for app-based authentication (USER_PASSWORD_AUTH)
aws sam local debug
1 2 3 |
# step.1 # Run sam debug sam local start-api --template cloudformation.yaml --profile [your_profile or default] --debug-port 5858 |
1 2 |
# step.2 # Access api localhost:3000/debug_path (by curl cli or postman ... etc) |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# step.3 # Attach with visual studio #.vscode/launch.json { // IntelliSense を使用して利用可能な属性を学べます。 // 既存の属性の説明をホバーして表示します。 // 詳細情報は次を確認してください: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ // ****************************** // debug by using sam docker // ****************************** { "name": "Attach to SAM CLI", "type": "node", "request": "attach", "address": "localhost", "port": 5858, "localRoot": "${workspaceRoot}", "sourceMapPathOverrides": { "${workspaceRoot}/runtime": "${remoteRoot}", }, "remoteRoot": "/var/task", "protocol": "inspector", "stopOnEntry": false }, ] } |
AWS static website
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# 1.Route 53 Create Hosted Zone # 2.Certification Manager Request a certificate # 3.S3 Create Bucket Upload files [Manage public permissions] set [Grant public read access to this object(s)] in [Set permissions] step Properties Static website hosting set enable # 4.Cloudfront Create Distribution Restrict BucketAccess = YES Origin access identity = Create a new identity Grant Read Permissions on Bucket = Yes, Update Bucket Policy Viewer Protocol Policy = Redirect HTTP to HTTPS Alternate Domain Names = [mydomain.name] Custom SSL Certificate Default Root Object= index.html(your initial page) *Copy Security.Origin Access Identity “Amazon S3 Canoncial User Id” 5.S3 Permissions ACL(Access Control List) Add account Insert copied “Amazon S3 Canoncial User Id” and check List objects Read Bucket Permissions 6.Route 53 Create Recored Set Alias = Yes Select xxx.cloudfornt.net |
sequelize convert column name of joined table
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
// Convert column name of joined table. // If released new option, remove below function. // e.g Table.column => column or tableColumn const convertResultsColumnName = (results) => { if (results) { if (Array.isArray(results)) { results.forEach(result => convertColumnNameFormat(result)); } else { convertColumnNameFormat(results); } } }; const convertColumnNameFormat = (item) => { Object.keys(item).filter(key => key.includes('.')).forEach(key => { const [table, column] = key.split('.'); const newKey = item[column] === undefined ? column : (table.charAt(0).toLowerCase() + table.slice(1) + column.charAt(0).toUpperCase() + column.slice(1)); item[newKey] = item[key]; delete item[key]; }); }; sequelize.addHook('afterFind', convertResultsColumnName); |
need to setting
1 |
options.raw = true |
AWS lambda cloudformation
Deploy lambda with js file with cloudformation
CentOS6 update curl
1 2 3 4 5 6 7 8 9 10 11 12 13 |
wget https://curl.haxx.se/download/curl-7.54.0.tar.bz2 tar xf curl-7.54.0.tar.bz2 cd curl-7.54.0 ./configure --enable-libcurl-option make make install curl --version # if not version changed whereis curl type /usr/local/bin/curl cp /usr/local/bin/curl /usr/bin/curl curl --version |