Archives for mozillazg's Blog

如何在本地 checkout GitHub 上外部贡献者提交的 PR 所在 fork 仓库的分支代码

Fix the problem of no listening logs when deploying a web UI service created using gradio in a Kubernetes environment

Amazon EKS Pod Identity 新特性探索

使用 libbpfgo 重写 BCC libbpf-tools 中各个工具的用户态程序

alibabacloud-oidc-auth: GitHub Action for authenticating to Alibaba Cloud with GitHub Actions OIDC tokens

在 ebpf/libbpf 程序中使用尾调用(tail calls)

解决 ebpf 验证器提示类型错误问题的一种方法

ebpf 程序中常用的 load_byte/load_half/load_word 功能介绍

docker-credential-acr-helper: 一个辅助 docker 获取阿里云 ACR 镜像仓库访问凭证的项目

ebpf/libbpf 程序使用 btf raw tracepoint 的常见问题

ebpf/libbpf 程序使用 raw tracepoint 的常见问题

libbpfgo 使用示例:在内核态和用户态使用 ebpf map

ebpf/libbpf 程序使用 tracepoint 的常见问题

根据进程信息获取对应进程所属的容器/Pod 信息(一)

libbpfgo 使用示例:在 ebpf 程序中获取进程信息

libbpfgo 使用示例:编写使用 perfbuf map 的 ebpf 程序

libbpfgo 使用示例:编写使用 ringbuf map 的 ebpf 程序

libbpfgo 使用示例:搭建开发环境以及编写第一个 ebpf 程序

通过编写自定义内置函数的方式扩展 OPA/Rego 运行时

Github Action 的 context 功能容易被攻击者利用实施脚本注入攻击

容器特权模式与非特权模式的区别

通过向 DNS 服务发送 SRV 查询请求获取 kubernetes 集群内所有 Service 信息

从编译后的二进制可执行文件中解析 Go 项目的依赖包信息

IP 地址解析库的不同实现导致应用存在安全隐患

通过给开源项目提交 PR 然后触发 CI 流程的方式获取敏感信息

binaryless 容器基础镜像

echo-k8s-webhook: 记录 k8s Admission Webhook 的请求内容

Pod 从创建到 Running 背后发生了什么

在 Kubernetes RBAC Role/ClusterRole 规则中使用通配符 *

shellless 容器、binaryless 容器以及 distroless 容器

gobpf 使用示例:如何找到一个系统调用对应的可用于 kprobe SEC 的内核函数

gobpf 使用示例:从 pt_regs 中获取内核函数的参数的值

gobpf 使用示例:使用 perf event 保存数据

gobpf 使用示例:开发环境及 Hello World

《浅析软件供应链攻击之包抢注低成本钓鱼》阅读笔记

软件供应链安全之软件依赖替代攻击

在不生成 crd client 代码的情况下通过 client-go 增删改查 k8s crd 资源

kubernetes 用户扮演 API

太多的 service 信息环境变量可能会导致容器中执行 bash 命令特别的慢

当有多个可用的 Pod Security Policy 时 k8s 的 PSP 选择策略

一个在容器外用 tcpdump 命令对容器内的网络请求抓包的方法

nsenter 常用操作

使用 Alpine 作为基础镜像时可能会遇到的常见问题的解决方法

Python: multiprocessing.Queue 在特定场景下会出现内部锁异常

一份大但不全的配置中心知识备忘

《Release It! Second Edition》阅读笔记(二)

《Release It! Second Edition》阅读笔记(一)

一个因为网卡 txqueuelen 参数值太小导致丢包的 case

Go: 谨慎使用 math/rand 包中的默认随机数函数

net.ipv4.ip_local_port_range 的值究竟影响了啥

Go: traceback 中包含的信息

负载均衡策略之有限负载一致性哈希

rate limiting 之 leaky bucket

Go: 关于锁(mutex)的一些使用注意事项

strace 常用操作

安全友好的客户端行为

负载均衡策略之一致性哈希

网络负载均衡器中的动态权重功能

负载均衡策略之两次随机选择策略

负载均衡策略之最少连接

负载均衡策略之轮询策略

负载均衡策略之随机选择

网络负载均衡器的类别和功能介绍

健康检查功能相关的一些备忘

rate limiting 之 token bucket

调用远程服务的一些备忘录

Bash Shell 常用语法和操作

Python: 调试运行中进程的几种方法(总结)

通过临时文件实现安全的/原子性的更新文件

Python: Mock 常用功能

jq 常用操作

tcpdump 常用操作

Python: 通过预置后门(调试接口)的方式调试运行中的进程

