I found this in the internet, and I want to share, because sometimes we have a lot of containers in place and we need to stop them, the command for that is this one:
$ docker kill $(docker ps -q)
public List<List<Integer>> permute(int[] nums) { | |
List<List<Integer>> res= new ArrayList(); | |
permute(nums, 0, res); | |
return res; | |
} | |
public static int[][] permute(int[] arr, int index, List<List<Integer>> res){ | |
if (index == arr.length){ | |
List<Integer> r = new ArrayList(); | |
for(int num: arr){ |
public static void main(String[] args) throws NoSuchAlgorithmException, InvalidKeyException { | |
String header = "{\"alg\":\"HS256\",\"typ\":\"JWT\"}"; | |
String payload = "{\"sub\":\"1234567890\",\"name\":\"John Doe\",\"iat\":1516239022}"; | |
String headerBase64 = Base64.encodeBase64URLSafeString(header.getBytes()); | |
String payloadBase64 = Base64.encodeBase64URLSafeString(payload.getBytes()); | |
//Create a secret to create the signature | |
String secret = "your-256-bit-secret"; //this could be anything |
public static void main(String[] args) { | |
int threadCount = Runtime.getRuntime().availableProcessors(); | |
System.out.println("Thread Count:" + threadCount); | |
ExecutorService executorService = Executors.newFixedThreadPool(threadCount); | |
Scheduler scheduler = Schedulers.from(executorService); | |
Observable.fromArray(buildNetworkUriCalls("oi").toArray()) | |
.flatMap(url -> getNetworkFutureAndObservable(url) | |
.subscribeOn(scheduler) |
I found this in the internet, and I want to share, because sometimes we have a lot of containers in place and we need to stop them, the command for that is this one:
$ docker kill $(docker ps -q)
tasks.withType(Checkstyle).each { checkstyleTask -> | |
checkstyleTask.doLast { | |
reports.all { report -> | |
def errors = 0 | |
def threshold = 1 | |
def outputFile = report.destination | |
outputFile.text.eachLine { | |
if (it.contains("<error ")) { | |
errors++ | |
} |
To use this configuration you will need to have the idea gradle plugin installed on your build.gradle and import this file.
This file will add in your project the following configuration:
<component name="GradleSettings"> | |
<option name="linkedExternalProjectsSettings"> | |
<GradleProjectSettings> | |
<option name="distributionType" value="DEFAULT_WRAPPED" /> | |
<option name="externalProjectPath" value="$PROJECT_DIR$" /> | |
<option name="gradleJvm" value="#JAVA_HOME" /> | |
<option name="modules"> | |
<set> | |
<option value="$PROJECT_DIR$" /> | |
</set> |
package com.willmenn.rxjava; | |
import org.springframework.util.StopWatch; | |
import rx.Observable; | |
import rx.Scheduler; | |
import rx.schedulers.Schedulers; | |
import java.util.List; | |
import java.util.concurrent.ExecutorService; | |
import java.util.concurrent.Executors; |
package db.migration; | |
import org.flywaydb.core.api.configuration.ConfigurationAware; | |
import org.flywaydb.core.api.configuration.FlywayConfiguration; | |
import org.flywaydb.core.api.migration.spring.SpringJdbcMigration; | |
import org.springframework.jdbc.core.JdbcTemplate; | |
public class V1_1__MigrationExample implements SpringJdbcMigration, ConfigurationAware { | |
public class BootstrapApp { | |
public static void main(String[] args) throws Exception { | |
ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS); | |
addContextPath(context); | |
addServlets(context); | |
addFilters(context); | |
buildAndStartServer(context); |