Skip to content

Instantly share code, notes, and snippets.

@arey
arey / select_musicbrainz_u2_album
Created October 2, 2013 06:54
SQL query retrieving all U2 album from the MusicBrainz database.
SELECT
release_group.gid AS albumid,
release_group.type AS albumPrimaryTypeId,
release_group_primary_type.name as albumPrimaryTypeName,
release_name.name AS albumName,
artist_name.name AS artistName,
artist.gid AS artistGid,
artist.type as artisTypeId,
artist_type.name as artistTypeName,
artist.begin_date_year artistBeginDateYear,
@arey
arey / u2_archtung_baby.json
Created November 10, 2013 12:17
JSON document indexed into Elasticsearch (ref. https://github.com/arey/musicbrainz-elasticsearch)
{
"id": "744c7a1b-ac79-35c4-bd92-7e2c6a24c8d8",
"name": "Achtung Baby",
"year": 1991,
"tags": [
"rock",
"pop rock",
"pop",
"album rock",
"90s"
@arey
arey / musicbrainz_autocomplete _u2.sh
Last active December 28, 2015 03:39
Search query that could be used for completion suggestions on the MusicBrainz Elasticsearch index created by the batch provided in the https://github.com/arey/musicbrainz-elasticsearch repository.
curl -XPOST 'http://es.javaetmoi.com/musicalbum/album/_search?pretty' -d '
{
"fields": [
"artist.name",
"id",
"name",
"year.string"
],
"query": {
"query_string": {
@arey
arey / musicbrainz_fulltext _u2_war.sh
Created November 12, 2013 19:11
Full text search example on the MusicBrainz Elasticsearch index created by the batch provided in the https://github.com/arey/musicbrainz-elasticsearch repository.
curl -XPOST 'http://es.javaetmoi.com/musicalbum/album/_search?pretty' -d '
{
"from": 0,
"size": 10,
"query": {
"bool": {
"must": [
{
"fuzzy_like_this": {
"fields": [
@arey
arey / JarFileClassPathLocationScanner
Created January 21, 2014 11:04
Flyway JarFileRecursiveClassPathLocationScanner for jar files opening all war and jar recursively.
package com.googlecode.flyway.core.util.scanner.classpath;
import java.io.IOException;
import java.io.InputStream;
import java.net.JarURLConnection;
import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLConnection;
import java.util.Enumeration;
import java.util.Set;
@arey
arey / LogbackListener.java
Created March 30, 2018 16:34
Java Logback configuration replacing classic logback.xml use
package com.javaetmoi.logback;
import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.Logger;
import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.classic.encoder.PatternLayoutEncoder;
import ch.qos.logback.classic.joran.action.JMXConfiguratorAction;
import ch.qos.logback.classic.jul.LevelChangePropagator;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.Appender;
@arey
arey / applicationContext-mockito.xml
Created August 26, 2013 13:55
Injecting Mockito mocks into a Spring bean Avoid NoSuchBeanDefinitionException
<bean id="myService" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="target">
<bean class="org.mockito.Mockito" factory-method="mock">
<constructor-arg
value="com.javaetmoi.IService" />
</bean>
</property>
<property name="proxyInterfaces">
<value>com.javaetmoi.IService</value>
</property>