
参考文献: https://kubernetes.io/zh/docs/tasks/configure-pod-container/pull-image-private-registry/ 在集群中创建保存授权令牌的 Secret Create Secret kubectl create secret docker-registry yyy-regcred \ –docker-server=registry.cn-hangzhou.aliyuncs.com \ –docker-username=****@aliyun.com \ –docker-password=**** \ –docker-email=****@aliyun.com ## output -> secret/yyy-regcred created 获取凭证 kubectl get secret yyy-regcred –output="jsonpath={.data.\.dockerconfigjson}" | base64 –decode 输出和下面类似: {"auths":{"registry.cn-hangzhou.aliyuncs.com":{"username":"****@aliyun.com","password":"****","email":"****@aliyun.com","auth":"****"}}} Store Secret to .dockerconfigjson file…
Nested JSON Validation in Laravel / Lumen
我们可能会提交这样一个请求,一个 嵌套的 JSON 对象,那么如何对 JSON 对象的那边元素进行验证呢? ### Save Post Comments POST {{API_BASE_URL}}/module/v1/posts/2/comments Content-Type: application/json Accept: application/json Authorization: Bearer {{TOKEN}} { "data": [ { "media_ids": [1,2,3], "title": "Title A", "status": "A", "comment": "Objectively seize progressive ROI before unique bandwidth." }, {…
阿里云测试 MicroK8s 笔记
资料收集: https://stackoverflow.com/questions/63974879/microk8s-metallb-ingress-nginx-how-to-route-external-traffic https://pacroy.medium.com/single-node-kubernetes-on-home-lab-using-microk8s-metallb-and-traefik-7bb1ea38fcc2 SSL: https://stackoverflow.com/questions/67430592/how-to-setup-letsencrypt-with-kubernetes-microk8s-using-default-ingress 验证: 2021-06-24 kubectl remote control get config microk8s kubectl config view –raw > $HOME/.kube/config save the config file to local $HOME/.kube/config 设置端口转发 ## minikube is my remote server ip address ssh -fNT -L 16443:127.0.0.1:16443 microkube…
阿里云安装测试MiniKube
minikube 不适用于生产环境,只适合玩玩,研究太多没有多大意义,建议转向 MicroK8s set kubectl connect to remote minikube from local 1. before install minikube, you need install docker first. Install Docker Engine on Ubuntu 2. create a new user, because minikube can not start from root user. # create…
Github: 测试,构建和发布容器镜像到阿里云容器镜像服务
Docker on MacOS: PHP8 Xdebug3 for Visual Studio Code
https://github.com/yao3060/php8-xdebug3-vscode-docker Docker on MacOS: PHP8 Xdebug3 for Visual Studio Code
A simple API Gateway in Lumen
如何使用 Lumen 开发一个简单的 API Gateway Routes create a file called gateway.php in config folder. Register gateway to lumen routes. Edit AppServiceProvider.php in app/Providers/ folder. Controller AppServiceProvider will send all request to GatewayController. So create GatewayController.php in app/Http/Controllers to handle requests.…
Retrieve a value from a deeply nested array using “dot” notation
JavaScript PHP
PHP 冒泡算法
没什么用,写了玩玩的。 function bubble_sort(array $items): array { for ($i = 0; $i < count($items); $i++) { for ($j = $i + 1; $j < count($items); $j++) { if ($items[$i] > $items[$j]) { $temp = $items[$i]; $items[$i] = $items[$j]; $items[$j] = $temp;…
Adding UTF-8 BOM from the command line
Shell script to add UTF-8 BOM to any file
Laravel/Lumen Customizing Monolog For Channels
官方文档 https://laravel.com/docs/6.x/logging#creating-monolog-handler-channels 首先 新建一个 文件: 如官方文档所示,可以在 __invoke 方法里定制你的 logger,例如你想要 json 格式的日志的话: 更多设置: 输出的日志样本如下: { “message”: “Undefind method: \”asdasdad\””, “context”: {}, “level”: 400, “level_name”: “ERROR”, “channel”: “local”, “datetime”: “2020-05-11T17:05:07.231673+08:00”, “extra”: { “user_id”: “guest”, “roles”: “NULL”, “process_id”: 13, “url”: “/data/v1/download?action=asdasdad&token=1”, “ip”: “172.25.0.1”,…
Multiple middleware parameters in Lumen
Add route middleware in bootstrap/app.php To middleware to routes within a group, Use “,” separate roles, don’t use “|” as separater, the tutorial from here https://docs.spatie.be/laravel-permission/v3/basic-usage/middleware/ is for Laravel only Create a Role Middleware in App\Http\Middleware folder. …$roles in the…
HTTP Public Key Pinning 公钥固定介绍
文件名 内容 chain.pem 浏览器需要的所有证书但不包括服务端证书,比如根证书和中间证书 fullchain.pem 包括了cert.pem和chain.pem的内容 privkey.pem 证书的私钥 cert1.pem或cert.pem 服务端证书 添加以下行并插入适当的 pin-sha256 =“…”的值将在您的nginx上启用HPKP
递归 (JavaScript && PHP)
编程语言中,函数Func(Type a,……)直接或间接调用函数本身,则该函数称为递归函数。递归函数不能定义为内联函数。
Nginx fastcgi_cache And proxy_cache
FastCGI Cache Example FastCGI Cache VS WP Super Cache FastCGI cache is faster than WP Super Cache because the latter uses .htaccess and PHP itself to route the visitor to the cache (files). So before the visitors get to a…
PHP 质因数分解
找出比 $number 小的质素 再分别除以比 $number 小的质素找出质因子 测试一下
PHP 模拟 RSA 算法
从 1-10 中间任意取两个 质素 p 和 q 让 p*q = n funN = (p-1) * (q-1) 获取 公钥 e: – 1 < e < funN– e 和 funN 互质 获取 私钥 d:使得 (e * d) % funN = 1 任意拿一个数字…
How to output variable in Nginx for debugging
You can send Nginx variable values via headers. Handy for development. and you’ll see in your browser’s response headers:
JWT authentication for Lumen
参考:https://medium.com/tech-tajawal/jwt-authentication-for-lumen-5-6-2376fd38d454 1.Add JWT_SECRET=xxxx to yours.env file 2. Create a migration file for the users table: 3. Modify the migration file created inside the database/migrations directory 4. create the seeder to populate the database with some users. Modify database/seeds/UsersTableSeeder.php to look like: 5. Now create…
使用 Intervention Image (PHP Package)修改图片大小
Intervention Image 是一个PHP图像处理和操作库,提供了一种更简单、更富表现力的方法来创建、编辑和组合图像。该包包括 ServiceProviders 和 Facades,便于Laravel集成。 这儿只是描述使用这个包来做一些最常用的图片截取调整大小的操作。 安装 例子 关于 调整大小 fit – 裁剪和调整大小相结合 resize – 调整大小