How to config a proxy for WSL2
I met some problems when I downloaded some files from GitHub on WSL2. I cannot download files when I connect to GitHub directly. So, I try to use a proxy to solve the problem. I have tried serval solutions which do not work.
Now, there is a way to solve the problem with the following content.
Preparation:
Open the function of Allow LAN in your proxy software.
Get the port(eg. Clash’s default port is 7890) of the proxy.
Solution:
Add the following code at the end of .bashrc
123456789101 ...
[fixed]-bash: command not found when using ssh connect to server
Problem
之前在项目里面写了一个 shell 脚本,用在 Github action 中部署项目到服务器上,但是最近用 Docker 部署后,重写了这个脚本,重新启用 Github action 执行时出现以下错误。
123456789-bash: line 50: docker: command not found-bash: line 51: docker: command not found-bash: line 53: docker: command not found-bash: line 54: docker: command not found-bash: line 57: awk: command not found-bash: line 57: xargs: command not found-bash: line 57: grep: command not found-bash: line 57: docker: command not found-bash: line 59: docker: command not found
Solution
找了半天 ...
Downloading CanvasKit failure error when running flutter on brower
Reason
此问题是由于国内无法直接访问 chrome-infra-packages.appspot.com, 导致安装包下载失败。更换全局代理后依旧无法正常安装启动,因此替换了 Flutter 的国内镜像源来解决此问题。
Solution
Windows
新增两个环境变量
PUB_HOSTED_URL
https://pub.flutter-io.cn
FLUTTER_STORAGE_BASE_URL
https://storage.flutter-io.cn
Linux
12export PUB_HOSTED_URL=https://pub.flutter-io.cnexport FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
配置Flutter国内镜像源
Windows
新增两个环境变量
PUB_HOSTED_URL
https://pub.flutter-io.cn
FLUTTER_STORAGE_BASE_URL
https://storage.flutter-io.cn
Linux
12export PUB_HOSTED_URL=https://pub.flutter-io.cnexport FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
参考信息
【在中国网络环境下使用 Flutter】 https://flutter.cn/community/china
Spring Cloud Gateway and Eureka
具体实现可参考代码 Spring Cloud Gateway and Eureka (Github)
本文档中简单描述了如何使用 Spring Cloud Gateway 组件自动路由到 Eureka 注册中心上
以下为本次 Demo 中主要涉及的微服务模块:
一个Gateway网关:实现前端路由的自动转发
一个Eureka注册中心:实现多服务的注册
两个接口提供模块:实现对应的接口功能,并通过Eureka Client 自动注册到 Eureka Server。
12345graph LRGateway --> EurekaServerEurekaServer --> Service1EurekaServer --> Service2
Eureka Server 模块
此模块中仅提供单一的注册中心功能,配置如下:
123456789101112spring: application: name: eurekaserverserver: port: 9092eureka: client: service-url: defaultZo ...
SM4 国密算法
SM4 算法
[TOC]
代码实现 tzzs/GM (github.com)
1. 国密 SM4 算法
SM4 分组密码算法是我国自主设计的分组对称密码算法,用于实现数据的加密/解密,以保证数据和信息的机密性。其算法公开,分组长度与密钥长度均为 128bit,加密算法与密钥扩展算法都采用32 轮非线性迭代结构,S 盒为固定的 8 比特输入 8 比特输出。
2. 分组加密
分组加密(英语:Block cipher),又称分块加密或块密码,是一种对称密钥算法。分组加密(英语:Block cipher),又称分块加密或块密码,是一种对称密钥算法。例如: AES 3DES
3. S 盒
在密码学中,一个S 盒(Substitution-box,替换盒)是对称密钥加密算法执行替换计算的基本结构。在块密码(分组加密)中,它们通常用于模糊密钥与密文之间的关系——香农的混淆理论。
通常,S-Box 接受特定数量的输入比特m,并将其转换为特定数量的输出比特n,其中n 不一定等于m。
3.1 DES S-box
011011
100101
3.2 SM4 S-box
S 盒为固定的 ...
Vue.js learning notes
Vue.js
目录
目录
命令式渲染
声明式渲染
MVVM
Vue.js
核心功能
安装/使用
NPM
Script
@vue/cli vue-cli
基础功能
指令
参数
v-bind
v-on
省略写法
属性 方法
watch
computed
methods
mounted
实例生命周期钩子
组件 components
路由 router
安装 install
npm
@vue/cli
使用
router-view
router-link
参考
命令式渲染
命令式:一步一步告诉程序如何去做,能否达成结果取决于开发者的设计。
命令式渲染通常意味着手动操作 DOM
声明式渲染
声明式:只告诉程序想要什么结果,如何达成由程序保证,开发者不用关心。
命令式渲染通常意味着手动操作 DOM
MVVM
MVVM:页面输入改变数据,数据改变影响页面数据展示与渲染
M(Model):普通的 javascript 数据对象
V(View):前端展示页面
VM(ViewModel):用于双向绑定数据与页面,就是 vue 的实例
V ...
Approach to start minikube on a single-core server
I have an Aliyun server with single-core and 2GB memory. I installed minikube on it today. But I found it couldn’t run minikube. minikube needs 2 CPUs or more and 2GB of free memory
There is a way to run minikube on a single-core server with following command.
1minikube start --force
upgrade docker engine package to docker-ce on CentOS
Older version of Docker were called docker or docker-engine. The Docker Engine package is now called docker-ce .
uninstall old versions
12345678sudo yum remove docker \ docker-client \ docker-client-latest \ docker-common \ docker-latest \ docker-latest-logrotate \ docker-logrotate \ docker-engine
set up the repository
12345sudo yum install -y yum-utilssudo yum-config-mana ...
Installing and setting up kubectl on Linux
安装kubectl
获取kubectl安装包
1curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
下载kubectl校验文件
1curl -LO "https://dl.k8s.io/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl.sha256"
验证文件
1echo "$(<kubectl.sha256) kubectl" | sha256sum --check
输出:
1kubectl: OK
验证kubectl配置
1kubectl cluster-info
kubectl配置和插件
自动补全
安装bash-completion
1yum install bash-completion
测试是否安装完成(type后有空格)
1type _init_completion
...