Skip to content

Instantly share code, notes, and snippets.

View xwsg's full-sized avatar
🎯
Focusing

xwsg xwsg

🎯
Focusing
  • Shandong, China
View GitHub Profile
@xwsg
xwsg / Generate-Markdown.groovy
Created January 14, 2020 03:21
Datagrip groovy scripts
import com.intellij.database.model.ObjectKind
import com.intellij.database.util.DasUtil
FILES.chooseDirectoryAndSave("Choose directory", "Choose where to store generated files") { dir ->
def schemaMap = new LinkedHashMap<String, Map<String, String>>();
SELECTION.filter { (it.getKind() == ObjectKind.TABLE || it.getKind() == ObjectKind.SCHEMA) }.each {
def schemaName = DasUtil.getSchema(it);
if (!schemaMap.containsKey(schemaName)) {
schemaMap.put(schemaName as String, new LinkedHashMap<String, String>());
@xwsg
xwsg / Shell.md
Last active December 10, 2017 02:36

查看文件的中间几行

# 查看文件的第100-200行
sed -n '100,200p' filename 

nohup使用,后台运行

@xwsg
xwsg / vscode-Q&A.md
Last active October 31, 2017 05:42
vscode常见问题

1.格式化JSON

安装 Beautify 插件后,按键 F1 调出命令面板然后输入beautify,选择 Beautify selection 或者 Beautify file. Beautify 可以格式化 javascript, JSON, CSS, Sass, 和 HTML

@xwsg
xwsg / socks5_to_http.md
Last active December 5, 2019 02:18
socks5转换为 http 代理(使用privoxy)

目前只测试了Mac和Ubuntu

1.安装 privoxy

Mac

brew install privoxy

ubuntu

@xwsg
xwsg / ubuntu-Q&A.md
Last active October 15, 2018 12:26
Q&A

1. 无法打开文件浏览器

执行 killall nautilus 后,重新打开

2. apt-get和apt区别在哪?

apt是友好版的apt-get,最大特性就是有进度条了。

3. snap 软件包管理

@xwsg
xwsg / proxychains.md
Last active November 2, 2017 03:29
proxychains安装配置

1. 安装proxychains

sudo apt-get update
sudo apt-get install proxychains

2. 修改配置

@xwsg
xwsg / Java8_lambda_Stream_API.md
Created September 19, 2017 01:42
Java 8 lambda Stream API学习总结

Stream

Stream分为中间操作(Intermediate operations)和终止操作(Terminal operations)

  • Intermediate:一个流可以后面跟随零个或多个 intermediate 操作。其目的主要是打开流,做出某种程度的数据映射/过滤,然后返回一个新的流,交给下一个操作使用。这类操作都是惰性化的(lazy),就是说,仅仅调用到这类方法,并没有真正开始流的遍历。常见操作有 map (mapToInt, flatMap 等)、 filter、 distinct、 sorted、 peek、 limit、 skip、 parallel、 sequential、 unordered。

  • Terminal:一个流只能有一个 terminal 操作,当这个操作执行后,流就被使用“光”了,无法再被操作。所以这必定是流的最后一个操作。Terminal 操作的执行,才会真正开始流的遍历,并且会生成一个结果,或者一个 side effect。常见操作有 forEach、 forEachOrdered、 toArray、 reduce、 collect、 min、 max、 count、 anyMatch、 allMatch、 noneMatch、 findFirst、 findAny、 iterator。

关于Short-circuiting

@xwsg
xwsg / Intellij-Q&A.md
Last active March 9, 2021 01:52
Intellij 常见问题

Intellij IDEA使用过程中经常有些小问题都不知道怎么去问,本文旨在整理一些琐碎的配置。后续会持续增加,如果恰好你也有,欢迎添加。

1.注释和代码缩进对齐

默认是1,实际想要的是2

public class Test {

 public static void main(String[] args) {
@xwsg
xwsg / HTTP-Status-Codes.md
Last active August 31, 2017 03:52
HTTP Status Codes

From https://httpstatuses.com/

  • 1×× Informational
    • 100 Continue
    • 101 Switching Protocols
    • 102 Processing
  • 2×× Success
    • 200 OK
  • 201 Created
@xwsg
xwsg / jenkins-compose.yml
Last active November 2, 2017 03:02
jenkins-compose.yml for jenkins
version: '3'
services:
jenkins:
image: jenkins/jenkins:lts
ports:
- "2017:8080"
- "50000:50000"
volumes:
- /etc/localtime:/etc/localtime:ro
- /etc/timezone:/etc/timezone:ro