Skip to content

Instantly share code, notes, and snippets.

View bylatt's full-sized avatar

Lattapon Yodsuwan bylatt

  • Bangkok, Thailand
View GitHub Profile
[
{
"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": "https://images-na.ssl-images-amazon.com/images/I/61SB-c0mHGL._SX329_BO1,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",
package main
import (
"encoding/json"
"fmt"
"strings"
"time"
)
const messageTimeLayout = "2006/01/02 15:04:05 -0700"
@bylatt
bylatt / json_time.go
Last active April 16, 2018 14:44
Custom time format in json
package main
import (
"encoding/json"
"fmt"
"time"
)
type Message struct {
Text string
# Due to deprecation of homebrew-php tap, I found no way to install php extensions from homebrew.
brew install php geoip
LDFLAGS=-L/usr/local/opt/openssl/lib \
CPPFLAGS=-I/usr/local/opt/openssl/include \
PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig \
pecl install redis geoip-1.1.1 mongodb
@bylatt
bylatt / config
Last active April 21, 2017 20:11
autoload ssh key when login macOS
# Not recommend
# clear key
ssh-add -K -d ~/.ssh/<key>
# add key
ssh-add -K ~/.ssh/<key>
# add script to automaticcally add key when login
curl -o ~/Library/LaunchAgents/ssh.add.a.plist https://raw.githubusercontent.com/jirsbek/SSH-keys-in-macOS-Sierra-keychain/master/ssh.add.a.plist
# Use this config instead
Host * (asterisk for all hosts or add specific host)
@bylatt
bylatt / fix_spotlight.sh
Last active October 9, 2016 11:27
Fix spotlight not index new application
sudo mdutil -a -i off
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist
sudo mdutil -a -i on
# Or rebuild all index on disk
sudo mdutil -E -i on /
const numbers = [1, 2, 3, 4, 5, 6];
const increment = numbers => numbers.map(number => number + 1)
const fetchEven = numbers => numbers.filter(number => number % 2 === 0)
const toString = numbers => numbers.map(number => number.toString())
const concat = strings => strings.reduce((result, string) => result += string, '')
const compose = (...fns) => ((arg) => fns.reduce((result, fn) => fn(result), arg))
console.log(concat(toString(fetchEven(increment(numbers)))))
console.log(compose(increment, fetchEven, toString, concat)(numbers))
@bylatt
bylatt / gogs.sh
Created May 13, 2016 16:25 — forked from anoochit/gogs.sh
gogs.sh config gogs with nginx
APP_NAME="gogs"
MYSQL_PASSWORD="change_me"
HOSTNAME="example.com"
# setup mysql server and database
debconf-set-selections <<CONFIG
mysql-server-5.5 mysql-server/root_password password ${MYSQL_PASSWORD}
mysql-server-5.5 mysql-server/root_password_again password ${MYSQL_PASSWORD}
CONFIG
apt-get install -y --force-yes mysql-server
@bylatt
bylatt / Gogs-Docker.adoc
Created May 13, 2016 16:24 — forked from mgreau/Gogs-Docker.adoc
Gogs Docker Env (docker-compose)

Replace 192.168.99.100 by your DOCKER_HOST IP

# Configure the server
curl 'http://192.168.99.100:3000/install' \
  -H 'Origin: null' -H 'Accept-Encoding: gzip, deflate' \
  -H 'Accept-Language: fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4' \
  -H 'Upgrade-Insecure-Requests: 1' \
  -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36' \
@bylatt
bylatt / docker-compose.yml
Created May 13, 2016 16:24 — forked from tam7t/docker-compose.yml
drone-gogs compose
gogs:
image: gogs/gogs:latest
ports:
- "3000:3000"
- "10022:22"
volumes:
- ./data:/data
drone:
image: drone/drone:0.4
# build: .