Skip to content

Instantly share code, notes, and snippets.

View avarabyeu's full-sized avatar

Andrei Varabyeu avarabyeu

View GitHub Profile
@avarabyeu
avarabyeu / gist:a823dd8460da18460557
Created July 24, 2014 17:20
[smarttested] Email Interface
public class Email {
private String from;
private String to;
private String subject;
private String body;
}
@avarabyeu
avarabyeu / 0_reuse_code.js
Created August 14, 2014 08:18
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@avarabyeu
avarabyeu / CustomSparkFilter.java
Created October 23, 2014 15:04
Custom spark filter with ServletContextListener implementation
@WebFilter(urlPatterns = {"/*"})
@WebListener
public class YourCustomFilter extends SparkFilter implements ServletContextListener {
@Override
protected SparkApplication getApplication(FilterConfig filterConfig) throws ServletException {
return //your SparkApplication;
}
@Override
@avarabyeu
avarabyeu / CachedModuleFactory.java
Last active August 29, 2015 14:14
Cache Guice Injector with TestNG
/**
* @author Andrei Varabyeu
*/
public abstract class CachedModuleFactory implements IModuleFactory {
private static volatile Injector parentInjector;
private static final Object LOCK = new Object();
private Injector getParentInjector() {
@avarabyeu
avarabyeu / CachedModuleFactory.java
Created February 3, 2015 14:05
Cache Guice Injector with TestNG (another way)
/**
* @author Andrei Varabyeu
*/
public abstract class CachedModuleFactory implements IModuleFactory {
/* delegate creating and holding of parent injector to subclass */
abstract protected Injector getParentInjector();
abstract protected Module createTestModule(ITestContext context, Class<?> testClass);
@avarabyeu
avarabyeu / CachedModuleFactory.java
Last active August 29, 2015 14:14
Cache Guice Injector with TestNG (best way)
/**
* @author Andrei Varabyeu
*/
public abstract class CachedModuleFactory<T extends Module> implements IModuleFactory {
private static final Cache<Class<? extends Module>, Injector> CACHE =
CacheBuilder.<Class<? extends Module>, Injector>newBuilder().build();
private final Callable<Injector> INJECTOR_LOADER = new Callable<Injector>() {
@Override
@avarabyeu
avarabyeu / docker-compose.yml
Last active September 14, 2016 16:47
Example of Docker Compose descriptor for ReportPortal
## This is example of Docker Compose for ReportPortal
## Do not forget to configure data volumes for production usage
## Execute 'docker-compose -p reportportal up -d --force-recreate'
## to start all containers in daemon mode
## Where:
## '-p reportportal' -- specifies container's prefix (project name)
## '-d' -- enables daemon mode
## '--force-recreate' -- forces re-recreating of all containers
@avarabyeu
avarabyeu / rp-eureka-js.js
Created November 10, 2016 17:12
rp-eureka-js.js
const Eureka = require('eureka-js-client').Eureka;
const client = new Eureka({
// application instance information
instance: {
app: 'ui',
hostName: 'localhost',
port: {
"$": 8080,
"@enabled": "true"
@avarabyeu
avarabyeu / SocksExtensionModule.java
Last active January 10, 2017 12:17
RP socks proxy
public class SocksExtensionModule extends AbstractModule {
@Override
protected void configure() {
}
@Provides
public HttpClient provideHttpClient(@ListenerPropertyValue(ListenerProperty.UUID) String uuid) throws MalformedURLException {
HttpClientFactory httpClientFactory;
List<HttpRequestInterceptor> interceptors = new ArrayList<HttpRequestInterceptor>(1);
@avarabyeu
avarabyeu / grafana_setup.sh
Created August 28, 2017 18:18
grafana_setup.sh
#!/bin/bash
./run.sh "${@}" &
timeout 10 bash -c "until </dev/tcp/localhost/3000; do sleep 1; done"
curl -s -H "Content-Type: application/json" \
-XPOST http://admin:admin@localhost:3000/api/datasources \
-d @- <<EOF
{
"name": "influx",