Skip to content

Instantly share code, notes, and snippets.

Avatar

Lattapon Yodsuwan clozed2u

View GitHub Profile
View osx-php-setup.sh
# 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
@clozed2u
clozed2u / config
Last active Apr 21, 2017
autoload ssh key when login macOS
View config
# 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)
@clozed2u
clozed2u / fix_spotlight.sh
Last active Oct 9, 2016
Fix spotlight not index new application
View fix_spotlight.sh
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 /
View array.js
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))
@clozed2u
clozed2u / gogs.sh
Created May 13, 2016 — forked from anoochit/gogs.sh
gogs.sh config gogs with nginx
View gogs.sh
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
@clozed2u
clozed2u / Gogs-Docker.adoc
Created May 13, 2016 — forked from mgreau/Gogs-Docker.adoc
Gogs Docker Env (docker-compose)
View Gogs-Docker.adoc

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' \
View docker-compose.yml
gogs:
image: gogs/gogs:latest
ports:
- "3000:3000"
- "10022:22"
volumes:
- ./data:/data
drone:
image: drone/drone:0.4
# build: .
View compile-python.md
View compile-php.md

Build php 7.0 manually on macOS High Sierra

Install dependencies using homebrew

brew install autoconf automake gd icu4c libtool mcrypt openssl

Run configure script with these options

./configure \
View ltp256.vim
" File: ltp256.vim
" Maintainer: Lattapon Yodsuwan (clozed2u)
" URL: https://github.com/clozed2u
" Base: {{{
" The following are the preferred 16 colors for your terminal
" Color Normal Bright
"
" Black #4E4E4E #7C7C7C