Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
// Usage example... | |
HttpsURLConnection connection = (HttpsURLConnection) new URL("https://someurl.com").openConnection(); | |
connection.setSSLSocketFactory(buildSslSocketFactory()); | |
private static SSLSocketFactory buildSslSocketFactory(Context context) { | |
// Add support for self-signed (local) SSL certificates | |
// Based on http://developer.android.com/training/articles/security-ssl.html#UnknownCa | |
try { | |
#!/bin/sh | |
# set the configuration variables below, before running the script | |
# get the solr nightly build download link from https://builds.apache.org/job/Solr-Artifacts-4.x/lastSuccessfulBuild/artifact/solr/package/ | |
JETTY_URL="http://eclipse.org/downloads/download.php?file=/jetty/stable-9/dist/jetty-distribution-9.0.5.v20130815.tar.gz&r=1" | |
JETTY_HOME="/opt/jetty" | |
JAVA='/usr/local/jdk1.7.0_09/bin/java' | |
JETTY_PORT=8085 | |
JETTY_HOST=127.0.0.1 |
description "service" | |
start on filesystem | |
stop on runlevel S | |
respawn | |
respawn limit 10 5 | |
oom never | |
kill timeout 86400 #If it's given a stop order, this is how long it will take to stop. |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
import com.yourkit.probes.*; | |
import com.yourkit.api.*; | |
@MethodPattern("scala.tools.nsc.Global$Run:advancePhase()") | |
public class MemoryProbe { | |
public static void onEnter(@This scala.tools.nsc.Global.Run run) { | |
scala.reflect.internal.Phase patmatPhase = run.phaseNamed("patmat"); | |
scala.reflect.internal.Phase postErasurePhase = run.phaseNamed("posterasure"); | |
scala.reflect.internal.Phase icodePhase = run.phaseNamed("icode"); |
Moved to: https://github.com/bmfurtado/iterm2-cssh |
//First create the httpClient in Dropwizard's run method as documented | |
final HttpClient httpClient = new HttpClientBuilder().using(configuration.getHttpClient()).build(); | |
try { | |
//Create KeyStore obejcts for both the keystore and truststore | |
KeyStore keystore = KeyStore.getInstance(KeyStore.getDefaultType()); | |
KeyStore truststore = KeyStore.getInstance(KeyStore.getDefaultType()); | |
//Then load the actual keystore/truststore file(s), they are the same file in my case | |
keystore.load(new FileInputStream(configuration.getKeyStore()), configuration.getKeyStorePassword().toCharArray()); |
/* Extend the Underscore object with the following methods */ | |
// Rate limit ensures a function is never called more than every [rate]ms | |
// Unlike underscore's _.throttle function, function calls are queued so that | |
// requests are never lost and simply deferred until some other time | |
// | |
// Parameters | |
// * func - function to rate limit | |
// * rate - minimum time to wait between function calls | |
// * async - if async is true, we won't wait (rate) for the function to complete before queueing the next request |
@Override | |
public ServletContainer getJerseyContainer(DropwizardResourceConfig resourceConfig, | |
MyServiceConfig serviceConfig) { | |
// I like having a root module, but you can use as many as you like | |
final Injector injector = Guice.createInjector(new MyServiceModule(serviceConfig)); | |
return new GuiceContainer(injector) { | |
@Override | |
public ResourceConfig getDefaultResourceConfig(Map<String,Object> props, WebConfig webConfig) { |
# stacktrace java as one message | |
multiline { | |
#type => "all" # no type means for all inputs | |
pattern => "(^.+Exception: .+)|(^\s+at .+)|(^\s+... \d+ more)|(^\s*Caused by:.+)" | |
what => "previous" | |
} | |