Skip to content

Instantly share code, notes, and snippets.

View jmbataller's full-sized avatar

Jose Miguel Bataller jmbataller

View GitHub Profile
@jmbataller
jmbataller / gist:91a534f83dbde1a17350
Created November 30, 2015 10:47
Extract public key from pem private key
Extract public key from pem private key
ssh-keygen -y -f KEYFILE.pem
@jmbataller
jmbataller / gist:1f01a2a68bfbdee4453c
Created December 6, 2015 00:04
safe navigator in java 8
public String getCarInsuranceName(Optional<Person> person) {
return person.flatMap(Person::getCar)
.flatMap(Car::getInsurance)
.map(Insurance::getName)
.orElse("Unknown");
}
@jmbataller
jmbataller / CorsSupport.scala
Created December 7, 2015 14:08 — forked from joseraya/CorsSupport.scala
CORS directive for Spray
package com.agilogy.spray.cors
import spray.http.{HttpMethods, HttpMethod, HttpResponse, AllOrigins}
import spray.http.HttpHeaders._
import spray.http.HttpMethods._
import spray.routing._
// see also https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS
trait CORSSupport {
this: HttpService =>
@jmbataller
jmbataller / gist:f15af67d94cc4446a002
Created December 16, 2015 12:28
Purge messages in ActiveMQ using the command line
Purge messages using the activemq-admin command line:
activemq-admin purge --jmxurl service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi --jmxuser camel --jmxpassword password purge com.test.queue.dlq
JMX needs to be enabled to purge messages, check ./conf/activemq.xml has the createConnector enabled:
<managementContext>
<managementContext createConnector="true"/>
</managementContext>
@jmbataller
jmbataller / gist:6e7eecf07dbfae35e890
Last active December 16, 2015 13:39
Checkout pull request
Checkout pull request
git fetch origin pull/<pull request number>/head:<destination branch>
git checkout <destination branch>
@jmbataller
jmbataller / clean-up.sh
Created April 28, 2016 16:21
Remove all docker images and containers
#!/bin/bash
# Delete all containers
docker rm $(docker ps -a -q)
# Delete all images
docker rmi $(docker images -q)
@jmbataller
jmbataller / gist:ce9dea29a9ba58286ea9b947dcbe4106
Last active May 19, 2016 13:56
Sample of logstash configuration file
Logstash config file for log4j2 pattern:
[%d{dd/MM/yyyy HH:mm:ss.SSS}][SERVICE_NAME][%-5level][%t]:[%X{correlation-id}][%c{1}.%M:%L] - %m%n
Run logstash:
> bin/logstash -f conf/logstash-syslog.conf --auto-reload
---
@jmbataller
jmbataller / gist:6655f0148f90e44d5bd7fc61c17a29f7
Created June 21, 2016 09:20
Maven - analyze dependencies
Looks at the dependencies after final resolution and looks for mismatches in your dependencyManagement section:
> mvn dependency:analyze-dep-mgt
Resolving conflicts with dependency tree:
> mvn dependency:tree -Dverbose -Dincludes=commons-collections
More info: http://maven.apache.org/plugins/maven-dependency-plugin/examples/resolving-conflicts-using-the-dependency-tree.html
@jmbataller
jmbataller / gist:7db7cec4bbecf2c55bed251898d49644
Created September 15, 2016 10:28
filter by class in log4j2
<Loggers>
<logger name="org.springframework.boot.actuate.metrics.statsd.StatsdMetricWriter" additivity="false" level="error">
<appender-ref ref="console_appender" />
</logger>
<Root level="trace">
<AppenderRef ref="console_appender" level="debug"/>
</Root>
</Loggers>

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites