Skip to content

Instantly share code, notes, and snippets.

View jonyfs's full-sized avatar

Jony Santos jonyfs

View GitHub Profile
@jonyfs
jonyfs / FilterObjectStringStreamTest.java
Last active December 15, 2020 18:31
How to filter username in a List of Users ignoring accented characters.
import com.google.common.collect.ImmutableList;
import org.assertj.core.util.Strings;
import org.junit.Test;
import java.text.Normalizer;
import java.util.List;
import java.util.Locale;
import java.util.function.Predicate;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
@jonyfs
jonyfs / .antigenrc
Last active January 14, 2020 12:35
NerdConsole - A ZSH configuration to improve productivity
# Load oh-my-zsh library.
antigen use oh-my-zsh
# Load bundles from external repos.
antigen bundle git
antigen bundle docker
antigen bundle heroku
antigen bundle pip
antigen bundle lein
antigen bundle command-not-found
antigen bundle brew
@jonyfs
jonyfs / Dockerfile
Created September 14, 2018 21:29
Dockerfile with docker-compose and aws-cli
FROM alpine:latest
MAINTAINER Jony Santos
RUN apk update && apk add docker make py-pip && pip install docker-compose && pip install aws-cli
@jonyfs
jonyfs / clean.slave.jenkins.workspaces.groovy
Last active August 28, 2018 15:16
clean.slave.jenkins.workspaces.groovy
import com.cloudbees.hudson.plugins.folder.Folder
import hudson.FilePath
import jenkins.model.Jenkins
def boolean isFolder(String name) {
def item = Jenkins.instance.getItemByFullName(name)
return item instanceof Folder
}
def deleteUnusedWorkspace(FilePath root, String path) {
@jonyfs
jonyfs / TimeZoneTest.java
Created June 21, 2018 15:59
Different java.time.ZonedDateTime formatted with pattern yyyy-MM-dd'T'HH:mm:ssXXX
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
public class TimeZoneTest {
public static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ssXXX");
@jonyfs
jonyfs / gist:96f2e0830e342ac5d6e296bc171f2bd1
Created June 1, 2017 17:13 — forked from tonymtz/gist:d75101d9bdf764c890ef
Uninstall nodejs from OSX Yosemite
# first:
lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom | while read f; do sudo rm /usr/local/${f}; done
sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.*
# To recap, the best way (I've found) to completely uninstall node + npm is to do the following:
# go to /usr/local/lib and delete any node and node_modules
cd /usr/local/lib
sudo rm -rf node*
@jonyfs
jonyfs / JavaFXTrayIconSample.java
Created October 27, 2016 20:54 — forked from jewelsea/JavaFXTrayIconSample.java
Demonstrate using the System Tray (AWT) to control a JavaFX application.
import javafx.application.*;
import javafx.geometry.Pos;
import javafx.scene.*;
import javafx.scene.control.Label;
import javafx.scene.layout.*;
import javafx.scene.paint.Color;
import javafx.stage.*;
import javax.imageio.ImageIO;
import java.io.IOException;
@jonyfs
jonyfs / CopyFromOneServerToAnother.groovy
Created October 7, 2016 21:17 — forked from jamesmorgan/CopyFromOneServerToAnother.groovy
Copy Messages from one ActiveMQ instance to another with Apache Camel and Groovy
import org.apache.activemq.camel.component.ActiveMQComponent
import org.apache.camel.CamelContext
import org.apache.camel.builder.RouteBuilder
import org.apache.camel.impl.DefaultCamelContext
class CopyFromOneServerToAnother extends RouteBuilder{
public static void main(String[] args) {
@jonyfs
jonyfs / AllIntegrationTests.java
Last active August 29, 2015 14:27
JUnit Suite Class example working with Spring and embedded instance of MongoDB to create Integration Tests
import java.io.IOException;
import java.net.UnknownHostException;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import org.junit.After;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;