mac上遇到的错误sed command a expects followed by text

mac上简单的替换操作

sed -i 's/apple/mac/g' full-path-file
执行后报错,“sed: 1: command a expects \ followed by text”
由于mac系统与linux系统下sed用法的差异,下面给出两种解决方案
(差异可自己在两个系统用man命令查看帮助)
第一种解决方案

sed命令改写为

sed -i '' 's/apple/mac/g' full-path-file
第二种解决方案调整macsed的用法,使其与linux一致
mac上安装gnu-sed
brew install gnu-sed
alias sed=gsed

调整后两系统下sed的用法完全一致。

注意添加PATH=/usr/local/opt/gnu-sed/libexec/gnubin:/$PATH

白嫖 unas的 frp服务

前言:

unas的 uanywhere服务是基于frp的,而且是privilege模式的。因此,只要有了privilege_token和服务ip以及端口,那么就能白嫖各种服务啦~

流程:

  1. 最好是安装一下最新的unas包,登录一下uanywhere,更新下配置。
  2. `cat /etc/uanywhere/frpc.ini`,即可获取到最新的frpc.ini配置。(其他tcp/udp的穿透不确定能不能用,穿透http和https就好了)
  3. 修改一下,配合自己的域名,做好域名cname到www.myunas.com。
  4. 启动你自己的frpc服务。

浏览全部

ubuntu 19/20 使用wifi 连接网络 树莓派 Netplan

如果你是Linux 的老鸟了,那么你可以直接略过,Linux(Ubuntu)菜鸟可以一起看看,避免我踩过的坑。

在树莓派3B上安装Ubuntu Server 19.10,因为在Ubuntu18开始就是使用了Netplan工具来管理网络,说实话我之前一直没有用过这个工具,所以为了弄好这个我大致花了1.5个工作日才搞定固定IP地址的配置。在树莓派上的有线网卡(eth0)和无线网卡(wlan0)都配置了固定IP地址。

下面直接贴出我的配置文件内容,并加以了注释说明,重要的是看下我贴出的图片的效果,注意里面的绿色的英文,只有在正确的情况才会是这样,如果不是就表示你在某个地方错了。 浏览全部

ubuntu下docker存储位置迁移

背景

树莓派上运行docker,自带tf卡性能太差,插了个usb的ssd上去,因此需要迁移docker的存储

步骤

停止docker

service docker stop

移动docker数据文件夹

此处有两种方法
方法一: rsync命令,同步文件,原文件夹保留

cd /opt
mkdir docker
rsync -aqxP /var/lib/docker/ /opt/docker/

方法二:mv命令

cd /var/lib/
mv docker /opt/

我使用的是mv命令。 浏览全部

docker版的 开源邮局系统 全套教程 mailu

前言:

1、我这里用的是mailu的邮局系统。有兴趣的朋友可以去它的github官方网址查看:https://github.com/Mailu/Mailu

2、用到的docker-compose配套的配置文件地址:https://github.com/scjtqs/docker-mail

3、这里用到了docker-compose工具,对于群晖之类的无法安装docker-compose的环境,我这里提供了docker版的docker-compose工具:https://hub.docker.com/r/scjtqs/docker-compose

安装环境情况,我这里介绍如下几种情况的安装:

1、具有固定ip的云服务器。

2、具备公网ip的家庭宽带

3、不具备公网ip的家庭宽带 浏览全部

git pull报“unable to update local ref”解决方式

前言:当我们在开发大的项目(几千人同时使用一个git仓库)的时候,可能经常会碰到这样的问题。

那么我们就需要一个方法来解决这种问题,不要遇到问题就删掉重来。。。

步骤:

1、切换到之前clone代码目录下,执行命令

git gc --prune=now

或者

git gc

2、再执行命令

git pull

3、有问题再执行后再做pull操作

git remote prune origin

 

mailu 一个 docker化的邮局系统 docker-compose配置

首先,去 https://setup.mailu.io/ 获取你对应的docker-compose和 mailu.env

详细设置 在 https://mailu.io/1.7/compose/setup.html#tls-certificates

Step 1 – 下载配置文件

Docker Compose expects a project file, named docker-compose.yml in a project directory. First create your project directory.

mkdir /mailu

Then download the project file. A side configuration file makes it easier to read and check the configuration variables generated by the wizard.

cd /mailu
wget http://setup.mailu.io/1.7/file/xxxxxxxxxxxxxxxxxxxxxxxxxxx/docker-compose.yml
wget http://setup.mailu.io/1.7/file/xxxxxxxxxxxxxxxxxxxxxxxxxxx/mailu.env 

Step 2 – Review the configuration

We did not insert any malicious code on purpose in the configurations we distribute, but your download could have been intercepted, or our wizard website could have been compromised, so make sure you check the configuration files before going any further.

When you are done checking them, check them one last time.

Step 3 – Start the Compose project

To start your compose project, simply run the Docker Compose up command using -p mailu flag for project name.

cd /mailu
docker-compose -p mailu up -d

Before you can use Mailu, you must create the primary administrator user account. This should be [email protected]. Use the following command, changing PASSWORD to your liking:

docker-compose -p mailu exec admin flask mailu admin admin 你的根域名 PASSWORD

Login to the admin interface to change the password for a safe one, at one of the hostnames 你的域名/admin. Also, choose the “Update password” option in the left menu.

关于汉化和证书优化:

1、将docker-compose.yml中的admin的镜像替换成 scjtqs/mailu-admin:latest 可以完成后台管理的汉化。

2、将docker-compose.yml中的front服务的镜像 替换成 scjtqs/mailu-nginx:latest 即可替换成dnspod接口的dns方式验证获取和更新证书。

当然,想要使用dnspod的dns验证,需要提供dnspod的一些账号信息。并将其挂载到front的容器中去

挂载路径:”./cetbot-dns-dnspod-credentials.ini:/etc/cetbot-dns-dnspod-credentials.ini”

例如在docker-compose.yml中:

volumes:
  - "./mailu/certs:/certs"
  - "./mailu/overrides/nginx:/overrides"
  - "./cetbot-dns-dnspod-credentials.ini:/etc/cetbot-dns-dnspod-credentials.ini"

 

 

cetbot-dns-dnspod-credentials.ini中的配置信息:

certbot_dns_dnspod:dns_dnspod_email = "DNSPod 账户的 Email"
certbot_dns_dnspod:dns_dnspod_api_token = "api_id,api_token"