You may need to configure a proxy server if you're having trouble cloning
or fetching from a remote repository or getting an error
like unable to access '...' Couldn't resolve host '...'.
Consider something like:
| function JSON_to_URLEncoded(element,key,list){ | |
| var list = list || []; | |
| if(typeof(element)=='object'){ | |
| for (var idx in element) | |
| JSON_to_URLEncoded(element[idx],key?key+'['+idx+']':idx,list); | |
| } else { | |
| list.push(key+'='+encodeURIComponent(element)); | |
| } | |
| return list.join('&'); | |
| } |
| #!/bin/bash | |
| if [ $# -ne 4 ] | |
| then | |
| echo "Usage: $0 <host> <port> <pattern> <seconds>" | |
| exit 1 | |
| fi | |
| cursor=-1 | |
| keys="" |
| // ⚠ IMPORTANT: this is old and doesn't work for many different edge cases but I'll keep it as-is for any of you want it | |
| // ⚠ IMPORTANT: you can find more robust versions in the comments or use a library implementation such as lodash's `merge` | |
| // Merge a `source` object to a `target` recursively | |
| const merge = (target, source) => { | |
| // Iterate through `source` properties and if an `Object` set property to merge of `target` and `source` properties | |
| for (const key of Object.keys(source)) { | |
| if (source[key] instanceof Object) Object.assign(source[key], merge(target[key], source[key])) | |
| } |
| import boto3 | |
| import base64 | |
| if __name__ == '__main__': | |
| session = boto3.session.Session() | |
| kms = session.client('kms') | |
| encrypted_password = 'AQECAHjgTiiE7TYRGp5Irf8jQ3HzlaQaHGYgsUJDaavnHcFm0gAAAGswaQYJKoZIhvcNAQcGoFwwWgIBADBVBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDDwxVQuG0oVwpkU7nQIBEIAoVGk1/wpserb+GVUOzE7PiL/Nr9fTDFKZfpKpF0ip2ct4B2q0Wn6ZZw==' | |
| binary_data = base64.b64decode(encrypted_password) |
| import boto3 | |
| # you can assign role in the function like below | |
| # ROLE_ARN = 'arn:aws:iam::01234567890:role/my_role' | |
| # | |
| # or you can pass role as an evironment varibale | |
| # ROLE_ARN = os.environ['role_arn'] | |
| ROLE_ARN = = os.environ['role_arn'] |
| Tags: | |
| - Key: Name | |
| Value: | |
| !Join ['_', [ ec2, "Fn::ImportValue" : {"Fn::Sub":'${BaseStackName}-Environment'}, test2]] | |
| #This will create a name tag with value: ec2_<yourValueFromOtherStack>_test2 |
| //https://stackoverflow.com/a/19294004/1215930 | |
| type Data []interface{} | |
| func (p Data) HasField(name string, value interface{}) bool { | |
| for _, v := range p { | |
| if m, ok := v.(map[string]interface{}); !ok { | |
| return false | |
| } else if _, ok := m[name]; ok && reflect.DeepEqual(m[name], value) { | |
| return true |
| const stream = require('stream') | |
| const readline = require('readline') | |
| const AWS = require('aws-sdk') | |
| const S3 = new AWS.S3() | |
| // read S3 file by line | |
| function createReadline(Bucket, Key) { | |
| // s3 read stream | |
| const input = S3 |