PHP
2021-08-06
以 stars:>10000 为条件过滤,得到 51 个结果,进行简单的过滤,结果如下:
- 最火的框架:
- Laravel

- Maatwebsite/Laravel-Excel

- barryvdh/laravel-debugbar

- barryvdh/laravel-ide-helper

- 管理 z-song/laravel-admin

- 管理 the-control-group/voyager

- Symfony

- CodeIgniter

- Yii2

- Slim

- phalcon/cphalcon

特色:C语言写的
- PHP 包管理工具: Composer

- HTTP 客户端: Guzzle

- PHP 设计模式 DesignPatternsPHP

- 日志库: Seldaek/monolog

- 单元测试: sebastianbergmann/phpunit

- SMTP 库: PHPMailer

- 产品
- 文件存储: NextCloud

- CMS, WordPress

- WP 主题: roots/sage

- CMS, getgrav/grav

- CMS, octobercms/october

- 论坛, flarum/flarum

- Personal CRM, Monica

- Musici Streaming Server: koel/koel

- 网站统计: matomo-org/matomo

- 时间处理: briannesbitt/Carbon

- PHP Parser: nikic/PHP-Parser

- Markdown: erusev/parsedown

- 错误处理: filp/whoops

- Status Page System: CachetHQ/Cachet

- 不再维护 phacility/phabricator

Phabricator is a collection of web applications for software development.
- 图像处理: Intervention/image

- 存储封装层: thephpleague/flysystem

- 环境变量: vlucas/phpdotenv

Loads environment variables from .env to getenv(), $_ENV and $_SERVER automagically.
- 不再维护 PHPOffice/PHPExcel

继任者: PHPOffice/PhpSpreadsheet 
- UUID: ramsey/uuid

- 字符串处理: doctrine/inflector

- 代码静态分析: phpstan/phpstan

- 代码格式化, FriendsOfPHP/PHP-CS-Fixer

- doctrine/lexer

- doctrine/annotations

- doctrine/instantiator

- egulias/EmailValidator

- JWT tymondesigns/jwt-auth

- blueimp/jQuery-File-Upload

- fzaninotto/Faker

