See how a minor change to your commit message style can make you a better programmer.
Format: <type>(<scope>): <subject>
<scope> is optional
To send a request via the sandbox, you can use pm.sendRequest.
pm.test("Status code is 200", function () {
pm.sendRequest('https://postman-echo.com/get', function (err, res) {
pm.expect(err).to.not.be.ok;
pm.expect(res).to.have.property('code', 200);
pm.expect(res).to.have.property('status', 'OK');
});
});
Concurrency is a domain I have wanted to explore for a long time because the locks and the race conditions have always intimidated me. I recall somebody suggesting concurrency patterns in golang because they said "you share the data and not the variables".
Amused by that, I searched for "concurrency in golang" and bumped into this awesome slide by Rob Pike: https://talks.golang.org/2012/waza.slide#1 which does a great job of explaining channels, concurrency patterns and a mini-architecture of load-balancer (also explains the above one-liner).
Let's dig in:
| package main | |
| import ( | |
| "context" | |
| "log" | |
| "net/http" | |
| "time" | |
| ) | |
| func main() { |
| # ============ Login K-Bank ======================== | |
| # To Use provide your username and password | |
| # chmod -R 777 login_k-bank.sh | |
| # ./login_k-bank.sh | |
| # Please provide your username and password here | |
| # This is not the best choice to use this script. because your password is saved on your machine and transfer through script | |
| # Please consider K-Bank Open API instead https://apiportal.kasikornbank.com/open-api/ | |
| username= | |
| password= |
| const fetchSheet = async (sheetId) => { | |
| try { | |
| var records = [] | |
| const response = await fetch( | |
| `https://spreadsheets.google.com/feeds/list/${sheetId}/od6/public/values?alt=json`, | |
| ); | |
| const responseJson = await response.json(); | |
| const { entry } = responseJson.feed; | |
| records = entry.map(row => ({ | |
| column1: row.gsx$column1.$t, |
| (async () => { | |
| // FarmersWorld Bot Script v1.0.6 | |
| // อัพเดทล่าสุด 13/11/2021 เวลา 03:30 น. | |
| // ตัวแปรสำหรับตั้งค่าการเติม energy และ ซ่อมอุปกรณ์ | |
| // หากอยากให้ปิดอันไหนก็ใส่ค่าเป็น 0 เช่นอยากปิดการเติม energy ก็เปลี่ยนค่าเป็น 0 | |
| // ตัวอย่าง | |
| // let autoFillEnergy = 0 | |
| let autoFillEnergy = 1 | |
| let autoRepair = 1 |