This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The MIT License (MIT) | |
Copyright (c) 2014 Matteo Rinaudo | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is | |
furnished to do so, subject to the following conditions: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env groovy | |
import groovy.json.* | |
/* | |
* usage: | |
* | |
* cd `mktemp -d` | |
* | |
* curl -s -XGET 'http://localhost:9200/_cluster/state?pretty=true&filter_nodes=true&filter_routing_table=true&filter_blocks=true' \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2013-04-23 13:06:41 | |
Full thread dump OpenJDK 64-Bit Server VM (23.7-b01 mixed mode): | |
"Attach Listener" daemon prio=10 tid=0x00007f9f9c019000 nid=0x71a5 waiting on condition [0x0000000000000000] | |
java.lang.Thread.State: RUNNABLE | |
Locked ownable synchronizers: | |
- None | |
"elasticsearch[Dittomaster][search][T#3894]" daemon prio=10 tid=0x00007f9f940b7800 nid=0x7196 waiting on condition [0x00007f9f904e4000] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.concurrent.Callable; | |
import java.util.concurrent.ExecutorService; | |
import java.util.concurrent.Future; | |
import com.google.common.base.Function; | |
import com.google.common.cache.CacheLoader; | |
public class AsyncCacheLoader<K, V> extends CacheLoader<K, Future<V>> { | |
private final ExecutorService _executor; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"analysis": { | |
"char_filter": { | |
"my_mapping": { | |
"type": "mapping", | |
"mappings": [ /* snip */ ] | |
} | |
}, | |
"filter": { | |
"my_stop": { | |
"type": "stop", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"city" : { | |
"properties" : { | |
"country" : { | |
"properties" : { | |
"code" : { | |
"type" : "multi_field", | |
"path" : "just_name", | |
"fields" : { | |
"code" : { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class StringLiterals { | |
public static void main(String[] args) { | |
String s1 = "abc"; // interned by default | |
String s2 = new String(new char[] {'a', 'b', 'c'}); // no chance to intern here | |
System.out.println(s1 == s2); // false | |
System.out.println(s1 == s2.intern()); // true - uses interned s1 | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.IOException; | |
import java.io.StringReader; | |
import java.util.Random; | |
import java.util.Scanner; | |
public class ScannerTest { | |
public static void main(String[] args) throws IOException { | |
int chars = (37 * 1000 * 1000); | |
StringBuilder buf = new StringBuilder(chars); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<dependencies> | |
<dependency> | |
<groupId>at.molindo.social</groupId> | |
<artifactId>spring-social-security</artifactId> | |
<version>1.0.0.BUILD-SNAPSHOT</version> | |
</dependency> | |
<dependency> | |
<groupId>at.molindo.social</groupId> | |
<artifactId>spring-social-facebook-security</artifactId> | |
<version>1.0.0.BUILD-SNAPSHOT</version> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.example; | |
import java.io.Serializable; | |
import org.springframework.social.web.connect.AccountIdExtractor; | |
import org.springframework.web.context.request.RequestAttributes; | |
import org.springframework.web.context.request.WebRequest; | |
// your own User class | |
import org.example.User; |
NewerOlder