Python PythonSourceCode
2021-08-05
源码
INIT_TYPE(&PyTuple_Type, "tuple");
SETBUILTIN("tuple", &PyTuple_Type);
**cpython/Include/cpython/tupleobject.h**
typedef struct {
PyObject_VAR_HEAD
/* ob_item contains space for 'ob_size' elements.
Items must normally not be NULL, except during construction when
the tuple is not yet visible outside the function that builds it. */
PyObject *ob_item[1];
} PyTupleObject;
当然,与之对应的 PyTypeObject PyTuple_Type 定义在 Objects/tupleobject.c,就不贴出来了。
PyTuple_SET_ITEM 似乎是在完成内存初始化的空间内填充元素时使用的。
成员方法
tuple 类型只有两个成员方法:count, index
#define TUPLE_INDEX_METHODDEF \
{"index", (PyCFunction)(void(*)(void))tuple_index, METH_FASTCALL, tuple_index__doc__},
#define TUPLE_COUNT_METHODDEF \
{"count", (PyCFunction)tuple_count, METH_O, tuple_count__doc__},
static PyMethodDef tuple_methods[] = {
TUPLE___GETNEWARGS___METHODDEF
TUPLE_INDEX_METHODDEF
TUPLE_COUNT_METHODDEF
{"__class_getitem__", (PyCFunction)Py_GenericAlias, METH_O|METH_CLASS, PyDoc_STR("See PEP 585")},
{NULL, NULL} /* sentinel */
};
引用计数
Py_INCREF
Py_DECREF
Py_XINCREF
Py_XDECREF
Git 开发工具
2021-08-04
看到有篇文章说是 git “新增”了 switch 和 restore 两个命令,仔细一看,原来就是 2019 年就引入了的两个命令,不过我确实没有用过。
这里重新整理一下现在 git 的命令。
git version
git version 2.30.2
apt list --installed | grep ^git
git-doc/hirsute,hirsute,now 1:2.30.2-1ubuntu1 all [已安装]
git-extras/hirsute,hirsute,now 6.1.0-1 all [已安装]
git-flow/hirsute,hirsute,now 1.12.3-1 all [已安装]
git-man/hirsute,hirsute,now 1:2.30.2-1ubuntu1 all [已安装,自动]
git-svn/hirsute,hirsute,now 1:2.30.2-1ubuntu1 all [已安装]
git/hirsute,now 1:2.30.2-1ubuntu1 amd64 [已安装]
gitg/hirsute,now 3.32.1-1 amd64 [已安装]
gitk/hirsute,hirsute,now 1:2.30.2-1ubuntu1 all [已安装]
Golang Beego BeegoNotes
2021-08-02
基础路由
web.Get(router, web.HandleFunc)
web.Post(router, web.HandleFunc)
web.Put(router, web.HandleFunc)
web.Patch(router, web.HandleFunc)
web.Head(router, web.HandleFunc)
web.Options(router, web.HandleFunc)
web.Delete(router, web.HandleFunc)
web.Any(router, web.HandleFunc)
控制器路由
// func Router(rootpath string, c ControllerInterface, mappingMethods ...string) *HttpServer {
// return BeeApp.Router(rootpath, c, mappingMethods...)
// }
beego.Router("/admin", &admin.UserController{})
- 默认匹配
/:id, /?:id
- 类型匹配
/:id:int, /:id:string
- 正则匹配
/:id([0-9]+)
- 星号匹配
/username/* => :splat 变量
/username/*.* => :path 变量和 :ext 变量
取变量的方式:
c.Ctx.Input.Param(":id")
mappingMethods
映射 HTTP 方法到指定方法。
- 支持基础路由中提到到八种方法(Any 用星号代替,优先级最低)。
- 如果不指定这个参数,会映射 GET 请求到
Get 方法,以此类推。
- 应该不支持指定多个方法。
- 应该不支持重复指定方法。
web.Router("/api/food",&RestController{},"get:ListFood")
web.Router("/api/food",&RestController{},"post:CreateFood")
web.Router("/api/food",&RestController{},"put:UpdateFood")
web.Router("/api/food",&RestController{},"delete:DeleteFood")
web.Router("/api",&RestController{},"get,post:ApiFunc")
web.Router("/api/food",&RestController{},"get:ListFood;post:CreateFood;put:UpdateFood;delete:DeleteFood")
注意:控制器可以声明 URLMapping 方法,比 mapptingMethods 参数通过反射实现更加高效。
func (c *CMSController) URLMapping() {
c.Mapping("StaticBlock", c.StaticBlock)
c.Mapping("AllBlock", c.AllBlock)
}
自动路由
web.AutoRouter(&controllers.ObjectController{})
URL 采用 /:controller/:method 前缀的方式,后面的部分会转化成 map 参数 (.Ctx.Input.Params)。
method 不区分大小写,对应的处理方法名首字母大写,比如 login -> Login。
注意:/system/config.json 对应到 SystemController.Config 方法,后缀通过 .Ctx.Input.Param(":ext") 获取。
注解路由
- 2.0 开始支持,dev 模式生效
- 自动扫描指定目录,生成
routers/commentsRouter.go 文件
CommentRouterPath 配置扫描目录
web.Include(&CMSController{})
相应的控制器需要添加这样格式的注解:
// @router /staticblock/:key [get]
GitHub Python 协程 asyncio
2021-07-31
根据 asyncio stars:>1000 的数据自动生成本文。
GitHub 微服务
2021-07-31
根据 microservice stars:>4000 的数据自动生成本文。
GitHub WebFramework
2021-07-31
根据 web framework stars:>10000 的数据自动生成本文。
Redis
2021-07-29
之前发过一篇《Redis 命令大全》,列出了所有命令,结果我自己都懒得看。
我这里整理一下我日常常用的操作。
时事
2021-07-29
之前写过一片博客:《阅读:追风筝的人》, 了解了阿富汗的一些事情。
在抖音上看到:昨天阿塔(阿富汗塔利班)代表团来华访问,外长王毅负责接见。我方强调对 “东伊运” 的打击,塔利班也声明反对一切利用阿富汗从事危害中国的行为。
PS: 塔利班执政时期,阿富汗外交部曾经声明会保护祖先留下来的遗迹,没过几天,他们的领袖就下令炸毁巴米扬大佛。
从八十年代至今的几十年,中国都是维持中立,尽可能避免卷入别国政治风波。所以,从塔利班访华来看,应该是稳了。
希望塔利班这次执政能善待本国人民,同时和恐怖分子划清界限。
PS:塔利班曾经和东伊运有着密切的关系。
PS: 注意阿塔和巴塔之间的分别。引用 7/19 外交部例行记者会上赵立坚的发言:
你关于 “巴基斯坦塔利班” 和阿富汗塔利班的认识是客观的,两者是不一样的。“巴基斯坦塔利班” 是巴基斯坦政府和国际社会普遍认定的恐怖组织,其承认参与制造了包括奎达酒店爆炸在内的多起恐怖袭击。阿富汗塔利班称自己是一个政治、军事组织,公开表示禁止任何组织或个人利用阿富汗领土威胁其他国家,近年同阿富汗政府和国际社会保持着对话接触。
PS: 7/14 巴基斯坦汽车爆炸事件,多名中巴人员伤亡,网上很多人认为是巴塔针对中国人发起的恐怖袭击。
个人
2021-07-28
*#06# 移动设备识别码
弹出一个框,title 是 “移动设备识别码”:
MEID :14 位数字
IMEI1: 15 位数字
IMEI2: 15 位数字
- MEID, Mobile Equipment Identifier, 移动设备识别码
移动设备识别码是一个全球唯一的识别 CDMA2000 移动台设备的号码。该号码的格式由 3GPP2 report S.R0048 定义,不过可以看作一个使用十六进制数字的IMEI。
- IMEI, International Mobile Equipment Identity, 国际移动设备识别码
通常所说的手机 “串号”,用于在移动电话网络中识别每一部独立的手机等移动通信设备,相当于移动电话的身份证。序列号共有15位数字,前6位(TAC)是型号核准号码,代表手机类型。接着2位(FAC)是最后装配号,代表产地。后6位(SNR)是串号,代表生产顺序号。最后1位(SP)一般为0,是检验码,备用。国际移动设备识别码一般贴于机身背面与外包装上,同时也存在于手机存储器中,通过输入 *#06# 即可查询。
*#*#4636#*#* 小米手机测试信息
三个子菜单:
- 手机信息1
- 手机信息2
- WLAN infomation