OSX 10.11重置Launchpad icon

defaults write com.apple.dock ResetLaunchPad -bool true; killall Dock
2018/7/16 10:44 上午 posted in  Mac

安装oh-my-zsh

sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

自动提示命令

git clone git://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions

# 开启插件
nano ~/.zshrc
# 修改添加zsh-autosuggestions
plugins=(
  zsh-autosuggestions
  git
)

语法高亮

brew install zsh-syntax-highlighting

echo "source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ~/.zshrc

source ~/.zshrc
2018/7/15 13:42 下午 posted in  Mac

MAC下BREW安装NGINX+PHP+MYSQL环境

安装BREW 先安装XCODE

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
xcode-select --install

安装NGINX (因官方库更新不支持插件 使用https://github.com/denji/homebrew-nginx)

brew tap denji/nginx
brew install nginx-full --with-geoip2-module --with-headers-more-module --with-lua-module --with-redis2-module --with-subs-filter-module

NGINX 移动配置信息保存到目录(~/Documents/nginx) 更改80端口及运行权限

# 转移配置文件
mv /usr/local/etc/nginx/ ~/Documents/WebSite/nginx/
ln -s ~/Documents/WebSite/nginx /usr/local/etc/nginx

# 创建目录
mkdir -p ~/Documents/WebSite/nginx/vhosts/
mkdir -p ~/Documents/WebSite/default/wwwroot/
mkdir -p ~/Documents/WebSite/default/logs/
mkdir -p ~/Documents/WebSite/logs/

# 创建配置文件
tee ~/Documents/WebSite/nginx/nginx.conf  <<-'EOF'
user  nobody;
worker_processes  1;

pid        /Users/用户名/Documents/WebSite/nginx.pid;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    server {
        listen       80;
        server_name  localhost;

        access_log  /Users/用户名/Documents/WebSite/default/logs/access.log  main;
        error_log  /Users/用户名/Documents/WebSite/default/logs/error.log;

        location / {
            root   /Users/用户名/Documents/WebSite/default/wwwroot/;
            index  index.html index.htm;
        }
    }

    include vhosts/*;
}
EOF

# 更改80端口权限
sudo chown root:wheel /usr/local/opt/nginx-full/bin/nginx
sudo chmod u+s /usr/local/opt/nginx-full/bin/nginx

NGINX开机启动

ln -sfv /usr/local/opt/nginx-full/*.plist ~/Library/LaunchAgents
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.nginx-full.plist

安装MYSQL

brew install mysql@5.7

# 添加环境到/etc/profile
export PATH="$(brew --prefix mysql@5.7)/bin:$PATH"
srouce /etc/profile

修改配置

# 创建目录
mkdir -p ~/Documents/MySql/
mkdir -p ~/Documents/MySql/data/

# 创建配置文件
tee ~/Documents/MySql/my.cnf  <<-'EOF'
[client]
socket = /Users/用户名/Documents/MySql/mysqld.sock
port = 3306
[mysqld]
socket = /Users/用户名/Documents/MySql/mysqld.sock
port = 3306
datadir = /Users/用户名/Documents/MySql/data
skip-external-locking
bind-address = 0.0.0.0
log_error = /Users/用户名/Documents/MySql/mysql-error.log
slow_query_log = on
slow-query-log-file = /Users/用户名/Documents/MySql/mysql-slow.log
EOF

ln -s ~/Documents/MySql/my.cnf /usr/local/etc/my.cnf

初使化MYSQL

mysqld --initialize

MySQL开机启动

ln -sfv /usr/local/opt/mysql@5.7/*.plist ~/Library/LaunchAgents

# 更改数据目录为/Users/用户名/Documents/MySql/data
nano ~/Library/LaunchAgents/homebrew.mxcl.mysql@5.7.plist
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql@5.7.plist

安装完成之后更改密码

# 查看密码
grep "generated for root@localhost" ~/Documents/MySql/mysql-error.log
# 用密码登陆
mysql -u root -p
# 修改密码
SET PASSWORD = PASSWORD('密码');
ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER;
flush privileges;
quit

更新CURL

brew install curl
brew link curl --force

安装PHP

brew update
brew install php@5.6
# 添加PHP到环境(/etc/profile)
export PATH="$(brew --prefix php56)/bin:$PATH"
export PATH="$(brew --prefix php56)/sbin:$PATH"
source /etc/profile
mv /usr/local/etc/php/ ~/Documents/WebSite/php/
ln -s ~/Documents/WebSite/php /usr/local/etc/php

nano ~/Documents/WebSite/php/5.6/php-fpm.conf

#修改内容去掉注释
pid = /Users/用户名/Documents/WebSite/php/php-fpm.pid

PHP-FPM开机启动

ln -sfv /usr/local/opt/php@5.6/*.plist ~/Library/LaunchAgents
# 更改数据目录为/Users/用户名/Documents/WebSite/php/5.6/
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.php@5.6.plist
2018/7/15 10:14 上午 posted in  Mac Php Nginx

MAC下GO 安装环境配置

下载并安装GO安装包

打开http://golang.org 下载对应的二进制安装包

配置工作环境

mkdir -p ~/Documents/go

#把以下内容加入/etc/profile 中

export GOROOT=/usr/local/go
export GOPATH=/Users/用户名/Documents/go
export GOBIN=$GOPATH/bin
export PATH="$PATH:$GOROOT/bin:$GOPATH/bin"

#保存内容并执行以下更新环境信息

srouce /etc/profile

安装常用工具

官方

go get -u golang.org/x/tools/cmd/...
go get -u golang.org/x/tools/cmd/godoc
go get -u github.com/golang/dep/cmd/dep

mkdir -p $GOPATH/src/golang.org/x
cd $GOPATH/src/golang.org/x
git clone https://github.com/golang/tools.git
git clone https://github.com/golang/sys.git
git clone https://github.com/golang/crypto.git
git clone https://github.com/golang/net.git
git clone https://github.com/golang/text.git

第三方

go get -u github.com/Masterminds/glide
go install github.com/Masterminds/glide
go get -u github.com/BurntSushi/toml
go get -u gopkg.in/yaml.v2
go get -u github.com/valyala/fasthttp
go get -u github.com/valyala/tcplisten
go get -u github.com/buaazp/fasthttprouter
go get -u github.com/ccpaging/nxlog4go
go get -u github.com/go-xorm/xorm
go get -u github.com/go-sql-driver/mysql
go get -u github.com/golang-plus/uuid
go get -u github.com/json-iterator/go
go get -u github.com/olivere/elastic
go get -u github.com/oschwald/geoip2-golang
go get -u github.com/pkg/errors
go get -u github.com/robfig/cron
go get -u github.com/seefan/gossdb
go get -u github.com/go-redis/redis
go get -u github.com/tinylib/msgp
go get -u github.com/PuerkitoBio/goquery
go get -u github.com/robertkrimen/otto
go get -u github.com/henrylee2cn/surfer
go get github.com/yanyiwu/gojieba
go get -u github.com/huichen/sego
go get -u github.com/gorilla/mux
2018/7/15 9:15 上午 posted in  Go

VsCode 环境配置

GO

先安装GO插件 Ctrl+P输入ext install Go 然后安装所需插件

go get -u -v github.com/nsf/gocode
go get -u -v github.com/rogpeppe/godef
go get -u -v github.com/golang/lint/golint
go get -u -v github.com/lukehoban/go-outline
go get -u -v sourcegraph.com/sqs/goreturns
go get -u -v golang.org/x/tools/cmd/gorename
go get -u -v github.com/tpng/gopkgs
go get -u -v github.com/newhook/go-symbols
go get -u -v golang.org/x/tools/cmd/guru
go get -v -u github.com/peterh/liner
go get -v -u github.com/derekparker/delve/cmd/dlv
2018/6/28 14:47 下午 posted in  Mac Go