Skip to content

Instantly share code, notes, and snippets.

View codethereforam's full-sized avatar
:octocat:
Focusing

thinkam codethereforam

:octocat:
Focusing
View GitHub Profile
@codethereforam
codethereforam / SuppliersTest.java
Created March 25, 2024 02:26
使用Guava实现延迟调用并且缓存第一次调用的值
@Test
void t3() {
Supplier<Long> s = Suppliers.memoize(this::tt);
System.out.println("---------1");
System.out.println(s.get());
System.out.println("---------2");
System.out.println(s.get());
System.out.println("---------3");
System.out.println(s.get());
System.out.println("---------4");
@codethereforam
codethereforam / ConcatList.java
Created March 15, 2024 02:17
Java合并两个集合
Lists.newArrayList(Iterables.concat(list1, list2));
@codethereforam
codethereforam / Windows任务的使用场景.md
Created March 12, 2024 13:55
Windows任务的使用场景
  1. 每天定时执行一个签到脚本
  2. 每当电脑从睡眠中唤醒时执行一个脚本
@codethereforam
codethereforam / idea.properties
Created March 6, 2024 02:33
IDEA自定义配置
# custom IntelliJ IDEA properties (expand/override 'bin\idea.properties')
# 指定scratch的路径包括.http文件和Database写的.sql文件
idea.scratch.path=/xxx
@codethereforam
codethereforam / Export.java
Created February 27, 2024 09:10
Spring导出文件
private ResponseEntity<byte[]> getExportResponse(String fileName, String exportContent) {
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
headers.setContentDispositionFormData("attachment", URLEncoder.encode(fileName, StandardCharsets.UTF_8));
return new ResponseEntity<>(exportContent.getBytes(StandardCharsets.UTF_8), headers, HttpStatus.OK);
}
@codethereforam
codethereforam / DisableEnableWiFiCard.bat
Created February 25, 2024 07:35
refresh wifi on Windows
netsh interface set interface "WLAN" disabled
netsh interface set interface "WLAN" enabled
@codethereforam
codethereforam / idea_method_log.md
Last active November 24, 2023 06:47
idea live template记录方法参数日志
  1. groovy脚本
groovyScript("def result=\"${_1}\" + '() '; def result1=''; def params=\"${_2}\".replaceAll('[\\\\[|\\\\]|\\\\s]', '').split(',').toList(); for(i = 0; i < params.size(); i++) {     result1 += ', ' + params[i];     if (i==0) {         result+= params[i] + ': {}, ';      } else {         result+= params[i] + ': {}, ';      } };  return '\"' + result + '\"' + result1;  ", methodName(), methodParameters());}} 
  1. Template Text: log.debug($logText$);
@codethereforam
codethereforam / start-google-driver.bat
Last active August 27, 2023 13:54
Windows系统下Google Drive开机启动
start /B proxychains "C:\Program Files\Google\Drive File Stream\79.0.2.0\GoogleDriveFS.exe"
@codethereforam
codethereforam / nodepad_replace.txt
Created August 11, 2023 15:58
nodepad++ delete all except find
我有以下内容:
2. **pajama pants** ['pəˈdʒɑːmə pænts]: 睡裤(裤子)。
3. **take advantage of**: 利用,充分利用。
用nodepad++删除pajama pants、take advantage of以外的内容
替换正则 .*\*\*(.*)\*\*.* 为 $1
@codethereforam
codethereforam / RollbackInsertSQL.java
Created June 14, 2023 08:47
根据insert sql生成回滚的delete sql
import java.io.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* 根据insert sql生成回滚的delete sql
*
* @author yanganyu
* @date 2023-06-24
*/