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
| package com.developerb.dropbot; | |
| import com.developerb.dropbot.instrumentation.MethodInvocationTimingInterceptor; | |
| import com.google.inject.AbstractModule; | |
| import com.yammer.metrics.annotation.Timed; | |
| import static com.google.inject.matcher.Matchers.annotatedWith; | |
| import static com.google.inject.matcher.Matchers.any; | |
| /** |
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 MyPoolSizeCalculator extends PoolSizeCalculator { | |
| public static void main(String[] args) throws InterruptedException, | |
| InstantiationException, | |
| IllegalAccessException, | |
| ClassNotFoundException { | |
| MyThreadSizeCalculator calculator = new MyThreadSizeCalculator(); | |
| calculator.calculateBoundaries(new BigDecimal(1.0), | |
| new BigDecimal(100000)); | |
| } |
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
| /** | |
| * A class that calculates the optimal thread pool boundaries. It takes the desired target utilization and the desired | |
| * work queue memory consumption as input and retuns thread count and work queue capacity. | |
| * | |
| * @author Niklas Schlimm | |
| * | |
| */ | |
| public abstract class PoolSizeCalculator { | |
| /** |
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
| if ($request_uri = /) { | |
| set $test A; | |
| } | |
| if ($host ~* teambox.com) { | |
| set $test "${test}B"; | |
| } | |
| if ($http_cookie !~* "auth_token") { | |
| set $test "${test}C"; |
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 ApplicationModule extends AbstractModule { | |
| private final EventBus eventBus = new EventBus("Default EventBus"); | |
| @Override | |
| protected void configure() { | |
| bind(EventBus.class).toInstance(eventBus); | |
| bindListener(Matchers.any(), new TypeListener() { | |
| public <I> void hear(TypeLiteral<I> typeLiteral, TypeEncounter<I> typeEncounter) { | |
| typeEncounter.register(new InjectionListener<I>() { | |
| public void afterInjection(I i) { |
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
| Originally: | |
| https://gist.github.com/7565976a89d5da1511ce | |
| Hi Donald (and Martin), | |
| Thanks for pinging me; it's nice to know Typesafe is keeping tabs on this, and I | |
| appreciate the tone. This is a Yegge-long response, but given that you and | |
| Martin are the two people best-situated to do anything about this, I'd rather | |
| err on the side of giving you too much to think about. I realize I'm being very | |
| critical of something in which you've invested a great deal (both financially |
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
| 1 b java.lang.String::charAt (33 bytes) | |
| 2 b java.lang.Math::max (11 bytes) | |
| 3 b java.util.jar.Manifest$FastInputStream::readLine (167 bytes) | |
| 4 b sun.nio.cs.UTF_8$Decoder::decodeArrayLoop (553 bytes) | |
| 5 b java.util.Properties$LineReader::readLine (383 bytes) | |
| 6 b java.lang.String::hashCode (60 bytes) | |
| 7 b java.lang.String::indexOf (151 bytes) | |
| 8 b sun.nio.cs.ext.DoubleByteDecoder::decodeSingle (10 bytes) | |
| 9 b java.lang.String::lastIndexOf (156 bytes) | |
| 10 b java.lang.String::replace (142 bytes) |
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
| update-rc.d logstash-shipper defaults | |
| update-rc.d logstash-reader defaults |
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
| /* JSONEntity.java | |
| * An utility class to POST json(optionally gzipped) with Apache HttpClient. | |
| * | |
| * Copyright (C) 2011 TAKUMAKei | |
| * | |
| * Licensed under the Apache License, Version 2.0 (the "License"); | |
| * you may not use this file except in compliance with the License. | |
| * You may obtain a copy of the License at | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.0 |
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
| #!/bin/sh | |
| # This program has two feature. | |
| # | |
| # 1. Create a disk image on RAM. | |
| # 2. Mount that disk image. | |
| # | |
| # Usage: | |
| # $0 <dir> <size> | |
| # |