Skip to content

Instantly share code, notes, and snippets.

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

ZanyZoe codethereforam

:octocat:
Focusing
View GitHub Profile
@codethereforam
codethereforam / DateConvertConfig.java
Created November 6, 2019 11:46
Spring LocalDateTime时间转换配置
/**
* 时间转换配置
*
* @author yanganyu
* @date 2019/9/23 17:05
*/
@Configuration
public class DateConvertConfig {
/**
* LocalDate转换器,用于转换RequestParam和PathVariable参数
@codethereforam
codethereforam / idea-todo.md
Created October 29, 2019 06:32
idea查看自己标记的todo
  1. 添加pattern: "\b(todo|fixme)!.*"
  2. 添加filter: 选择刚配置的pattern,命名mine
  3. todo视图中筛选mine
@codethereforam
codethereforam / FooMapper.java
Created October 28, 2019 11:56
Mybatis查询是否存在
Integer exist(Map<String, Object> paramMap);
@codethereforam
codethereforam / AesUtil.java
Created October 21, 2019 11:59
AES加密解密工具
/**
* AES utility
*
* @author yanganyu
* @date 2019/9/18 21:01
*/
public class AesUtil {
private static SecretKeySpec secretKey;
private AesUtil() {
@codethereforam
codethereforam / Export.java
Created October 21, 2019 11:33
Java导出文件名含中文乱码解决
response.setContentType("text/plain; charset=UTF-8");
String encodedFileName = new String("中文".getBytes(), StandardCharsets.ISO_8859_1);
response.addHeader("Content-Disposition","attachment; filename=" + encodedFileName);
@codethereforam
codethereforam / install.md
Last active October 17, 2019 13:46
win10环境VirtualBox安装并初始化Ubuntu18.04 server

准备

  • 安装'Windows Terminal'
  • 安装WSL
  • 安装VirtualBox

安装

  1. 虚拟磁盘映像文件选择创建在SSD(如果有)
  2. 选择openssh,公钥从GitHub获取,前提是GitHub已经上传了本机的公钥
  3. 更新软件:apt update, apt upgrade, apt autoremove
@codethereforam
codethereforam / enable-springboot-shutdown-endpoint.md
Created September 10, 2019 05:54
enable springboot shutdown endpoint
  1. add maven dependency
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
  1. modify application.properties(.yml)
  • springboot1
@codethereforam
codethereforam / HashUtil.java
Created August 21, 2019 10:09
字符串哈希取余
/**
* 哈希取余
*
* @param key 要处理的字符串
* @param prime 质数
* @return 余数([0, prime - 1]中的整数)
* @author yanganyu
* @date 2019/7/17 10:02
*/
public static int hashcodeMod(String key, int prime) {
@codethereforam
codethereforam / UpdateDiffer.java
Created August 21, 2019 10:03
对象更新比较器
/**
* 对象更新比较器
*
* @param <T> 待比较的对象类型
* @author yanganyu
* @date 2019/7/26
*/
public final class UpdateDiffer<T> {
/**
* 原来的对象
@codethereforam
codethereforam / SpringExecutors.java
Created August 21, 2019 08:59
提供一些构造spring的ThreadPoolTaskExecutor的静态工厂方法,模仿JDK中的Executors
/**
* 提供一些构造spring的ThreadPoolTaskExecutor的静态工厂方法,模仿JDK中的Executors
*
* @author yanganyu
* @date 2019/8/21 16:23
*/
public class SpringExecutors {
private SpringExecutors() {
}