This file contains hidden or 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
#!/usr/bin/env bash | |
if ! [ -x "$(command -v wget)" ]; then | |
curl --fail --silent localhost:80/actuator/health/liveness | grep UP || exit 1 | |
else | |
wget --no-verbose --tries=1 -qO - localhost:80/actuator/health/liveness | grep UP || exit 1 | |
fi |
This file contains hidden or 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
#!/usr/bin/env bash | |
if ! [ -x "$(command -v wget)" ]; then | |
curl --fail --silent localhost:8080/actuator/health/liveness | grep UP || exit 1 | |
else | |
wget --no-verbose --tries=1 --spider localhost:8080/actuator/health/liveness | grep UP || exit 1 | |
fi |
This file contains hidden or 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 org.jetbrains.annotations.Nullable; | |
import java.io.OutputStream; | |
import java.io.PrintStream; | |
import java.io.UnsupportedEncodingException; | |
public class PackagePrintStream extends PrintStream { |
This file contains hidden or 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
# reinstalls ubuntu-desktop AND dependencies | |
sudo apt-cache depends ubuntu-desktop | awk -F ": " '{print $2}' | sed '/^$/d' | xargs sudo apt-get install --reinstall --install-recommends --yes |
This file contains hidden or 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 java.sql.SQLException; | |
import org.eclipse.persistence.config.SessionCustomizer; | |
import org.eclipse.persistence.descriptors.ClassDescriptor; | |
import org.eclipse.persistence.mappings.DatabaseMapping; | |
import org.eclipse.persistence.sessions.Session; | |
import org.eclipse.persistence.tools.schemaframework.IndexDefinition; | |
/** | |
* @author Ivan Rodriguez Murillo |
This file contains hidden or 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 AnimalCustomizer implements DescriptorCustomizer { | |
@Override | |
public void customize(ClassDescriptor cd) throws Exception { | |
HistoryPolicy policy = new HistoryPolicy(); | |
policy.addStartFieldName("START"); | |
policy.addEndFieldName("END"); | |
policy.addHistoryTableName("ANIMAL","ANIMAL_HISTORY"); | |
policy.setShouldHandleWrites(true); | |
cd.setHistoryPolicy(policy); |
This file contains hidden or 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
@Entity | |
@Table(name = "ANIMAL_HISTORY") | |
public class AnimalHistory implements Serializable { | |
@Id | |
@GeneratedValue(strategy = GenerationType.IDENTITY) | |
@Getter | |
@Setter | |
private Long pk; |
This file contains hidden or 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
@Entity | |
@Table(name = "ANIMAL") | |
@Customizer(AnimalCustomizer.class) | |
public class Animal extends AbstractPersistable<Long> { | |
@Id | |
@GeneratedValue(strategy = GenerationType.AUTO) | |
@Getter | |
@Setter | |
private Long id; |
This file contains hidden or 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
private Node createPage(int pageIndex) { | |
ProgressiveImageView iv = null; | |
try { | |
String s = files.get(pageIndex).toUri().toURL().toExternalForm(); | |
String p = placeholders.get(pageIndex).toUri().toURL().toExternalForm(); | |
iv = new ProgressiveImageView(s, p); | |
} catch (MalformedURLException e) { | |
e.printStackTrace();// TODO, I feel too lazy today | |
} | |
iv.setPreserveRatio(true); |
This file contains hidden or 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 javafx.beans.value.ChangeListener; | |
import javafx.beans.value.ObservableValue; | |
import javafx.scene.image.Image; | |
import javafx.scene.image.ImageView; | |
public class ProgressiveImageView extends ImageView { | |
public ProgressiveImageView(final String image, String placeholder) { | |
final Image img = new Image(image, true); | |
img.progressProperty().addListener(new ChangeListener<Number>() { | |
public void changed(ObservableValue ov, |
NewerOlder