This file contains hidden or 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.Collection; | |
| import java.util.Map; | |
| import org.elasticsearch.common.collect.ArrayListMultimap; | |
| import org.elasticsearch.common.collect.Multimap; | |
| import org.elasticsearch.common.hash.Hashing; | |
| import org.junit.Test; | |
| public class ConsistentHashingTest { |
This file contains hidden or 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 BufferedReader extends Reader { | |
| private static final int BUFFER_CAPACITY = 64 * 1024; //64k | |
| private List<CharBuffer> buffers = new ArrayList<>(); | |
| private int bufferIdx = 0; | |
| public BufferedReader() { | |
| this.buffers = new ArrayList<>(); |
This file contains hidden or 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
| for line in `docker ps | awk '{print $1}' | grep -v CONTAINER`; do \ | |
| echo $(( `cat /sys/fs/cgroup/memory/docker/$line*/memory.usage_in_bytes` / 1024 / 1024 ))MB \ | |
| $(docker ps | grep $line | awk '{printf $NF" "}') ; \ | |
| done | sort -n |
This file contains hidden or 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
| VER=0.0.1 grep -lRZ --include *.xml $VER-SNAPSHOT . | xargs -0 -l sed -i -e s/$VER-SNAPSHOT/$VER/ | |
| VER=0.0.1 grep -lRZ --include *.conf $VER-SNAPSHOT . | xargs -0 -l sed -i -e s/$VER-SNAPSHOT/$VER/ |
This file contains hidden or 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
| server { | |
| listen 80; | |
| root /usr/share/nginx/html; | |
| index index.html index.htm; | |
| # Make site accessible from http://localhost/ | |
| server_name demo.com; | |
| location = / { |
This file contains hidden or 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
| @BeforeClass | |
| public static void setupTestClass() { | |
| ConsoleAppender console = new ConsoleAppender(); //create appender | |
| //configure the appender | |
| String PATTERN = "%d [%p] %c - %m%n"; | |
| console.setLayout(new PatternLayout(PATTERN)); | |
| console.setThreshold(Level.TRACE); | |
| console.activateOptions(); | |
| //add appender to any Logger (here is root) | |
| Logger.getRootLogger().addAppender(console); |
This file contains hidden or 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.net.InetSocketAddress; | |
| import java.net.Socket; | |
| import java.nio.ByteBuffer; | |
| import java.nio.channels.SelectionKey; | |
| import java.nio.channels.Selector; | |
| import java.nio.channels.ServerSocketChannel; | |
| import java.nio.channels.SocketChannel; | |
| import java.util.concurrent.CountDownLatch; |
This file contains hidden or 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
| SELECT | |
| table_schema, | |
| table_name, | |
| SUM(data_length + index_length)/1024/1024 AS size | |
| FROM information_schema.tables | |
| GROUP BY table_schema, table_name | |
| ORDER BY 3 DESC; |
This file contains hidden or 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
| du -sh ./* |
This file contains hidden or 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
| SELECT * | |
| FROM v$locked_object l, dba_objects o | |
| WHERE l.object_id = o.object_id | |
| ORDER BY o.object_id, 1 desc |
NewerOlder