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
/* | |
* This script will download a package (and all of its dependencies) from the | |
* online NPM registry, then create a gzip'd tarball containing that package | |
* and all of its dependencies. This archive can then be copied to a machine | |
* without internet access and installed using npm. | |
* | |
* The idea is pretty simple: | |
* - npm install [package] | |
* - rewrite [package]/package.json to copy dependencies to bundleDependencies | |
* - npm pack [package] |
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 org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; | |
import javax.net.ssl.HttpsURLConnection; | |
import javax.net.ssl.SSLContext; | |
import javax.net.ssl.TrustManager; | |
import javax.net.ssl.X509TrustManager; | |
import java.security.cert.CertificateException; | |
import java.security.cert.X509Certificate; |
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
class EmbeddedMQBroker { | |
public static final String ACTIVEMQ_URL = "vm://localhost"; | |
private static Logger logger = LoggerFactory.getLogger(EmbeddedMQBroker.class); | |
Connection connection; | |
BrokerService broker; | |
private EmbeddedMQBroker(final String url) { | |
//Keep alive mq connection to stop ActiveMq from shutting down automatically. |
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
#!/bin/bash | |
URL_TO_VERIFY=$1 | |
EXPECTED_HTTP_CODE="200" | |
echo "Verifying '${URL_TO_VERIFY}' on $(hostname)" | |
RESULT=$(wget -O/dev/null --retry-connrefused -S "${URL_TO_VERIFY}" 2>&1 | grep "HTTP/" | cut -d' ' -f4) | |
if [ "$?" -ne "0" ]; then | |
echo "Unable to connect to '${URL_TO_VERIFY}" |
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
export PS1="\u@\h:\W\[$(tput sgr0)\]$ " |
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
withPooledSAXParser { SAXParser saxParser -> | |
def slurped = new XmlSlurper(saxParser).parseText(documentString); | |
} |
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 static int availablePort() { | |
int port = 0; | |
try (ServerSocket serverSocket = new ServerSocket(port)) { | |
port = serverSocket.getLocalPort(); | |
} catch (IOException e) { | |
throw new IllegalStateException("Unable to get available port"); | |
} | |
return port; | |
} |
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
static int availablePort() { | |
final ServerSocket serverSocket = new ServerSocket(0) | |
serverSocket.withCloseable { | |
return serverSocket.getLocalPort(); | |
} | |
} | |
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
#!/bin/bash | |
die() { | |
echo $1 | |
echo "Usage: $0 application environment date" | |
echo "environment is TEST/BETA/DEMO/PROD" | |
echo "date pattern is yyyy-MM-dd" | |
exit 1 | |
} |
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
private final static Set<ILoggingEvent> loggingEvents = [] as Set | |
private void reset() { | |
loggingEvents.clear() | |
initializeMockLogAppender(); | |
} | |
public void assertOneErrorLogEvent(String expectedMessage) { | |
assert loggingEvents.size() == 1 | |
assert loggingEvents.first().getThrowableProxy().message == expectedMessage |
NewerOlder