Skip to content

Instantly share code, notes, and snippets.

View gervaisb's full-sized avatar
🐐
What's happening?

Gervais Blaise gervaisb

🐐
What's happening?
View GitHub Profile
@gervaisb
gervaisb / hostname.sh
Created August 10, 2021 09:30
A wrapper over the MacOs hostname command to accept the '-i' or '--ip-address' flag.
#!/bin/sh
# hostname.sh - a wrapper over the MacOs hostname command to accept the '-i'
# or '--ip-address' flag.
#
# SYNOPSIS
# hostname [-i|--ip-address] [*]
#
# OPTIONS
# -i, --ip-address
class AppController {
public static void main(String[] args) {
new AppController(new AppModel(),
new ToDoView(new PrintWriter(System.out)),
new Scanner(System.in))
.start(Arrays.asList(args));
}
private final AppModel model;
@gervaisb
gervaisb / Factories.java
Created May 31, 2018 12:08
A couple of uitility methods to create objects in tests
public class Factories {
private Factories() { /* Prevent instantiation */ }
public static <T> List<T> listOf(T... elements) {
return Arrays.asList(elements);
}
public static <T> List<T> listOf(int howMuch, Supplier<T> supplier) {
return listOf(howMuch, (Integer) -> supplier.get());
@gervaisb
gervaisb / multitail.conf
Created May 3, 2018 19:54
Multitail colorscheme for Junit text reports
#
# Junit text report
colorscheme:junit
cs_re:white,,bold:Tests run: ([0-9]*)
cs_re:red,,bold:Failures: ([1-9][0-9]*)
cs_re:white,,bold:Failures: 0
cs_re:red,,bold:Errors: ([1-9][0-9]*)
cs_re:white,,bold:Errors: 0
cs_re:yellow,,bold:Skipped: ([1-9][0-9]*)
cs_re:white,,bold:Skipped: 0
@gervaisb
gervaisb / Idioms.kt
Last active November 29, 2017 08:20
Kotlin idioms translated to Scala
import java.io.File
import java.nio.file.Files
import java.nio.file.Paths
// Fixtures
val name = "Me"
val x:Any = ""
val value = 42
data class Foo(val v:Int)
data class Bar(val v:Int)
/*
A WebHook pipe who receive a Codeship notification when a build start or
change and update the related status on Bitbucket.
This script need 3 script properties :
+ BITBUCKET_REPO The repository that will be updated
+ BITBUCKET_OWNER Username of `BITBUCKET_REPO` owner
+ BITBUCKET_PASSWORD /!\ Plain password of the owner. /!\
@gervaisb
gervaisb / META-INF\spring.factories
Last active August 29, 2015 14:20
Custom sping-boot module who set the `Principal` on all public methods with a parameter of type `Principal`
org.springframework.boot.autoconfigure.EnableAutoConfiguration=mvc.traits.WithConfigurer
@gervaisb
gervaisb / Effects.java
Last active August 29, 2015 14:16
An effect who reduce a JFrame to the lower right corner of the screen
import javax.swing.*;
import java.awt.*;
import java.awt.image.BufferedImage;
public abstract class Effects {
public static void run(Effects effect, Runnable onComplete) {
run(effect, 500, onComplete);
}