fdisk分区

sudo fdisk -l 查看
sudo fdisk /dev/sda
m -- help帮助
p -- 显示当前分区
d -- 删除分区
n -- 创建分区p,1,xx-xxx
w -- 生效并退出
q -- 不保存退出

sudo mkfs.ext4 /dev/sda1
sudo mkdir /disk
sudo vi /etc/fstab
/dev/sda1 /disk ext4 defaults 0 0

sudo mount -a 生效

参考文献:
https://www.cnblogs.com/chjbbs/p/3762223.html

NAS呵呵

1、在学生宿舍用树莓派做个NAS存储
https://post.smzdm.com/p/a5k6g843/
sudo snap install nextcloud

2、300 元不到的 nas 方案(别再推荐树莓派了 orz)
https://www.v2ex.com/t/478499

3、用树莓派制造一个像样的 NAS
http://shumeipai.nxez.com/2018/11/01/a-raspberry-pi-nas-that-really-look-like-a-nas.html

4、Raspberry Pi从零开始搭建低成本NAS(1)-开篇
http://www.shumeipai.net/thread-27540-1-2.html?_dsign=6cdea6bd
http://mkitby.com/2015/11/05/raspberry-pi-nas-starting/
挂硬盘http://mkitby.com/2015/11/05/raspberry-pi-nas-storage-device/

5、树莓派做下载机,Aria2!
http://shumeipai.nxez.com/2014/07/01/raspberry-pi-do-download-machine-aria2.html

.Net C#的web服务

添加Api.ashx文件
ProcessRequest中只留WebApi.Exec();
添加App_Code文件夹
建立WebApi类,引用Newtonsoft.Json.dll
添加Exec方法
HttpContext context = HttpContext.Current;
获取Post的信息
Stream stream = context.Request.InputStream;
StreamReader streamReader = new StreamReader(stream);
string post = streamReader.ReadToEnd();
转换为json
JObject ji = (JObject)JsonConvert.DeserializeObject(post);
获取Get的信息
string x = context.Request["x"]..ToString();
构造输出json
JObject jo = new JObject();
jo.Add("msg", "hello");
添加执行时间,开始部分
DateTime dt = DateTime.Now;
结束前
TimeSpan ts = DateTime.Now - dt;
jo.Add("cost", ts.TotalSeconds.ToString() + "s");
输出信息
string json = jo.ToString(Formatting.Indented);
context.Response.ContentType = "application/json; charset=utf-8";
context.Response.Write(json);
Api.ashx设为起始页运行之

Linux下软件环境安装(8)-MQTT Mosquitto安装与配置

装在docker里ubuntu 18.04.2
docker run -ti -h mqtt -p 8882:22 -p 8883:1883 --name mqtt withsshd
apt-get install software-properties-common
apt-add-repository ppa:mosquitto-dev/mosquitto-ppa
apt-get update
apt-get install mosquitto mosquitto-clients
service mosquitto status
service mosquitto start
这样就OK了!