Skip to content

Instantly share code, notes, and snippets.

@moods445
moods445 / shell-sub.sh
Created August 4, 2021 07:53
shell 减法
ls -rt | head -$((`ls|wc -l` - 1))
@moods445
moods445 / AopSample.java
Created April 8, 2019 02:35
AOP #spring #java
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Component;
@moods445
moods445 / eureka-client.yml
Created April 3, 2019 02:18
spring cloud FAQ
eureka.instance.hostname: ${spring.cloud.client.ip-address} # 注册中心的地址以 ip:port 的形式存储,否则会在其他主机上出现 localhost 的地址
@moods445
moods445 / application.properties
Created April 2, 2019 09:57
spring boot rabbitmq configurations #Java
# RABBIT (RabbitProperties) https://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html#common-application-properties
spring.rabbitmq.addresses= # Comma-separated list of addresses to which the client should connect.
spring.rabbitmq.cache.channel.checkout-timeout= # Duration to wait to obtain a channel if the cache size has been reached.
spring.rabbitmq.cache.channel.size= # Number of channels to retain in the cache.
spring.rabbitmq.cache.connection.mode=channel # Connection factory cache mode.
spring.rabbitmq.cache.connection.size= # Number of connections to cache.
spring.rabbitmq.connection-timeout= # Connection timeout. Set it to zero to wait forever.
spring.rabbitmq.dynamic=true # Whether to create an AmqpAdmin bean.
spring.rabbitmq.host=localhost # RabbitMQ host.
spring.rabbitmq.listener.direct.acknowledge-mode= # Acknowledge mode of container.
@moods445
moods445 / MyClassLoader
Last active February 13, 2019 02:03
Custom ClassLoader #Java
JarFile jarFile = new JarFile(jarFilePath.toFile());
URLClassLoader jarClassLoader = new URLClassLoader(
new URL[]{jarFilePath.toUri().toURL()},
this.getClass().getClassLoader()
);
Class tClass = Class.forName(className, true, classLoader);
@moods445
moods445 / HttpMethod
Last active June 22, 2019 07:28
Bean validation #Java
package cn.internetware.yancloud.dataretention.schedule.constraints;
import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.*;
/**
*
*/
@Documented