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
// 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
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
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
// 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
def l = Arrays.asList("B","A","C") | |
def r = l.stream().parallel().filter { e -> e != "B" } .findAny() | |
def s = l.stream().parallel().filter { it != "B"}.findFirst() | |
println l | |
println r.get() | |
println s.get() |
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 java.util.concurrent.ForkJoinPool | |
println ForkJoinPool.commonPool().getParallelism() | |
def l = Arrays.asList("A","B","C","D") | |
// def l = new LinkedList<String>(["B","A","C"]) | |
println Runtime.getRuntime().availableProcessors() | |
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 org.slf4j.LoggerFactory | |
import org.slf4j.bridge.SLF4JBridgeHandler | |
import java.util.logging.Logger | |
class MyLog { | |
private Logger logger = Logger.getLogger("jul") | |
private org.slf4j.Logger log = LoggerFactory.getLogger(MyLog.class); | |
void log() { | |
SLF4JBridgeHandler.removeHandlersForRootLogger() |
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
# log4j.configuration=log4j.properties Use this system property to specify the name of a Log4J configuration file. If not specified, the default configuration file is log4j.properties. | |
# log4j.rootCategory=priority [, appender]* | |
# Set the default (root) logger priority. log4j.logger.logger.name=priority Set the priority for the named logger and all loggers hierarchically lower than, or below, the named logger. logger.name corresponds to the parameter of LogFactory.getLog(logger.name), used to create the logger instance. Priorities are: DEBUG, INFO, WARN, ERROR, or FATAL. | |
#Log4J understands hierarchical names, enabling control by package or high-level qualifiers: log4j.logger.org.apache.component=DEBUG will enable debug messages for all classes in both org.apache.component and org.apache.component.sub. Likewise, setting log4j.logger.org.apache.component=DEBUG will enable debug message for all 'component' classes, but not for other Jakarta projects. | |
# log4j.appender.appender.Threshold=priority | |
log4j.rootCatego |
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
{ | |
"keymaps": { | |
"0": { "type": "scroll.home" }, | |
":": { "type": "command.show" }, | |
"o": { "type": "command.show.open", "alter": false }, | |
"O": { "type": "command.show.open", "alter": true }, | |
"t": { "type": "command.show.tabopen", "alter": false }, | |
"T": { "type": "command.show.tabopen", "alter": true }, | |
"w": { "type": "command.show.winopen", "alter": false }, | |
"W": { "type": "command.show.winopen", "alter": true }, |