解决ubuntu1804 docker deamon.json不生效的问题

在Ubuntu1804中安装了docker-ce, 版本18.03, 由于从内网ip仓库获取镜像, 所以必须使用http, 旧的方法是在/etc/docker/deamon.json 下写入如下的json(如果不存在deamon.json需要自己创建)

{
  "insecure-registries": [
    "10.26.138.6:5000"
  ]
}

但在我的docker版本中无法生效,在经历了一轮折腾后,发现是我改配置的方式不对,新的更改方式如下图所示

在/etc/default/docker中

添加DOCKER_OPTS(两个参数可选)

DOCKER_OPTS="--registry-mirror=https://registry.docker-cn.com --insecure-registry=10.0.138.6:5000"

/lib/systemd/system/docker.service

修改

ExecStart=/usr/bin/docker daemon -H fd:// $DOCKER_OPTS

新增

EnvironmentFile=-/etc/default/docker

配置完成后,运行以下命令, 重启deamon

systemctl daemon-reload

重启docker

service docker restart

Ubuntu18.04极品办公娱乐软件!(大概!)

更换阿里源/etc/apt/sources.list

sudo cp /etc/apt/sources.list /etc/apt/sources.list_back
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
sudo apt-get install fcitx-bin
https://pinyin.sogou.com/linux/?r=pinyin

https://music.163.com/#/download


安装ftp软件filezilla

sudo apt install filezilla

安装deepin终端deepin-Terminal (自带商店安装)

安装deepin截图程序(自带商店安装)

安装下载器uGet

sudo add-apt-repository ppa:plushuang-tw/uget-stable
sudo apt update 
sudo apt install uget

安装Chrome

https://www.google.cn/chrome/

下载安装wps

https://linux.wps.com/

Ubuntu18.04上网折腾记录

最终效果: 自动判断国内国外网站, 自动分流

安装ss3.0上网:

sudo apt-get install python-pip
sudo apt install libsodium-dev
sudo pip install https://www.v2fy.com/asset/ubuntu1804/shadowsocks-master.zip

配置文件/etc/shadowsocks.json (格式是对的,但password是假的)

{
        "server": "sz-vip1.0oxq7.site",
        "server_port": 50402,
        "local_port": 1080,
        "password": "Bm0079E",
        "method": "chacha20-ietf-poly1305"
}

启动ss

sudo sslocal -c /etc/shadowsocks.json // 前台启动
sudo sslocal -c /etc/shadowsocks.json  -d start // 后台启动
sudo sslocal -c /etc/shadowsocks.json  -d stop // 后台停止

创建root管理员账户

sudo passwd root

/etc/systemd/system 新建shadowsocks.service, 权限777

touch /etc/systemd/system/shadowsocks.service
chmod  777 /etc/systemd/system/shadowsocks.service

/etc/systemd/system/shadowsocks.service下写入以下内容

[Unit]
Description=Shadowsocks Client Service
After=network.target
After=network-online.target

[Service]
#Type=simple
Type=forking
User=root
ExecStart=/usr/local/bin/sslocal -c /etc/shadowsocks.json -d start

[Install]
WantedBy=multi-user.target

将ss转为开机启动服务

systemctl enable shadowsocks.service

开启服务

systemctl start shadowsocks.service

关闭服务

systemctl start shadowsocks.service

查看服务状态

systemctl status shadowsocks.service

重启服务

systemctl restart shadowsocks.service

参考资料: https://unix.stackexchange.com/questions/303022/systemd-exec-format-error

socks转为http

sudo apt  install privoxy

编辑privoxy配置文件

# 进入目录
cd /etc/privoxy/
# 备份
cp config config_before
# 开始编辑
sudo vim /etc/privoxy/config

/etc/privoxy/config里面填入,可以将1080端口开启的sock5服务,转换到8118端口的http服务

listen-address  0.0.0.0:8118
forward-socks5 / 127.0.0.1:1080 .

设置开机启动

systemctl enable privoxy.service

启动privoxy

systemctl start privoxy.service

安装genpac (省流量)

# 安装 genpac
sudo pip install genpac
sudo  install --upgrade genpac
# 创建目录
sudo mkdir -p ~/soft/pac
# 进入目录
cd  ~/soft/pac
sudo touch user-rules.txt
chmod 777 user-rules.txt
# 生成pac文件
sudo genpac --pac-proxy "SOCKS5 127.0.0.1:1080" --output="autoproxy.pac" --gfwlist-url="https://raw.githubusercontent.com/gfwlist/gfwlist/master/gfwlist.txt" --user-rule-from="user-rules.txt"

安装nginx

sudo apt install nginx
sudo touch /etc/nginx/conf.d/shadowsocks.conf

在/etc/nginx/conf.d/shadowsocks.conf中添加以下内容

server{
    listen 80; #注意这里不用":"隔开,listen后面没有冒号
    server_name 127.0.0.1; #注意这里不用":"隔开,server_name后面没有冒号
    location /autoproxy.pac {
        alias /home/zhaoolee/soft/pac/autoproxy.pac;
    }
}

/etc/nginx/mime.types 添加pac后缀解析为text格式

text/plain                            pac;

在浏览器中查看

nginx 设置开机自启动

systemctl enable nginx

在网络中设置

http://127.0.0.1/autoproxy.pac

打开浏览器可以查看各种网站了

本篇文章评论破10,一天内出一期ubuntu18.04美化的教程

本文永久更新地址: https://www.v2fy.com/p/ubuntu1804/

用JOJO打开Node.js的Stream

Node.js的Stream被称为「流」,特别适合读写超大的文件

首先引入需要的模块 (砸瓦鲁多)

const fs = require('fs');
const path = require('path');

创建输入「流」(读取「流」)

// 第一步: 设定读取的文件位置, 即当前代码所处的文件
const rs = fs.createReadStream(__filename);

创建输出「流」(写入「流」)

// 第二步: 设定输出的文件位置
const ws = fs.createWriteStream(path.join(__dirname, 'result.js'));

读取「流」写入「流」对接到一起

// 第三步: 将读取的文件(即当前代码所处的文件, 输出到result.js)
rs.pipe(ws)

原版视频 https://www.bilibili.com/bangumi/play/ep251366
时间轴: 8:00到9:00

完整代码

const fs = require('fs');
const path = require('path');
// 第一步: 设定读取的文件位置, 即当前代码所处的文件
const rs = fs.createReadStream(__filename);
// 第二步: 设定输出的文件位置
const ws = fs.createWriteStream(path.join(__dirname, 'result.js'));
// 第三步: 将读取的文件(即当前代码所处的文件, 输出到result.js)
rs.pipe(ws)

代码执行效果(拷贝文件)

小结:

Stream在拷贝大文件的过程中,是非常好用的, 可以让我们以1M内存, 轻松高效的的拷贝500M的文件!

开源游戏-CXK, 出来打球

游戏说明

在线游戏地址:

https://cxk.ssrr.one/

本仓库Github链接:

https://github.com/kasuganosoras/cxk-ball


写在最后(我需要你的支持)