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
author "Your Name" | |
description "upstart script for sample-dw-service" | |
# respawn the job up to 5 times within a 10 second period. | |
# If the job exceeds these values, it will be stopped and | |
# marked as failed. | |
respawn | |
respawn limit 5 10 | |
# move to this service's working directory |
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
// fetch the relevant plugin code | |
buildscript { | |
repositories { | |
mavenCentral() | |
} | |
dependencies { | |
classpath 'eu.appsatori:gradle-fatjar-plugin:0.2-rc1' | |
classpath 'com.kenshoo:gradle-fpm:+' | |
} | |
} |
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 ch.qos.logback.classic.Logger; | |
import ch.qos.logback.classic.LoggerContext; | |
import ch.qos.logback.classic.spi.ILoggingEvent; | |
import com.yammer.dropwizard.ConfiguredBundle; | |
import com.yammer.dropwizard.config.Bootstrap; | |
import com.yammer.dropwizard.config.Environment; | |
import com.yammer.dropwizard.logging.AsyncAppender; | |
import me.moocar.logbackgelf.GelfAppender; | |
import org.slf4j.LoggerFactory; |
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
# sets up a dropwizard-based service packaged as debian | |
# requires: puppetlabs-apt, puppetlabs-stdlib | |
class sample-dw-service ( | |
$version='latest', # you can pass a specified version, default is latest | |
$db_url='' # this is how you pass environment-specific configuration - in this case, a DB URL | |
) { | |
# refresh apt | |
notify { "refreshing apt": | |
notify => Class['apt::update'], |
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
package com.kenshoo.test; | |
import ch.qos.logback.classic.Level; | |
import ch.qos.logback.classic.Logger; | |
import ch.qos.logback.classic.spi.ILoggingEvent; | |
import ch.qos.logback.classic.spi.IThrowableProxy; | |
import ch.qos.logback.core.Appender; | |
import org.junit.rules.TestRule; | |
import org.junit.runner.Description; | |
import org.junit.runners.model.Statement; |
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 ch.qos.logback.classic.Level; | |
import com.kenshoo.test.LogbackVerifier; | |
import org.junit.Rule; | |
import org.junit.Test; | |
public class MyTest { | |
@Rule | |
public LogbackVerifier logbackVerifier = new LogbackVerifier(); |
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
package com.kenshoo.rtb.tools; | |
import org.junit.Test; | |
import static junit.framework.Assert.assertTrue; | |
import static org.mockito.Mockito.mock; | |
import static org.mockito.Mockito.when; | |
/** | |
* Created by IntelliJ IDEA. |
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 class Spiderman { | |
public int spiderman(int n) { | |
// we're going to calculate these for each floor, starting from first floor: | |
int waysToGetToThisFloorByJumpingTwoFloors = 0; // there's no -1 floor, so there's no way to jump two floors and get to first floor | |
int waysToGetToThisFloorDirectlyFromPreviousFloor = 1; // there's one way to get from 0 to 1 | |
int totalWaysToGetToThisFloor = 0; | |
for (int floor=1; floor <= n; floor++) { | |
// total ways = sum of ways ending with a big jump (2 floors) and ways ending with a small jump (1 floor): |
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
local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ %s)" | |
PROMPT='⌚ %{$fg_bold[red]%}%*%{$reset_color%} ${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' | |
ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}" | |
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" | |
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%}" | |
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})" |
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 com.codahale.metrics.MetricRegistry; | |
import io.dropwizard.db.DataSourceFactory; | |
import io.dropwizard.jackson.Jackson; | |
import io.dropwizard.jdbi.DBIFactory; | |
import io.dropwizard.setup.Environment; | |
import liquibase.Liquibase; | |
import liquibase.database.jvm.JdbcConnection; | |
import liquibase.exception.LiquibaseException; | |
import liquibase.resource.ClassLoaderResourceAccessor; | |
import org.junit.rules.ExternalResource; |
OlderNewer