This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 检测浏览器的 User Agent 应该是非常简单的事情 | |
// 微信在 Android 下的 User Agent | |
mozilla/5.0 (linux; u; android 4.1.2; zh-cn; mi-one plus build/jzo54k) applewebkit/534.30 (khtml, like gecko) version/4.0 mobile safari/534.30 micromessenger/5.0.1.352 | |
// 微信在 iPhone 下的 User Agent | |
mozilla/5.0 (iphone; cpu iphone os 5_1_1 like mac os x) applewebkit/534.46 (khtml, like gecko) mobile/9b206 micromessenger/5.0 | |
// 通过javascript判断 | |
// 很容易看出来,微信的 User Agent 都有‘micromessenger’字符串标示,我们判断是否含有这些字符串就OK了 | |
function isWeixinBrowser(){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
## make a git tag, and push to origin remote | |
git tag -d $1 || true | |
git tag $1 | |
echo "Push tag to origin remote?" | |
select yn in "Yes" "Force" "No"; do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ExcelJS, {Worksheet} from "exceljs"; | |
/** | |
* Autofit columns by width | |
* | |
* @param worksheet {ExcelJS.Worksheet} | |
* @param minimalWidth | |
*/ | |
export const autoWidth = (worksheet: Worksheet, minimalWidth = 10) => { | |
worksheet.columns.forEach((column) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"docker-compose.yml" 17L, 339C 1,1 All | |
version: '3.5' | |
services: | |
web: | |
image: odoo | |
depends_on: | |
- db | |
ports: | |
- "8069:8069" | |
environment: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
du -d 1 -lh $1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# https://stackoverflow.com/a/16957078/2108080 | |
grep -rnw $1 -e $2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require('path'); | |
const fs = require('fs-extra'); | |
const sharp = require('sharp'); | |
const dir = ''; | |
const convert = async () => { | |
const files = await fs.readdir(dir); | |
for (let i =0 ; i<files.length;i++){ | |
const image = path.join(dir,files[i]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
NETWORK_INTERFACE=$1 | |
ifconfig $NETWORK_INTERFACE && systemd-resolve --status $NETWORK_INTERFACE | |
# usage | |
# network-status.sh <Your network interface name> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse | |
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse | |
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse | |
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse | |
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse | |
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse | |
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse | |
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse | |
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse | |
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
docker images -q -f dangling=true | xargs --no-run-if-empty docker rmi |
NewerOlder