Skip to content

Instantly share code, notes, and snippets.

赖信涛 laixintao

Block or report user

Report or block laixintao

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View 6.48. Libelf from Elfutils-0.177
PASS: run-backtrace-fp-core-x86_64.sh
PASS: run-backtrace-fp-core-aarch64.sh
PASS: run-backtrace-fp-core-ppc64le.sh
PASS: run-backtrace-core-x32.sh
PASS: run-backtrace-core-i386.sh
PASS: run-backtrace-fp-core-i386.sh
PASS: run-backtrace-core-ppc.sh
PASS: run-backtrace-core-s390x.sh
PASS: run-backtrace-core-s390.sh
PASS: run-backtrace-core-aarch64.sh
View antd-bug.js
import React, { Component } from '@alipay/bigfish/react'
import { Flex, Card, WingBlank, WhiteSpace } from 'antd-mobile'
export default class ExampleCard extends Component {
render() {
return (
<WingBlank size="lg">
<WhiteSpace size="lg" />
<Card>
<Card.Header
View redis_re.py
# -*- coding: utf-8 -*-
import re
re.compile(r'^(?:(?:\s){0,}(?P<n0>(?:CLUSTER(?:\s){1,}ADDSLOTS|CLUSTER(?:\s){1,}DELSLOTS|cluster(?:\s){1,}addslots|cluster(?:\s){1,}delslots))(?:\s){1,}(?P<n1>(?:\d){1,}(?:(?:\s){1,}(?:\d){1,}){0,})(?:\s){0,}|(?:\s){0,}(?P<n2>(?:CLUSTER(?:\s){1,}COUNT-FAILURE-REPORTS|CLUSTER(?:\s){1,}FORGET|CLUSTER(?:\s){1,}REPLICAS|CLUSTER(?:\s){1,}REPLICATE|CLUSTER(?:\s){1,}SLAVES|cluster(?:\s){1,}count-failure-reports|cluster(?:\s){1,}forget|cluster(?:\s){1,}replicas|cluster(?:\s){1,}replicate|cluster(?:\s){1,}slaves))(?:\s){1,}(?P<n3>(?:\d){1,})(?:\s){0,}|(?:\s){0,}(?P<n4>(?:CLUSTER(?:\s){1,}COUNTKEYSINSLOT|cluster(?:\s){1,}countkeysinslot))(?:\s){1,}(?P<n5>(?:\d){1,})(?:\s){0,}|(?:\s){0,}(?P<n6>(?:CLUSTER(?:\s){1,}FAILOVER|cluster(?:\s){1,}failover))(?:\s){1,}(?P<n7>(?:FORCE|TAKEOVER|force|takeover))(?:\s){0,}|(?:\s){0,}(?P<n8>(?:CLUSTER(?:\s){1,}RESET|cluster(?:\s){1,}reset))(?:\s){1,}(?P<n9>(?:HARD|SOFT|hard|soft))(?:\s){0,}|(?:\s){0,}(?P<n10>(?:CLUSTER(?:\s){1,}GETKEYSINSLOT|cluster
@laixintao
laixintao / t.sh
Created Sep 16, 2019
Difference between $* and $@
View t.sh
echo "\$* in quotes..."
for v in "$*"
do
echo $v
done
echo "\$@ in quotes..."
for v in "$@"
do
echo $v
View in-place-convert-encoding.sh
for file in $(fd -x file | rg "UTF-8" | cut -f1 -d":")
do
echo "convert ${file}..."
iconv -f utf8 -t gbk "$file" > "$file.new" &&
mv -f "$file.new" "$file"
done
View show_db_size.sql
SELECT table_schema "DB Name",
ROUND(SUM(data_length + index_length) / 1024 / 1024, 1) "DB Size in MB"
FROM information_schema.tables
GROUP BY table_schema;
View zshokxsCD
4KB 不是随机的一个数,Block device 的读操作是按照 block size 来的,读操作按照 block size align才会更快(size是block size的倍数)。
可以用 dd 对比一下每次读 1bytes,读2097152次,和每次读 1024bytes,一共2048次的速度:
➜ ~ dd bs=1 count=2097152 if=/dev/zero of=pirate
2097152+0 records in
2097152+0 records out
2097152 bytes transferred in 6.048756 secs (346708 bytes/sec)
➜ ~ dd bs=1024 count=2048 if=/dev/zero of=pirate
View change-git-commit-date.sh
git filter-branch --env-filter '
OLD_EMAIL="your email"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
export GIT_AUTHOR_DATE=$(git show -q --format=%aD $GIT_COMMIT | xargs -I {} gdate --date={} +"%F 23:00:00" | xargs -I {} gdate --date={} +%s)
export GIT_COMMITTER_DATE=$(git show -q --format=%aD "$GIT_COMMIT" | xargs -I {} gdate --date={} +"%F 23:00:00" | xargs -I {} gdate --date={} +%s)
fi
if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ]
then
export GIT_AUTHOR_DATE=$(git show -q --format=%aD "$GIT_COMMIT" | xargs -I {} gdate --date={} +"%F 23:00:00" | xargs -I {} gdate --date={} +%s)
View print_ABC.py
# -*- coding: utf-8 -*-
"""
Three threads print A B C in order.
"""
from threading import Thread, Condition
condition = Condition()
View zrange_benchmark.py
# -*- coding: utf-8 -*-
import redis
import random
import string
import time
COUNT = 1_000_000
r = redis.Redis(host="localhost", port=6379, db=0)
You can’t perform that action at this time.