Skip to content

Instantly share code, notes, and snippets.

@avvero
avvero / logback.groovy
Created January 11, 2018 08:04
status listener for #logback
import ch.qos.logback.classic.AsyncAppender
import ch.qos.logback.core.status.OnConsoleStatusListener
import static ch.qos.logback.classic.Level.*
import static ch.qos.logback.core.spi.FilterReply.DENY
statusListener(OnConsoleStatusListener)
appender("flow", com.github.avvero.flow.support.logback.MarkerSocketAppender) {
remoteHost = "localhost"
@avvero
avvero / main.java
Created December 27, 2017 10:15
Read resource from #jar to ger rid of #URI is not #hierarchical
public static final String FEATURE = "group_distribution.feature";
// src/main/resources/group_distribution.feature
InputStream in = this.getClass().getClassLoader().getResourceAsStream(FEATURE);
String feature = IOUtils.toString(in, Charset.defaultCharset());
@avvero
avvero / run_with_debug.md
Created December 27, 2017 10:08
#debug for #java
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005

example

java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 <YourAppName>
exec "$JAVACMD" "${JVM_OPTS[@]}" -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 -classpath "$CLASSPATH" pw.avvero.crools.Application "$@"
@avvero
avvero / Tests.groovy
Created December 7, 2017 06:09
replace service with #mock in #spring #test
@Autowired
private UserEventService userEventService
@Configuration
public static class MockConfiguration {
@Bean
@Primary
@Profile("test")
UserEventService userEventService() {
return Mockito.mock(UserEventService.class)
@avvero
avvero / HealthEndpoint.java
Created December 7, 2017 05:45
add new #spring #endpoint
@Component
public class HealthEndpoint {
private static final String ENDPOINT_NAME = "health";
private Map<String, Map> info = new HashMap<>();
@Bean
public Endpoint healthEndpoint() {
return new Endpoint<String>() {
@Override
@avvero
avvero / build.gradle
Created December 7, 2017 04:29
add #jacoco to #gradle
apply plugin: 'jacoco'
jacoco {
toolVersion = "0.7.4.201502262128"
}
@avvero
avvero / build.groovy
Created November 24, 2017 01:32
#cxf #dependencies
compile 'org.eclipse.jetty:jetty-http:9.2.21.v20170120'
compile 'org.apache.ws.security:wss4j:1.6.12'
compile 'org.apache.cxf:cxf-rt-databinding-aegis:3.2.1'
compile 'org.apache.cxf:cxf-rt-frontend-jaxws:3.2.1'
compile 'org.apache.cxf:cxf-rt-rs-client:3.2.1'
compile 'org.apache.cxf:cxf-rt-ws-security:3.2.1'
compile 'org.apache.cxf:cxf-rt-rs-service-description:3.2.1'
compile 'org.apache.cxf:cxf-rt-rs-service-description-swagger:3.2.1'
compile 'org.apache.cxf:cxf-rt-transports-http-jetty:3.2.1'
@avvero
avvero / instructions.md
Created November 2, 2017 08:47
#ssh #bookmarks
nano ~/.ssh/config
#### thelinuxfaq ######
host thelinuxfaq
hostname host.thelinuxfaq.com
user user_name
port 1234
@avvero
avvero / style.css
Created November 2, 2017 08:30
#spinner for #pending request
.pending:after {
content: "";
position: fixed;
width: 30px;
height: 30px;
top: 50%;
left: 50%;
margin: -20px 0 0 -20px;
z-index: 5;
border: 5px solid #000;
@avvero
avvero / create_db.sql
Created October 22, 2017 10:58
#sql #mysql #create #db
CREATE DATABASE IF NOT EXISTS `f2g` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
USE `f2g`;