Python: 获取并发程序的 traceback 信息(threading/gevent/asyncio)

Python: 使用 faulthandler 模块获取运行中进程的 traceback 信息

Python: linux 环境下如何修改 PIPE buffer size

一种解决 HAProxy 节点网络异常(sendmsg: Invalid argument, Connection timed out )的办法

Rust: Cargo 使用本地的 crate(本地包代码)

asyncio 学习笔记:使用抽象类 Protocol 实现异步 I/O

asyncio 学习笔记:同步原语

asyncio 学习笔记:控制组合式 Coroutines

asyncio 学习笔记:产生异步结果

asyncio 学习笔记:并发执行 Task

asyncio 学习笔记:调用定时函数

asyncio 学习笔记:基本用法

Python: 如何在一个模块中执行另一个模块的 if __name__ == '__main__' 部分的代码

Python: 僵尸进程的产生和清除方法

Python: time.sleep 与 signal 一起使用可能会出现 sleep 被提前终止的情况

使用 gdb 调试运行中的 Python 进程

go-httpheader:将 struct 转换为 http.Header

tinyq: 一个任务队列框架

ZooKeeper FastLeader 选举

Python: 实现 Ruby 风格的字符串插值功能

Python: super 没那么简单

Python: 多继承模式下 MRO(Method Resolution Order) 的计算方式

Python: threading + multiprocessing + logging = 死锁 ?

Python 设计模式: 桥接模式(bridge pattern)

Python 设计模式: 单例模式(singleton pattern)

Python 设计模式: 原型模式(prototype pattern)

Python 设计模式: 适配器模式(adapter pattern)

Python 设计模式: 装饰器模式(decorator pattern)

Python 设计模式: 建造者模式(builder pattern)

Python 设计模式: 工厂模式(factory pattern)

Python: 捕获异常然后再抛出另一个异常的正确姿势

MongoDB: 解决 Overflow sort stage buffered data 错误

让我们一起来构建一个模板引擎(四)

在 python 中使用 exec 函数时需要注意的一些安全问题

如何在 centos 7 上编译 boost

一种解决 ImportError: ./xyz.so: undefined symbol: gzopen64 的办法

Python 探针实现原理

让我们一起来构建一个模板引擎(三)

让我们一起来构建一个模板引擎(二)

让我们一起来构建一个模板引擎(一)

[go]如何让命令行程序支持管道和重定向输入

Python: 如何让命令行程序支持管道和重定向输入

Python: exec 函数的 globals 和 locals 参数的用法

Python: 使用 keyword 模块检查变量名是否是 python 关键字

pinyin-data: 汉字拼音数据库

bustard: 一个 web 框架

multipart form data 的数据格式

psycopg2 插入数据时如何获取新纪录的主键值

解决 git push 时出现 error: pack-objects died of signal 13 的问题

python 中 += 运算符在可变对象和不可变对象上的不同效果

使用 sqlalchemy 时如何配置使用 postgresql 的 uuid 类型

如何在 centos 7 上安装 postgresql 9.5

如何获取 docker 容器(container)的 ip 地址

git clone 时使用了 --depth 后,如何再重新拉取全部的历史

基于 Python 3 新增的函数注解(Function Annotations )语法实现参数类型检查功能

Django: 解决 OperationalError: (1093, "You can't specify target table 'xxx' for update in FROM clause")

postgresql 全文检索功能搜索中文提示 “text-search query contains only stop words or doesn't contain lexemes, ignored”的解决办法

使用 weinre 远程调试微信页面

使用 mitmproxy 搭建代理服务器的方式来调试微信开发

Django: 使用 Q 对象构建复杂的查询语句

怎么给 django class view 增加权限判断

git 查看某个 commit 的改动

解决 gitlab 配置不正确导致 ci 中 git clone 时出现 “You appear to have cloned an empty repository” 的问题

解决在 Django 中使用 rq 或 celery 任务队列有时会出现 DoesNotExist 的问题

《Web 全栈工程师的自我修养》读书笔记

修复 gitlab 中 fork 失败,提示 "visibility level private visibility has been restricted"

《High Performance Django》阅读笔记(三)

《High Performance Django》阅读笔记(二)

《High Performance Django》阅读笔记(一)

配置 django-rq 在 admin 后台显示队列管理页面

配置 Summernote 上传并插入本地图片

如何在 django admin site 中设置某个 model 只读

《图解 HTTP》阅读笔记

改用 443 端口连接 Github 修复 git push 时出现 Connection timed out 的问题

使用 git-remote-hg 镜像一个 Hg 仓库

如何撤销第一次提交的 git commit

