Skip to content

Instantly share code, notes, and snippets.

View shhider's full-sized avatar

Shi Haohong shhider

  • Hangzhou / 杭州
View GitHub Profile
@shhider
shhider / excel-functions-description.json
Created October 17, 2018 02:59
excel, function, formula, description, category
[
{
"name": "ABS",
"category": "Math and trigonometry",
"description": "Returns the absolute value of a number"
},
{
"name": "ACCRINT",
"category": "Financial",
"description": "Returns the accrued interest for a security that pays periodic interest"
@shhider
shhider / reset-mysql-password.sh
Created August 29, 2018 06:21
reset mysql password
# if you remember current password:
mysql -u root -p
set password for 'root'@'localhost' = PASSWORD('your-new-password');
flush privileges;
# else:
# 1. stop mysql
# 2.
sudo /usr/local/mysql/bin/mysql_safe --skip-grant-tables
# 3. open new terminal tab
let elemStyle = document.createElement('style')
elemStyle.innerHTML = `
h1:hover,
h2:hover,
h3:hover,
h4:hover,
h5:hover,
h6:hover,
@shhider
shhider / 00-git-litedoc.sh
Last active May 9, 2023 07:06
[Git Lite Docs] #git #litedoc #commands
# 只 clone 最新的代码,不要 commits/tags...
git clone https://xxx/xxx.git --depth 1
# 这称为 shallow clone
# 如果后面又需要完整的仓库
git pull --unshallow
# === 恢复数据 ===
# reflog 可以查看你每次 git 操作后的 hash
git reflog
.top-box {
box-shadow: inset 0 7px 9px -7px rgba(0,0,0,0.7);
}
.left-box {
box-shadow: inset 7px 0 9px -7px rgba(0,0,0,0.7);
}
.right-box {
box-shadow: inset -7px 0 9px -7px rgba(0,0,0,0.7);

debounce

一系列的触发,停止触发(最后一次触发 xx 毫秒后没有再触发)后就执行。延后执行。

throttle

xx 秒内只允许执行1次,第一次触发时立即执行。

@shhider
shhider / redis-on-mac-by-homebrew.md
Last active June 4, 2018 03:30
mac, macOS, install, redis, start at login

Install and manage

Install Redis By Homebrew

brew install redis

To have launchd start redis now and restart at login:

@shhider
shhider / html-element-size-and-distance.js
Last active April 26, 2018 06:10
size, distance of HTMLElement
let domRect = elem.getBoundingClientRect();
/*
- top: 元素*上边界* 与 页面可视区域*上边界* 的距离;
- bottom: 元素*下边界* 与 页面可视区域*上边界* 的距离;
- right: 元素*右边界* 与 页面可视区域*左边界* 的距离;
- left: 元素*左边界* 与 页面可视区域*左边界* 的距离;
// IE9+
- width, 元素的宽;
- height, 元素的高;
@shhider
shhider / clear.sh
Last active June 13, 2023 11:25
clear <none> tag images in Docker
docker rmi $(docker images --filter "dangling=true" -q --no-trunc)
# if you got: "docker rmi" requires at least 1 argument.
# That means you don't have useless <none> images,
# maybe you can remove useless containers before.
# after 1.25, you can use the follow cmd.
# https://docs.docker.com/engine/reference/commandline/image_prune/
docker image prune
@shhider
shhider / fix-m2crypto-error.md
Created January 18, 2018 06:32
处理 pip 安装 m2crypto 报错的方法集合

安装 m2crypto 出现报错,通常是 swig 的原因,所以:

1、更新 swig

wget http://prdownloads.sourceforge.net/swig/swig-3.0.12.tar.gz
tar zxf swig-3.0.12.tar.gz
cd swig-3.0.12
./configure --prefix=/usr
make &amp;&amp; make install