Terraform failed to acquire state lock: 403: Access denied., forbidden
We stored Terraform state in gcs. For some reasons, we got this error randomly when running on BitBucket pipelines:
1╷ 2│ Error: Error acquiring the state lock 3│ 4│ Error message: 2 errors occurred: 5│ * writing 6│ "gs://bucket/path/to/default.tflock" 7│ failed: googleapi: Error 403: Access denied., forbidden 8│ * storage: object doesn't exist 9│ 10│ 11│ 12│ Terraform acquires a state lock to protect the state from being written 13│ by multiple users at the same time. Please resolve the issue above and try 14│ again. For most commands, you can disable locking with the "-lock=false" 15│ flag, but this is not recommended. 16╵
The King of Vietnamese language game show
My family likes to watch “The King of Vietnamese language” game show together. I want to encourage our son to love Vietnamese. At the end of the game, the player has to find 7 complex words from the letters, for e.g,
đ / ă / n / g / c / a / y
One evening a few weeks ago, while we were watching the final round, my wife suddenly came up with an idea: this game could be programmed.
How to send an HTTP request without using curl?
We are using JWT validation. For some reasons, when testing on staging, we got 401 error:
1[GIN] 2022/05/20 - 14:20:57 | 401 | 2.588128ms | 127.0.0.1 | POST "/v1/endpoint"
After looking at the source code, we need to set the operation_debug to true to see what caused that error:
12022/05/20 08:31:26 KRAKEND ERROR: [ENDPOINT: /v1/endpoint][JWTValidator] Unable to validate the token: should have a JSON content type for JWKS endpoint
Adele - Million years ago
Vừa lên xe thì nghe được đoạn guitar hay quá, vội lấy điện thoại ra ghi âm lại (sợ về nhà không Gúc ra bài gì). 25 tuổi mà bạn ấy viết lời hay thật đấy!
I only wanted to have fun
Learning to fly, learning to run
I let my heart decide the way
When I was young
Deep down, I must have always known
That this would be inevitable
Bánh Chưng rán… nước lọc.
Những năm chưa covid, về sớm. Lang thang chợ hoa để chọn một cây quất: gốc ba chạc, quả xanh, quả chín, một ít lá non trên ngọn và nhất định phải có một vài nụ hoa. Đến mùng một, mùng hai nở là vừa đẹp.
Có năm còn nhờ U đi chợ mua một ít hạt kê, về ngâm nước ấm rồi đem rải ở dưới gốc. Chúng nảy mầm, mọc cao khoảng 1, 2 cm nhìn như cỏ thật.
SICP Exercise 2.43: Eight queens: interchange the order of the nested mappings
Exercise 2.43: Louis Reasoner is having a terrible time doing exercise 2.42. His queens procedure seems to work, but it runs extremely slowly. (Louis never does manage to wait long enough for it to solve even the 6× 6 case.) When Louis asks Eva Lu Ator for help, she points out that he has interchanged the order of the nested mappings in the flatmap, writing it as
SICP Exercise 2.42: Eight queens puzzle
Exercise 2.42: The “eight-queens puzzle” asks how to place eight queens on a chessboard so that no queen is in check from any other (i.e., no two queens are in the same row, column, or diagonal).
One way to solve the puzzle is to work across the board, placing a queen in each column. Once we have placed
k - 1queens, we must place the
kth queen in a position where it does not check any of the queens already on the board.
SICP Exercise 2.41: Triple sum
Exercise 2.41: Write a procedure to find all ordered triples of distinct positive integers
kless than or equal to a given integer
nthat sum to a given integer
unique-triples can be written easily base on
unique-pairs in 2.40:
1(define (unique-triples n) 2 (flatmap 3 (lambda (i) 4 (flatmap 5 (lambda (j) 6 (map (lambda (k) (list i j k)) 7 (enumerate-interval 1 (- j 1)))) 8 (enumerate-interval 1 (- i 1)))) 9 (enumerate-interval 1 n)))
SICP Exercise 2.35: Counting leaves of a tree
Exercise 2.35: Redefine count-leaves from section 2.2.2 as an accumulation:1(define (count-leaves t) 2 (accumulate <??> <??> (map <??> <??>)))
count-leaves procedure from section 2.2.2:
1(define (count-leaves x) 2 (cond ((null? x) 0) 3 ((not (pair? x)) 1) 4 (else (+ (count-leaves (car x)) 5 (count-leaves (cdr x))))))