解决安装 VMware workstation 时提示“The MSI '' failed”

在 CentOS 6 上编译安装 git 2.x

让我们一起来构建一个 Web 服务器(三)

django @admin.register 非线程安全陷阱

配置应用在 django admin 中显示的名称和顺序

JSON Web Token (JWT) 简介

在 python 中使用 str.strip 方法时需要注意的地方

微信开发过程中遇到的问题

让我们一起来构建一个 Web 服务器(二)

让我们一起来构建一个 Web 服务器(一)

使用 wireshark 查看 tcpdump 的抓包结果

解决通过 ifttt 把 Feed 中的图片转发到 twritter 时,总是出现 "image not found" 的问题

[python]修复 python-gearman 出现 Received non-binary arguments 错误

[postgreqsql] 处理 date_trunc 函数的时区问题

comic.mozillazg.com 上线

[go] 如何为 HTTP Server 增加 HTTP Basic Auth

[django]通过自定义 aggregate 的方式让 Count 支持 SQL 函数

[windows]修复 ShrewSoft VPN 客户端连接时出现 negotiation timout occurred 错误

[python]如何在生产环境下更新 tornado 项目代码

[译] Peewee 快速上手

[django]修复使用 QueryDict 时出现 “UnicodeEncodeError” 错误的问题

修复安装 psycopg2 时出现“pg_config executable not found”错误

[linx]解决编译 hping 时出现 "undefined reference to `hping_script'" 错误

