I hereby claim:
- I am chux0519 on github.
- I am chux0519 (https://keybase.io/chux0519) on keybase.
- I have a public key ASBmv5sc3jH3XoEPCaV_gT02QP_HMprXAgdpHvPkLx8s2Qo
To claim this, I am signing this object:
const {TaskExecutionLimiter, buildTaskExecutionLimiter, buildWithLimit} = require('task-execution-limiter') | |
const console = require('consoleit') | |
const case1 = () => { | |
console.log('=> case 1: Usage of `TaskExecutionLimiter.schedule`') | |
// Using TaskExecutionLimiter class | |
// schedule method | |
const limiter = new TaskExecutionLimiter({ | |
interval: 1000, // rate limit: one task per second | |
limit: 1, |
const superstatic = require('superstatic').server | |
const path = require('path') | |
const fsProvider = require('superstatic/lib/providers/fs') | |
// Remove etag, cancel the browser's cache, avoid update issues | |
function noCacheProvider (options) { | |
const handler = fsProvider(options) | |
return (req, pathname) => handler(req, pathname).then(res => { | |
if (res) { // res can be null | |
res.modified = false |
const AWS = require('aws-sdk') | |
function buildS3Service (options) { | |
const { | |
s3Key, | |
s3Secret | |
} = options | |
const s3Client = new AWS.S3({ | |
accessKeyId: s3Key, | |
secretAccessKey: s3Secret |
#!/bin/bash | |
# Install Shadowsocks on CentOS 7 | |
echo "Installing Shadowsocks..." | |
random-string() | |
{ | |
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w ${1:-32} | head -n 1 | |
} |
PAGE_SZ = 2 | |
class Page(object): | |
def __init__(self): | |
self.m = {} | |
self.d = 0 | |
def full(self): | |
return len(self.m) >= PAGE_SZ |
sed -n '/protocol:op_query/p' mongod.log | sed 's/\([0-9|_|T]*\+0000\) .*command \(.*\..*\) command:.*planSummary: \([A-Z|_]*\) .*protocol:op_query \([0-9]*ms\)$/\1 \2 \3 \4/g' |
#!/bin/bash | |
DATA_PATH=$1 | |
DATE=$(date +%F) | |
BACKUP=rancher-data-backup-$DATE.tar.gz | |
CONTAINER_NAME=$(docker ps | grep rancher | awk '{print $NF}') | |
printf "found running rancher container $CONTAINER_NAME\n" |
I hereby claim:
To claim this, I am signing this object:
// 最大公约数 | |
const gcd = (a, b) => a === 0 ? b : gcd(b % a, a) | |
// 最小公倍数 | |
const lcm = arr => arr.reduce((a, b) => a * b / gcd(a, b), 1) | |
const overallTotal = 9 / 10 | |
const overallAvg = overallTotal / 3 | |
for (let x = 2; ; ++x) { |
https://stage.press.one/p/v?s=46af64a5f97f6cc0938a23a2fa6879148d946013a5f55eda9df30155e7994d4cf479bb58ca3e13a60125678525db61fe81de8b1f767143e33aec3c49a5474dea1&h=f9f2860430e7973536650a3ef3f1730941212b431ba05d123ce7d2c400d26a76&a=54e9679b057faa1e38474b8e705625829643f963&f=P1&v=3 |