// variable
int x = 1;
// constant
final int y = 2; | (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 |
| 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, |
| # ============ 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= |
| package main | |
| import ( | |
| "context" | |
| "log" | |
| "net/http" | |
| "time" | |
| ) | |
| func main() { |
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:
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');
});
});
Cross-origin resource sharing (CORS) is a mechanism that allows restricted resources (e.g. fonts) on a web page to be requested from another domain outside the domain from which the first resource was served. This is set on the server-side and there is nothing you can do from the client-side to change that setting, that is up to the server/API. There are some ways to get around it tho.
Sources : MDN - HTTP Access Control | Wiki - CORS
CORS is set server-side by supplying each request with additional headers which allow requests to be requested outside of the own domain, for example to your localhost. This is primarily set by the header:
Access-Control-Allow-Origin| #!/usr/bin/env bash | |
| #inside docker container | |
| HOST_IP=$(/sbin/ip route|awk '/default/ { print $3 }') | |
| CONTAINER_IP=$(curl "$HOST_IP:8000" 2>/dev/null) | |
| echo "container ip is $CONTAINER_IP" |