Skip to content

Instantly share code, notes, and snippets.

@khahux
khahux / 3000.txt
Created January 8, 2016 04:03 — forked from shiywang/3000.txt
Q: abandon
A: 【考法 1】 n. 放纵: carefree, freedom from constraint
A: 【考法 2】 v. 放纵: to give (oneself) over unrestrainedly
A: 【考法 3】 v. 放弃: to withdraw from often in the face of danger or encroachment
A: 【考法 4】 v. 停止做某事: to put an end to (something planned or previously agreed to)
Q: awning
A: 【考法 1】 n. 雨篷,遮阳篷: a piece of material attached to a caravan or building which provides shelter from the rain or sun
Q: mercenary
@khahux
khahux / shine.sh
Created August 13, 2019 05:32
Mac屏幕闪烁
for i in 1 2 3 4
do
pmset displaysleepnow
sleep 1
caffeinate -u -t 1
sleep 2
done
class Cursor(object):
"""
只是翻页的结构, 原始值有三种: 0, None, 其他
若是 0, 其实是上次返回时指示已没有结果的意思, 应返回空
若是 None, 表示是第一次请求, 应使用默认参数对请求做出响应
若是其他值, 正数表示像后翻, 负数表示向前翻
"""
DIRECTION_NEXT = 'next'
DIRECTION_PREVIOUS = 'previous'
DIRECTION_NONE = None
import time
import json
import hashlib
from random import randint
import requests
APP_ID = ''
APP_KEY = ''
db.getCollection('xxx').find({"type": "xxx", "from": {$ne: "xxx"}}).sort({"Time": -1}).count()
@khahux
khahux / process_thread_coroutine.py
Created August 22, 2019 08:20
Python进程线程协程
"""
(venv) $ python process_thread_coroutine.py
[2019-08-22 08:17:24,661Z - INFO - kipp] - main running...
[2019-08-22 08:17:24,661Z - INFO - kipp] - coroutine_main running...
[2019-08-22 08:17:24,662Z - INFO - kipp] - io_blocking_task running...
[2019-08-22 08:17:24,675Z - INFO - kipp] - coroutine_task running...
[2019-08-22 08:17:24,676Z - INFO - kipp] - coroutine_error running...
[2019-08-22 08:17:24,677Z - INFO - kipp] - coroutine_error end, cost 0.00s
[2019-08-22 08:17:24,678Z - INFO - kipp] - cpu_blocking_task running...
@khahux
khahux / py2pyc.sh
Created August 28, 2019 09:01
Python3编译py文件为pyc
python3 -O -m compileall -b .
find . -name "*.py" | xargs rm -rf
find . -name "__pycache__" | xargs rm -rf
@khahux
khahux / gitpull.sh
Created September 26, 2019 10:45
对目录下所有的git项目执行pull.
#!/bin/bash
set -e
for i in $(find . -name .git); do
echo "Git pull: ${i:2:$((${#i}-7))}"
(cd $PWD${i:1:$((${#i}-6))} && git pull)
echo
done
#!/bin/bash
set -e
if [ $# != 2 ]; then
echo "please input ip and port, example: sh redis.sh 127.0.0.1 6379"
exit 1
fi
redis-cli -h $1 -p $2 --scan --pattern "*:[0-9]*[0-9]" | grep -v '^chouti:links:[0-9]\+$' | tee error.txt