Skip to content

Commit

Permalink
add jmon, add to parsers (zfs and smartctl), add svn-client-wrapper, …
Browse files Browse the repository at this point in the history
…plus some minor stuff
  • Loading branch information
jjYBdx4IL authored and jjYBdx4IL committed Jun 6, 2021
1 parent 92d2d8b commit befd53e
Show file tree
Hide file tree
Showing 97 changed files with 5,575 additions and 285 deletions.
12 changes: 0 additions & 12 deletions .travis.sh

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ mvn clean install -Psite-archive -N
--
devel/java/github/misc@7856
devel/java/github/misc@7872
6 changes: 3 additions & 3 deletions cms-it/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<version>2.0.0.Final</version>
<version>2.0.2.Final</version>
<executions>
<execution>
<id>start-server</id>
Expand Down Expand Up @@ -124,7 +124,7 @@
<failIfNoTests>true</failIfNoTests>
</configuration>
</plugin>
<plugin>
<!-- <plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
Expand Down Expand Up @@ -163,7 +163,7 @@
<version>20020829</version>
</dependency>
</dependencies>
</plugin>
</plugin> -->
</plugins>
</build>

Expand Down
4 changes: 2 additions & 2 deletions env-utils/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.8.1</version>
<version>3.12.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13</version>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,17 @@
*/
public class ImageUtils {

/**
* Crop image by drawing parts of its contents into a new image.
*/
public static BufferedImage cropNew(BufferedImage img, int x, int y, int w, int h) {
BufferedImage imgPart = new BufferedImage(w, h, img.getType());
Graphics2D gr = imgPart.createGraphics();
gr.drawImage(img, 0, 0, w, h, x, y, x + w, y + h, null);
gr.dispose();
return imgPart;
}

public static double colorDist(int pixel1, int pixel2) {
int p1r = (pixel1 >> 16) & 0xFF;
int p1g = (pixel1 >> 8) & 0xFF;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/*
* Copyright © 2017 jjYBdx4IL (https://github.com/jjYBdx4IL)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.github.jjYBdx4IL.utils.concurrent;

/**
* A CountDownLatch variant that does not suppress notifies.
*/

public class CountDownLatchEx {

protected long counter;

/**
* The constructor.
*/
public CountDownLatchEx(long count) {
if (count < 1) {
throw new IllegalArgumentException();
}
counter = count;
}

/**
* The constructor.
*/
public CountDownLatchEx() {
this(1);
}

/**
* Wait for notify or countdown to reach 0. Returns when countdown reaches
* zero or on notify. Returns immeditaly if countdown is already at 0.
*
* @return true if countdown reached 0
*/
public synchronized boolean await() throws InterruptedException {
if (counter <= 0) {
return true;
}
wait();
return counter <= 0;
}

/**
* Wait for notify or countdown to reach 0. Returns when countdown reaches
* zero or on notify. Returns immeditaly if countdown is already at 0.
*
* @return true if countdown reached 0
*/
public synchronized boolean await(long millis) throws InterruptedException {
if (counter <= 0) {
return true;
}
wait(millis);
return counter <= 0;
}

/**
* Count down and notify once (only) upon reaching 0.
*/
public synchronized void countDown() {
if (--counter == 0) {
notify();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public static void safeWriteTo(File dest, String data, Charset cs) throws IOExce
}
}
}

/**
* Same as {@link #safeWriteTo(File, String, Charset)}, but always uses
* UTF-8 for writing.
Expand All @@ -85,6 +85,13 @@ public static void safeWriteTo(File dest, String data) throws IOException {
safeWriteTo(dest, data, Charset.forName("UTF-8"));
}

/**
* See {@link #safeWriteTo(File, String)}.
*/
public static void safeWriteTo(Path dest, String data) throws IOException {
safeWriteTo(dest.toFile(), data);
}

/**
* Same as {@link #safeWriteTo(File, String, Charset)}, but takes an
* {@link java.io.InputStream}.
Expand Down
Loading

0 comments on commit befd53e

Please sign in to comment.