package main
import (
"crypto/md5"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"runtime"
apt-get install apache2-utils
ab -n <num_requests> -c <concurrency> <addr>:<port><path>
##Base
sudo apt-get install vim
sudo apt-get install vim-gnome
sudo apt-get install ctags
##Install spf13-vim
https://github.com/spf13/spf13-vim
#1.下载镜像并安装
https://www.raspberrypi.org/documentation/installation/installing-images/windows.md
安装之后, 启动, 默认不会使用全部的sd卡空间, 使用fdisk和resize2fs把剩余空间也使用进来
df -h
sudo fdisk /dev/mmcblk0
p
大体上来说, 就是确保有一个可执行文件, 然后在/etc/init.d中加入对应的脚本.
举例:有文件, 是可执行文件
/home/tom/dev/helloworld
chmod +x /home/tom/dev/helloworld
到/etc/init.d文件夹中
假设~/golang/helloworld目录下有helloworld.go文件
cd ~/golang/helloworld
docker run -it --rm -v $(pwd):/go -u 1000:1000 golang:latest go build -o HelloWorld.out
- 创建一个本地文件夹
mkdir /home/tom/dev/html
, 创建一个文件,vi index.html
随便写点儿啥. docker run -d -p 80:80 -v $(pwd):/usr/local/nginx/html nginx
映射当前html目录到continer的nginx下html目录, 本地80端口映射continer80端口. 后台demon运行
浏览器访问本地80商品, 便可以看到index.html显示到浏览器上了.
docker run -it busybox sh
----启动一个continer, i表示允许发送数据,打开tty,效果就是可以使用命令行控制continer, sh表示运行continer之后直接执sh命令docker run -it --rm busybox sh
----rm表示continer停止后自动删除continer. docker每次run都会新建一个continerdocker restart continerId
-------根据continerid重启docker continerdocker run -it --rm -v /home/tom/develop:/busybox/develop busybox sh
------ -v /home/tom/develop:/busybox/develop busybox 映射本机文件夹(左边)到continer文件夹(右边), 如果两个文件夹都不存在,则会自动创建, 一个文件夹内创建的文件可以在另一个文件夹内看到. (PS:continer内创建文件,在本机内的权限会是root)docker run -it --rm -v /home/tom/develop:/busybox/develop -u 1000:1000 busybox sh
------ -u 1000:1000 (用户id:组id), 此时如果在continer内创建文件, 本机内生成文件权限则为用户id为1000和组id为1000的用户docker run -d -p 80 nginx
----- -d表示demon,continer自动后台运行, -p 80 本机随机端口映射continer80端口(可以通过docker ps查看详细端口信息).docker run -d -p 8080:80 nginx
----- 本机8080端口映射continer 80端口docker run -it --rm -e http_proxy=http://127.0.0.1:8118 busybox sh
----- -e表示传递一个环境变量, 这里设置了http的代理
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
根据文章标题, concurrency-is-not-parallelism | |
看了下视频和PPT, 也看了下例子. 写下大概理解. | |
concurrency, 是指针对某种场景, 构建一个模型,这个模型可以是串行的, 也可以是并行的,这时的主要设计目标在于设计的模型必须安全,简洁,高效;parallelism则是运行多个这个模型. | |
拿PPT中烧书的例子, 这里的concurrency是指如何处理烧书这个问题(how to deal this problem), 可以一个人搬书去烧, 也可以两个人搬书去烧. 两个人的情况, 如果两人同时工作, 这时即是concurrency, 也是parall的, 如果两个人串行工作, 则这时便是concurrency但非parallel的. | |
之后例子中又给出了更好的concurrency模型, 4个人过来 , 1负责往车里放书, 2负责推车去火堆, 3负责把书扔炉子里,4负责把空车运回来. 这时这个问题就构建出了一个比较好的concurrency模型(运行时间为4个人中最慢的那个人的时间),同时这个模型也是parall的. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |