Skip to content

Instantly share code, notes, and snippets.

View dulao5's full-sized avatar

Du Zhigang (ト シゴウ) dulao5

View GitHub Profile
@dulao5
dulao5 / Choose Boring Technology -- March 30th 2015.zh.md
Last active March 17, 2023 15:00
Choose Boring Technology -- March 30th 2015.zh.md

或许在我的职业生涯中最好的事情就是让Kellan成为我的主管。我坚持了很长时间,足以看到Kellan的技术决策开始结出硕果。我从中学到了很多,但我也因此学到了很多。如果没有Kellan在技术选择上如此完美地“降落”,我就不可能有机会成为写了数据驱动产品现在!的工程师。

一如既往地鼓舞人心。

自从离开Etsy一年以来,我恢复了对技术的关注。现在我的思绪已经凝聚到可以清晰地写下来的程度。接下来是Kellan的精华提炼,希望对他的惊吓程度不会太大。

拥抱无聊。
@dulao5
dulao5 / shell.sh
Created May 9, 2022 08:19
Convert mysql dump file to insert sql for spanner
mysqldump -h 127.0.0.1 -P3307 -uroot -p -B databasename --no-create-db --no-create-info --complete-insert --extended-insert=FALSE --skip-lock-tables > /tmp/insert.sql
gsed -i -e 's/^--.*//' -e 's/^\/\*.*//' -e 's/UNLOCK.*//' -e 's/LOCK TABLES.*//' /tmp/insert.sql
# map file for Convert underscore to PascalCase
egrep '`.*?`' /tmp/insert.sql -o | sort | uniq | gsed -e 's/`//g' > /tmp/mysql-words
cp /tmp/mysql-words /tmp/spanner-words
gsed -i -r 's/(^|_)([a-z])/\U\2/g' /tmp/spanner-words
paste /tmp/mysql-words /tmp/spanner-words > /tmp/map.txt
@dulao5
dulao5 / textarea-to-pre.js
Created April 27, 2022 02:35
replace all textarea elements to pre
nl = document.querySelectorAll('textarea');
for (var text of nl) {
if (text.disabled) continue;
var pre = document.createElement('PRE');
pre.innerHTML = text.innerHTML;
pre.style.border = "solid 1px";
pre.style.whiteSpace = "pre-wrap";
text.parentElement.replaceChild(pre, text);
}
@dulao5
dulao5 / php-with-db.yaml
Last active December 25, 2021 07:55
che-ticlick-devfiles
apiVersion: 1.0.0
metadata:
generateName: php-tidb-
projects:
- name: crud-php
source:
type: git
location: 'https://github.com/che-samples/php-mysql'
components:
- type: chePlugin
@dulao5
dulao5 / 0.create.sql
Last active August 8, 2021 09:39
TiDB tour
create table products (
id bigint(20) NOT NULL AUTO_RANDOM,
name varchar(20),
price int(10),
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (id));
create table users (
id bigint(20) NOT NULL AUTO_RANDOM,
@dulao5
dulao5 / 1.EUCJP and EUCJP-MS.md
Last active December 30, 2020 14:54
WIP --- EUCJP and EUCJP-MS charset

ujis(EUCJP) 和 eucJP-ms

查阅了四个地方对 ujis/eucjp-ms 的描述,得到如下不同说法的比较:

byte range mysql ctype-ujis.cc#L33162
comment
mysql ctype-eucjpms.cc#L36410
comment
EUCJP(来自wikipedia EUCJP亚种 - eucJP-ms (来自wikipedia
[00..7F] ASCII [U+0000..U+007F] ASCII/JIS-Roman(one-byte/character) ASCII ASCII
[8E][A1..DF] JIS-X-0201 Katakana [U+FF61..U+FF9F] half-width katakana(two bytes/char) 半角片假名 (JIS X 0201) 半角片假名 (JIS X 0201)
[A1..FE][A1..FE] JIS-X-0208 JIS X 0208:1997(two bytes/char) JIS X 0208 JIS X 0208字符集合之外还有:
* [AD][A1..FE] NEC特殊文字 1面13区
* [F5..FE][A1..FE] 用户自定义文字(前半) 1面85区 - 94区
[8F][A1-FE][A1-FE] JIS-X-0212 JIS X 0212-1990(three bytes/char) JIS(JIS辅助汉字集合) (JIS X 0212) JIS辅助汉字集合 (JIS X 0212)之外还有:*
#!/bin/sh
if ( pmset -g batt | head -n 1 | grep 'AC Power' ); then
exit 0
fi
battery_percent=$(pmset -g batt|grep InternalBattery | awk '{print $3}' | sed -e 's/%.*//')
battery_low=60
if [ $battery_percent -lt $battery_low ]; then

問題解決した後に、OSSに貢献しないと損する

image

新規開発しても、OSSに貢献したほうがいい

image

@dulao5
dulao5 / 0.linuxとCNCFの関係.md
Last active July 8, 2019 02:21
linuxとCNCFの関係

image

@dulao5
dulao5 / 1.nginx.conf
Last active November 17, 2021 07:24
php-fpm status & datadog
location ~ ^/(phpfpm_status|phpfpm_ping)$ {
access_log off;
allow 127.0.0.1;
deny all;
fastcgi_pass php:9000;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location /nginx_status {