您正在查看: Other-经验分享 分类下的文章

mac socks5 转http

安装privoxy

brew install privoxy

修改默认配置

sudo vi /usr/local/etc/privoxy/config

去掉注释修改

forward-socks5   /     用户:密码@代理IP:代理端口 

另外监听接口默认开启的 localhost:8118 如果有需要可以配置,没有需要就不用

启动privoxy

brew services start privoxy

参考

https://www.jianshu.com/p/7cc17860caaa
https://javasgl.github.io/transfer_socks5_to_http_proxy/

浏览器扩展

https://proxy-switchyomega.com/download/

jenkins pipeline read json

def props = readJSON file: 'dir/input.json'
assert props['attr1'] == 'One'
assert props.attr1 == 'One'

def props = readJSON text: '{ "key": "value" }'
assert props['key'] == 'value'
assert props.key == 'value'

def props = readJSON text: '[ "a", "b"]'
assert props[0] == 'a'
assert props[1] == 'b'

def props = readJSON text: '{ "key": null, "a": "b" }', returnPojo: true
assert props['key'] == null
props.each { key, value ->
    echo "Walked through key $key and value $value"
}

依赖插件
https://plugins.jenkins.io/pipeline-utility-steps/#releases
https://updates.jenkins.io/download/plugins/snakeyaml-api/1.30.2-76.vc104f7ce9870/snakeyaml-api.hpi

参考文档
https://www.jenkins.io/doc/pipeline/steps/pipeline-utility-steps/#readjson-read-json-from-files-in-the-workspace

markdown to html 在线帮助文档

https://docsify.js.org/
https://github.com/mkdocs/mkdocs/

mkdocs 环境部署

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3 get-pip.py
pip3 install mkdocs

Material for MkDocs can be installed with pip:

pip install mkdocs-material

Add the following lines to mkdocs.yml:

theme:
  name: material

https://github.com/squidfunk/mkdocs-material

参考

https://www.mkdocs.org/getting-started/
https://www.wheelodex.org/entry-points/mkdocs.themes/
https://github.com/squidfunk/mkdocs-material

获取github仓库的统计信息

https://vesoft-inc.github.io/github-statistics/
默认只能统计master的,想要统计所有分支,还得改下

Ansible 批量部署geth

测试环境

系统版本:Ubuntu 20.04

测试部署

172.23.18.100 控制端
172.23.18.11 BPnode1
172.23.18.12 BPnode2
172.23.18.13 BPnode3
172.23.18.53 BYnode1
172.23.18.71 RPC

安装控制端

172.23.18.100

sudo apt update
sudo apt install software-properties-common
sudo apt-add-repository --yes --update ppa:ansible/ansible
sudo apt install ansible -y

账户规划

为每个机器创建单独用于ansible的账户

sudo useradd ansible
sudo groupadd devops

然后将ansible用户添加到devops组:

sudo usermod -aG devops ansible
sudo mkdir /home/ansible/
sudo chown -R ansible:ansible /home/ansible/
sudo chmod -R 755 /home/ansible/

查看新添加用户

cat /etc/group

为用户设置密码:

sudo passwd ansible

赋予ansible用户使用sudo执行特权命令:

sudo vim /etc/sudoers
ansible ALL=(ALL:ALL) NOPASSWD:ALL
%devops ALL=(ALL) NOPASSWD: ALL

测试已安装

ansible --version

类似输出

ansible [core 2.12.6]
  config file = /etc/ansible/ansible.cfg
  configured module search path = ['/home/op/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  ansible collection location = /home/op/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.8.10 (default, Sep 28 2021, 16:10:42) [GCC 9.3.0]
  jinja version = 2.10.1
  libyaml = True

切换账户

sudo su - ansible

设置 SSH Key Exchange

Ansible 通过 SSH 连接 client,先在 server 节点生产一个公钥 key,然后将它拷贝到 client 节点上

ssh-keygen
ls /home/当前登录账户名/.ssh/
id_rsa  id_rsa.pub

拷贝公钥 key 至 node 节点

ssh-copy-id op@172.23.18.11
ssh-copy-id op@172.23.18.12
ssh-copy-id op@172.23.18.13
ssh-copy-id op@172.23.18.53
ssh-copy-id op@172.23.18.71

未完待续

参考

https://blog.csdn.net/weixin_40805007/article/details/115033172
https://baijiahao.baidu.com/s?id=1650879841344431164&wfr=spider&for=pc