- có thể sử dụng để tạo các biến global, local.
- nếu được định nghĩa trong 1 scope cụ thể {} khi ra ngoài khỏi scope em sẽ không thể access được biến đó.
Ví dụ 1:
| from kafka import KafkaConsumer | |
| import time | |
| import multiprocessing | |
| class Consumer(multiprocessing.Process): | |
| def __init__(self): | |
| multiprocessing.Process.__init__(self) | |
| self.stop_event = multiprocessing.Event() | |
| sudo groupadd ftpaccess | |
| sudo nano /etc/ssh/sshd_config | |
| Add these lines to the bottom: | |
| Match Group ftpaccess | |
| ChrootDirectory /data/%u | |
| ForceCommand internal-sftp |
| encryptData: async function() { | |
| const kms = new AWS.KMS(); | |
| const params = { | |
| KeyId: "arn:aws:kms:eu-west-1:846317326898:key/937948cd-8e08-49cb-9a59-5e2e62e7f70c", // your key alias or full ARN key | |
| Plaintext: "nguyen huy phuong - 987897 - 123456", // your super secret. | |
| } | |
| kms.encrypt(params).promise().then(data => { | |
| const base64EncryptedString = data.CiphertextBlob.toString('base64'); | |
| console.log('base64 encrypted string: ' + base64EncryptedString); |
| { | |
| "Records": [ | |
| { | |
| "eventID": "a14537b9b153d5e7dece6e5587d71b75", | |
| "eventName": "INSERT", | |
| "eventVersion": "1.1", | |
| "eventSource": "aws:dynamodb", | |
| "awsRegion": "ap-southeast-1", | |
| "dynamodb": { | |
| "ApproximateCreationDateTime": 1568013979.0, |
| # start working on a new issue | |
| $ git checkout develop | |
| $ git pull origin | |
| $ git checkout -b {feature}/{ticket-id}-{name} | |
| # finish working on an issue | |
| $ git status |
| function removeDuplicatedItem(inputArray) { | |
| // create a new array to store unique items | |
| var unduplicatedArray = [inputArray[0]]; | |
| // start looping from 1st item cause we already put the first item into `unduplicatedArray` | |
| for (let i = 1; i < inputArray.length; i++) { | |
| // create a flag to store the duplicate status of item | |
| var existing = false; |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset='utf-8'> | |
| <meta http-equiv='X-UA-Compatible' content='IE=edge'> | |
| <title>Page Title</title> | |
| <meta name='viewport' content='width=device-width, initial-scale=1'> | |
| </head> | |
| <body> | |
| <div> |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset='utf-8'> | |
| <meta http-equiv='X-UA-Compatible' content='IE=edge'> | |
| <title>Page Title</title> | |
| <meta name='viewport' content='width=device-width, initial-scale=1'> | |
| </head> | |
| <body> | |
| <div> |
| <!DOCTYPE html> | |
| <html> | |
| <body> | |
| <p>Please select your gender:</p> | |
| <input type="radio" name="gender" id="r1" value="male"> Male<br> | |
| <input type="radio" name="gender" id="r2" value="female"> Female<br> | |
| <input type="radio" name="gender" id="r3" value="other"> Other<br> | |
| <button onclick="selectValue()">Save</button> |