Skip to content

Instantly share code, notes, and snippets.

View zhengkai's full-sized avatar
🎯
Focusing

郑凯 zhengkai

🎯
Focusing
View GitHub Profile
@zhengkai
zhengkai / js.md
Last active July 10, 2020 03:22
了解 JavaScript

Why

为什么要学 JavaScript

过去被大量使用,将来会在更多场合使用

@zhengkai
zhengkai / variable_naming_rule.md
Last active May 17, 2020 12:11
变量命名规则

已废弃,用于测试 gist css

a

挺尴尬的事情,按字母排序时 foot.txthead.txt 前面

子元素为不同类型的数组。如

@zhengkai
zhengkai / README.md
Last active June 6, 2016 02:42
用 git submodule + 独立 git branch 来提交和保存 composer 的 vendor 目录,以减少在生产环境使用 composer 时的问题
@zhengkai
zhengkai / dump_mysql_each.sh
Last active August 29, 2015 14:21
将数据库里的每个 database 备份为一个文件
#!/bin/bash
# 将数据库里的每个 database 备份为一个文件
#
# 默认生成 .sql.gz 文件,如果不需要压缩,可以命令行结尾加个参数 nogz
# 如 ./dump_mysql_each.sh nogz
#
# 使用之前需要确保 ~/.my.cnf 有对应配置、
# 可以直接不带额外参数的启动 mysql 和 mysqldump dbname
@zhengkai
zhengkai / pcntl_signal_demo.php
Last active August 29, 2015 14:18
Demo for pcntl_signal & declare
#! /usr/bin/env php
<?php
// PHP 的 pcntl_signal 函数保证了脚本只有在它想退出的时候才退,
// 这个脚本作为一个演示,稍做修改也可以针对 pcntl_signal 和 declare 做各种检验
//
// https://gist.github.com/zhengkai/17ce473fb2455e6089f5
//
// author: Zheng Kai (zhengkai@gmail.com)
// 2015-04-07
@zhengkai
zhengkai / result.log
Last active August 29, 2015 14:18
测试几种常见序列化的时间
Loaded successfully fallback configuration file /home/zhengkai/.blackfire.ini
json_0000.log
row = 111,358
igbinary_serialize 87,489,314
json_encode 100,748,482
msgpack_pack 85,148,186
serialize 121,901,429
@zhengkai
zhengkai / sysv_mq.md
Last active August 29, 2015 14:17
使用系统内核自带的 MQ(System V IPC Message Queues) 做 log 系统
@zhengkai
zhengkai / sysv_mq_recv.php
Last active August 29, 2015 14:17
receive "System V IPC Message Queues" & save to log file
#! /usr/bin/env php
<?php
/*
* sysv_mq_recv.php
*
* receive "System V IPC Message Queues" & save to log file
*
* https://gist.github.com/zhengkai/5f4f6429849d4a0f7c6c
*
* author: Zheng Kai (zhengkai@gmail.com)
@zhengkai
zhengkai / keymap_soulogic.c
Last active August 29, 2015 14:16
GH60 键位定义
#include "keymap_common.h"
/*
* Soulogic Layout
*/
const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* 0: Default layer
* ,-----------------------------------------------------------.
* |Esc| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| - | = | Bspc |
* |-----------------------------------------------------------|
@zhengkai
zhengkai / gen_id.php
Last active August 29, 2015 14:10
在多个服务器同时生成 id 的方式
<?php
/*
* https://gist.github.com/zhengkai/c1dce35f96ae4a8458e5
*
* author: Zheng Kai (zhengkai@gmail.com)
*/
function gen_id($i) {
$iSize = 10;