Skip to content

Instantly share code, notes, and snippets.


Lattapon Yodsuwan clozed2u

View GitHub Profile
View dio_client.dart
Dio initDioClient() {
final dio = Dio();
(dio.httpClientAdapter as DefaultHttpClientAdapter).onHttpClientCreate = (client) {
client.badCertificateCallback = (X509Certificate cert, String host, int port) => true;
return dio;
View sol.js
const input = ["ab", "aabbcc", "ababab", "abaabcca"];
const sol = (words) =>
(word) =>
(prev, cur) =>
prev.lastChar === cur
? {
View poc.go
package main
import (
type Response struct {
Data interface{} `json:"data,omitempty"`
Status string `json:"status,omitempty"`
View r.go
package main
import (
func main() {
candidates := []string{

#todayilearned #onunixandgo

  • log เป็นสิ่งจำเป็น เอาไว้ debug, track, alert พวก monitoring ทั้งหลายถ้าไม่ส่องจาก log เอาเองก็ต้องมี plugin เป็น forwarder ซึ่งก็มาเกาะจาก log อยู่ดี
  • ใน unix มี system log (syslog on mac, rsyslog on linux) ส่วนใหญ่เก็บไว้ใน /var/log แล้วแต่ config
  • System log เป็น client - server อยาก write log ก็ forward message with severity via udp/tcp/socket ไปหา facilities
  • facilities ประกอบไปด้วย kernel, user, auth, mail, etc...
  • severity ก็พวก debug, info, warning, error, etc...
  • ใน Go มี standard package log เอาไว้ write log
  • ใน Go มี standard package syslog เอาไว้ write system log
View tmux-cheatsheet.markdown

tmux shortcuts & cheatsheet

start new:


start new with session name:

tmux new -s myname
View bingap.go
package main
import (
func binaryGap(n int) int {
binStr := string(strconv.FormatInt(int64(n), 2))
longestGap := 0
View hangman.go
func hangman(secretWord string, letters []string) bool {
lettersMap := make(map[string]bool)
for _, v := range letters {
lettersMap[v] = true
for _, v := range secretWord {
_, ok := lettersMap[string(v)]
if !ok {
return false
View product.json
"name": "Children of Blood and Bone (Legacy of Orisha)",
"id": 1,
"description": "With five starred reviews, Tomi Adeyemi’s West African-inspired fantasy debut, and instant #1 New York Times Bestseller, conjures a world of magic and danger, perfect for fans of Leigh Bardugo and Sabaa Tahir.",
"price": 11.39,
"img_url": ",204,203,200_.jpg"
"name": "Girl, Wash Your Face: Stop Believing the Lies About Who You Are so You Can Become Who You Were Meant to Be",
View json_custom_time.go
package main
import (
const messageTimeLayout = "2006/01/02 15:04:05 -0700"