Skip to content

Instantly share code, notes, and snippets.

View moomdate's full-sized avatar
🍋
~/.profile

moomdate moomdate

🍋
~/.profile
  • kanchanaburi
View GitHub Profile
(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=
# ============ Login SCB ========================
# To Use provide your username and password
# chmod -R 777 login_scb.sh
# ./login_scb.sh
# Please provide your username and password on https://www.scbeasy.com/
username=
password=
# Please Specify Your cookie file (Any blank text file is OK.)
@up1
up1 / timeout.go
Created April 16, 2019 07:22
Go Request Timeout
package main
import (
"context"
"log"
"net/http"
"time"
)
func main() {
@AnthonyNahas
AnthonyNahas / java_vs_kotlin.md
Last active February 23, 2022 16:54
Java vs Kotlin - the quick comparison

1. Types and Operators

Java

// variable
int x = 1;

// constant
final int y = 2; 
@rushilgupta
rushilgupta / GoConcurrency.md
Last active January 25, 2024 14:59
Concurrency in golang and a mini Load-balancer

INTRO

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:

Goroutines

@sdnts
sdnts / example.md
Last active January 10, 2023 20:50
Postman pm.sendRequest example

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');
    });
});
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active May 4, 2024 17:49
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@jesperorb
jesperorb / cors.md
Last active February 21, 2024 14:17
Handle CORS Client-side

Handle CORS Client-side

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