[django]解决 django 模板中无法正常输入 {{ 或 {%

[go]regexp 包所支持的正则表达式语法

[go]使用 goxc 方便的进行交叉编译

[linux]查看通过 yum 安装的包的文件安装位置

[windows]如何同时查看多个 excel 文件

[flask]出错时发送异常信息邮件(包含异常堆栈,request 信息,发生异常时的局部变量)

[python] 解决 SQLAlchemy 提示 Instance is not bound to a Session 错误的问题

[python] redis-py 模块使用时需要注意的一些事情

[linux] centos 下安装 snmpwalk 命令

[linux]退出码 127 含义

[go] 使用 gvm 管理 go 版本

[python]通过 alembic 更改外键相关的属性

[python]通过 alembic 重命名表列名(Model字段名)

[linux]常用的 CentOS 5/6/7 yum 源

[go]比较两个 slice/struct/map 是否相等

[linux]修复执行 make 命令时,提示:warning: Clock skew detected,导致无法执行 make 命令的问题

[python]如何复制一个 class

修复 nosetest 命令报 ImportError 错误,但是实际上并不存在 ImportError 并且所有的测试程序都是通过的

解决 SQLAlchemy 中使用 sqlite 时 BigInteger 不支持 AUTOINCREMENT 的问题

[flask]调整 Flask-RESTful 中 reqparse.RequestParser 对 None 值的处理

《An Introduction to Programming in Go》学习笔记——安装 Go

《An Introduction to Programming in Go》学习笔记——介绍

修复无法启动 Oracle SQL Developer,提示:could not install some modules

[windows] 解决无法切换窗口

[go]等待 goroutine 结束

[mongodb]复制文档(document)

Flask-SQLAlchemy 执行 exclude 查询

[windows] 修复无法启用网络连接共享,提示 “0x80004005” 错误

修复启动 sqldeveloper 时出现“Unable to create an instance of the Java Virtual Machine Located at path”错误

[python]使用 tox 测试代码在不同环境下的兼容性

[linux] 修复 Redmine 无法发送通知邮件,提示 550 5.7.1 Unable to relay 的问题

[python] 定义抽象基类(Abstract Base Classes)

[database] postgresql 常用操作

[python] 模块间互相导入的问题

[python] 函数陷阱

[linux]配置 vsftp 启用被动模式(passive mode)解决客户端"no route to host"错误

[linux]修复 gcc 编译时的出现的 "CPU you selected does not support x86-64 instruction set" 错误

[英语]other、others 以及 another 三者的区别

[linux] CentOS 下安装 percona-toolkit

[django]通过自定义 Model Field 的方式将上传的文本文件按 UTF-8 编码保存

[python]如何生成一个 Unicode 编码的文件

[git]如何删除在远程已被删除的本地分支(清理本地分支)

[python]如何创建一个不可变的类

[python]解决将 python 程序输出结果重定向到文件时,出现 UnicodeDecodeError 错误

[python]使用 multiprocessing.dummy 执行多线程任务

[python]输出一个简单的进度条

[python]配置 fabric 穿越跳板机

[python]去掉 unicode 字符串前面的 u

[JavaScript] 使用 flotr2 绘制包含子项的饼图

[python]指定 Socket connect 方法的超时时间

[python]指定 Socket recv 方法的超时时间

[python] 修复读取 utf-8 BOM 编码的配置文件时出现的 ConfigParser.MissingSectionHeaderError: File contains no section headers 错误

socket 错误码含义列表

[linux]无法启动 rabbitmq-server,出现 timeout 错误

[django]修复 "TypeError: delete() got an unexpected keyword argument 'using'"

[django]修复 "dictionary update sequence element 0 has length 1, 2 is required"

[python]for 循环中的局部变量陷阱

[django]按天分组统计数据

[django]按小时分组统计数据

[django]按月分组统计数据

[linux]bash 下 ; && || 的区别

[python]Windows 下的 ANSI 编码

[英语]data or datas

[MySQL]修复 DatabaseError: (1061, "Duplicate key name 'bar_xxx_uniq'") 错误

[英语]IHMO 是什么意思?

[django]同时使用 render_to_response 和 set_cookie

[django]更改 request.GET 字典的键值时出现 "AttributeError: This QueryDict instance is immutable" 错误

给终端文字加点颜色和特效

[git]按日期列出所有分支信息

[git]显示单个文件变更日志

[python]统计列表中重复项的出现次数

[python]返回一个空的生成器

[linux]创建指定大小的文件

[linux]修复 GPG key retrieval failed: [Errno 14] Could not open/read file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag

[django]修复 MemcachedKeyCharacterError

[python]设置 gunicorn 绑定多个地址

[python] 发送邮件时设置邮件的优先级/重要性

Cygwin 中的软件包管理工具: apt-cyg

[python]解决编译安装 lxml 时提示:libxml/xmlversion.h:No such file or directory

mysql 基于 master-master 的双机热备配置

[python]第三方模块 python-dateutil:扩展并增强 datetime 模块的功能

[python]解决使用 argparse 时出现:ValueError: unsupported format character 'p' (0x70) at index 8

[python]解决 64 位 windows 下使用 pip 安装带 c 扩展的模块时,出现 "ValueError: [u'path']" 错误

[django]使用 South 重命名 model 字段名

[django]使用 South 重命名 model 名称

[django]解决发送密码重置邮件的发件人是 "webmaster@localhost" 的问题

[django]让 BigIntegerField 字段自增长

[javascript]列出对象所有属性

[linux]screen 常用命令

[linux]编译 aria2c 时,出现 C compiler cannot create executables 错误

[django]__unicode__: Bad Unicode data 问题

[python][linux]CentOS 下安装 Pillow

[django]让后台新增用户的表单包含 email 字段

[django]list_display 中包含外键内的字段

[django]自定义字段在后台显示的名称

[django]自定义 model 在后台显示的名称

[django]如何在 search_fields 中包含外键字段

[django]合并多个查询结果集(queryset)并按字段排序

[python]在 zope2 中获取当前时间及格式化输出

[python]zope2 文件下载及导出为 csv 文件

[python]解决 zope2 后台编辑器中文编码问题

[python]修复 ZMySQLDA-2.0.8 出现的“ImportError: No module named ImageFile”错误

[firefox]禁用在线查看 PDF 文件的功能

pelican 使用笔记

[python]排序(Sorting Mini-HOW TO)

更改 phpMyAdmin 默认访问端口(apache2)

[django]添加额外的 form 错误信息

[django]修复 bad character range 异常

[django]在模板中对变量作减法操作

[英语]I am about to do something

[database]Windows 下安装使用 MongoDB(hello world)

[django]复制/克隆一条查询结果

[django]编写作用于视图(view)的装饰器(Decorator)

[linux]解决 sendmail 错误: FEATURE() should be before MAILER()

[django]线上部署后,访问 admin 时出现“DoesNotExist at /admin/ Site matching query does not exist.”错误

[django] 创建后台超级用户时出现 TypeError: decode() argument 1 must be string, not None 错误

[python]将列表分组成包含多个子列表的列表

[django]官方编码规范

[django]使用 apache + mod_wsgi 部署 django

[django]使用 nginx + fastcgi 部署 django

修改 pelican 3.1 使之支持中文文件夹作为分类目录

[linux] 更改 ssh 私钥 Passphrase

[英语]I wanted to let you know that

[英语]May be not or May not be?

[django]使用内置的 comments 实现评论功能

[django]使用 Paginator 实现分页功能

[django]使用自定义 context processor 实现模板全局变量

[firefox]在地址栏使用通配符过滤书签及历史记录

[django] Variables and attributes may not begin with underscores

使用 Pelican 生成静态博客

[linux]入手 VPS 后首先该做的事情