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
circleClickHandler() { | |
let level = this.curExpendLevel | |
if (level < 2 && (level > this.lastExpendLevel || level === 0)) { | |
level++ | |
} else { | |
level-- | |
} | |
this.lastExpendLevel = this.curExpendLevel | |
this.curExpendLevel = level | |
} |
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
/** | |
* 使用方法: | |
* 1. 用 Chrome 打开歌单的 web 页面(可以通过分享拿到链接,链接类似这样:http://music.163.com/playlist?id=xxx&userid=yyy) | |
* 2. 然后右键“检查”(如果有左上角有 device 选项,需要选择 Laptop 开头的,可以在 Edit/编辑 里添加) | |
* 3. 在 console 里输入下面脚本,即可输出 “歌曲名 - 歌手名” 格式的内容: | |
Springsteen - Eric Church | |
Chattahoochee - Alan Jackson | |
Baby Now That I Found You - Alison Krauss | |
Check Yes or No - George Strait |
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 fs = require('fs') | |
const path = require('path') | |
const os = require('os') | |
const Koa = require('koa') | |
const koaBody = require('koa-body'); | |
const app = new Koa() |
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
var fileOrPath = /^((((?:\.\/|\.\.\/|\/)?(?:[.\w-_]+\/)*)([.\w-_]+)*),?)+$/ | |
var email = /^[a-z0-9]+([._\\-]*[a-z0-9])*@(?:(?!qq|gmail|163|sina|live|126|yeah|sohu|hotmail|outlook|263|googlemail|yahoo|sogou|21cn|189|aliyun|foxmail|139|10086)[a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$/ | |
var phone = /^1\d{10}$|^(0\d{2,3}-?|\(0\d{2,3}\))?[1-9]\d{4,7}(-\d{1,8})?$/ | |
var hexstring = /\b[0-9a-fA-F]+\b/ |
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
# https://stackoverflow.com/questions/14678132/python-hexadecimal | |
iv = '\xf3\xc2\xafw:\r}k' | |
res = '' | |
for i in iv: | |
res = res + "{:#04x}".format(ord(i)) + ", " | |
print res |
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
python -c "import os; print(repr(os.urandom(24)))" |
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
SEGMENT_SIZE=128 | |
BLOCK_SIZE = 16 | |
cipher = AES.new(KEY, AES.MODE_CFB, IV, segment_size=SEGMENT_SIZE) | |
dc = dynamic_token.decode("hex") | |
pt = cipher.decrypt(dc) | |
print pt |
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 json | |
from base64 import b64encode | |
from Crypto.Cipher import AES | |
from Crypto.Random import get_random_bytes | |
data = "secret" | |
print(data) | |
key = get_random_bytes(16) | |
iv = get_random_bytes(16) | |
cipher = AES.new(key, AES.MODE_CFB, iv) |
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 json | |
from base64 import b64encode | |
from Crypto.Cipher import AES | |
from Crypto.Random import get_random_bytes | |
data = b"secret" | |
print(data) | |
key = get_random_bytes(16) | |
iv = get_random_bytes(16) | |
cipher = AES.new(key, AES.MODE_CFB, iv) |
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
(subprocess.check_output("echo xxx", shell=True).strip()).decode() |
NewerOlder