Skip to content

Instantly share code, notes, and snippets.

View TGITS's full-sized avatar

TheGeekInTheShell TGITS

View GitHub Profile
@TGITS
TGITS / perfectNumber.jsh
Last active January 23, 2023 12:19
Exemple de script Java à ouvrir et lancer sous jshell
//A exécuter sous JShell : /open perfectNumber.jsh
import java.util.stream.Collectors;
import java.util.stream.IntStream;
int sumOfDividers(int value){
return IntStream.rangeClosed(1, value).filter(i -> value % i == 0).sum();
}
var maxItems = 100;
@TGITS
TGITS / DataFakerRegexifyUsage.jsh
Last active May 4, 2023 11:25
Exemple d'utilisation de la méthode regexify avec JShell/JBang
//DEPS net.datafaker:datafaker:1.9.0
/**
* Pour executer avec JBang : jbang DataFakerRegexifyUsage.jsh
* <p>
* Les lignes commençant par //DEPS xxx au début du script sont pour le lancement avec JBang.
* Elle est ignorée si on lance directement avec JShell
* <p>
* Pour exécuter sous JShell :
* <p>
@TGITS
TGITS / DataFakerExamplifyUsage.jsh
Last active May 4, 2023 11:13
Exemple d'utilisation de la méthode examplify avec Jshell/JBang
//DEPS net.datafaker:datafaker:1.9.0
/**
* Pour executer avec JBang : jbang DataFakerExamplifyUsage.jsh
* <p>
* Pour exécuter sous JShell :
* jshell --class-path .;.\lib\datafaker-1.9.0.jar
* /open DataFakerExamplifyUsage.jsh
*/
import net.datafaker.Faker;
@TGITS
TGITS / DataFakerTemplateUsage_2.jsh
Last active May 4, 2023 11:11
Deuxième exemple d'utilisation de la méthode templatify
//DEPS net.datafaker:datafaker:1.9.0
/**
* Pour executer avec JBang : jbang DataFakerTemplateUsage_2.jsh
* <p>
* Pour exécuter sous JShell :
* jshell --class-path .;.\lib\datafaker-1.9.0.jar
* /open DataFakerTemplateUsage_2.jsh
*/
import net.datafaker.Faker;
@TGITS
TGITS / DataFakerTemplateUsage_1.jsh
Last active May 4, 2023 11:09
Premier exemple d'utilisation de la méthode templatify
//DEPS net.datafaker:datafaker:1.9.0
/**
* Pour executer avec JBang : jbang DataFakerTemplateUsage_1.jsh
* Pour exécuter sous JShell :
* jshell --class-path .;.\lib\datafaker-1.9.0.jar
* /open DataFakerTemplateUsage_1.jsh
*/
import net.datafaker.Faker;
import java.util.stream.IntStream;
@TGITS
TGITS / LetterifyNumerifyAndBothifySpecialChar.jsh
Last active May 4, 2023 11:08
Exemple sur l'utilisation des caractères spéciaux dans les méthodes letterify, numerify et bothify
//DEPS net.datafaker:datafaker:1.9.0
/**
* Pour executer avec JBang : jbang LetterifyNumerifyAndBothifySpecialChar.jsh
* Pour exécuter sous JShell :
* jshell --class-path .;.\lib\datafaker-1.9.0.jar
* /open LetterifyNumerifyAndBothifySpecialChar.jsh
*/
import net.datafaker.Faker;
@TGITS
TGITS / DataFakerBothifyUsage.jsh
Last active May 4, 2023 11:06
Exemple d'utilisation de la méthode bothify pour créer des chaines aléatoires sur la base d'un modèle
//DEPS net.datafaker:datafaker:1.9.0
/**
* Pour executer avec JBang : jbang DataFakerBothifyUsage.jsh
* <p>
* Pour exécuter sous JShell :
* jshell --class-path .;.\lib\datafaker-1.9.0.jar
* /open DataFakerBothifyUsage.jsh
*/
import net.datafaker.Faker;
@TGITS
TGITS / DataFakerNumerifyUsage.jsh
Last active May 4, 2023 11:06
Exemple d'utilisation de la méthode numerify
//DEPS net.datafaker:datafaker:1.9.0
/**
* Pour executer avec JBang : jbang DataFakerNumerifyUsage.jsh
* <p>
* Pour exécuter sous JShell :
* jshell --class-path .;.\lib\datafaker-1.9.0.jar
* /open DataFakerNumerifyUsage.jsh
*/
import net.datafaker.Faker;
@TGITS
TGITS / DataFakerOptionsProviderWithDate.jsh
Last active May 4, 2023 11:35
Random selection of a date among several with the option method
//DEPS net.datafaker:datafaker:1.9.0
/**
* Pour exécuter avec JBang : jbang DataFakerOptionsProviderWithDate.jsh
* Pour exécuter sous JShell :
* jshell --class-path .;.\lib\datafaker-1.9.0.jar
* /open DataFakerOptionsProviderWithDate.jsh
*/
import net.datafaker.Faker;
import net.datafaker.providers.base.Options;
@TGITS
TGITS / DataFakerOptionsProviderSubset.jsh
Last active May 4, 2023 11:36
Un exemple d'utilisation du fournisseur de données options pour créer un sous-ensemble aléatoirement peuplé
//DEPS net.datafaker:datafaker:1.9.0
/**
* Pour exécuter avec JBang : jbang DataFakerOptionsProviderSubset.jsh
* Pour exécuter sous JShell :
* jshell --class-path .;.\lib\datafaker-1.9.0.jar
* /open DataFakerOptionsProviderSubset.jsh
*/
import net.datafaker.Faker;
import net.datafaker.providers.base.Options;