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://ppt.geekbang.org/list/qconbj2019?from=timeline&isappinstalled=0 | |
JSON.stringify(jQuery.map(jQuery(".last-line > a"), e => jQuery(e).attr('href') )) |
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
from datetime import datetime, timedelta | |
from functools import lru_cache, wraps | |
def time_cached(maxsize=None, **timedelta_kwargs): | |
""" | |
基于时间过期的LRU缓存 | |
`timedelta_kwargs`: | |
days=0, seconds=0, microseconds=0, milliseconds=0, minutes=0, hours=0, weeks=0 | |
""" |
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
apps = hs.application.runningApplications() | |
for key, value in pairs(apps) do | |
print(key) | |
print(value) | |
end |
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
// Usage: $ mongo dropAll.js | |
var dbs = db.getMongo().getDBNames() | |
for(var i in dbs){ | |
db = db.getMongo().getDB( dbs[i] ); | |
print( "dropping db " + db.getName() ); | |
db.dropDatabase(); | |
} | |
print("done.") |
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
buildscript { | |
repositories { | |
// maven { url 'http://repo.spring.io/plugins-release' } | |
// maven { url 'https://plugins.gradle.org/m2/'} | |
jcenter() | |
} | |
dependencies { | |
classpath 'io.github.lukehutch:fast-classpath-scanner:2.4.5' | |
} |
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
function compile(template){ | |
var evalExpr = /<%=(.+?)%>/g; | |
var expr = /<%([\s\S]+?)%>/g; | |
template = template | |
.replace(evalExpr, '`);\n echo( $1 );\n echo(`') | |
.replace(expr, '`);\n $1 \n echo(`'); | |
template = 'echo(` ' + template + '`);'; | |
var script = ` |
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/sh | |
# | |
# /etc/rc.d/init.d/docker | |
# | |
# Daemon for docker.com | |
# | |
# chkconfig: 2345 95 05 | |
# description: Daemon for docker.com | |
### BEGIN INIT INFO |
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
#生成 RSA 私钥(传统格式的) | |
openssl genrsa -out rsa_private_key.pem 1024 | |
#将传统格式的私钥转换成 PKCS#8 格式的 | |
openssl pkcs8 -topk8 -inform PEM -in rsa_private_key.pem -outform PEM -nocrypt | |
#生成 RSA 公钥 |
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
yum install build-essential autoconf libtool openssl-devel gcc git -y | |
cd /tmp/ | |
git clone --depth=1 https://github.com/madeye/shadowsocks-libev.git | |
cd shadowsocks-libev | |
./configure --disable-documentation | |
make && make install | |
mkdir -p ~/bin |
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
$title-color | |
color red | |
.a | |
@extends $title-color | |
.title-color2 | |
color red | |
.b | |
@extends .title-color2 |