Skip to content

Instantly share code, notes, and snippets.

// idiomatism to dump stacktrace
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw));
String yourStack = sw.toString()
@pdemanget
pdemanget / git-bulk
Last active March 19, 2020 18:19
bulk operation in git using gws file format
#!/bin/bash
grep -v '^#' < .projects.gws | { while IFS="|" read -r name repo; do
if [ -n "$name" ]; then
(
cd "$name"
echo "$name ;"
git "$@"
)
fi
done
@pdemanget
pdemanget / .bash_aliases
Last active June 26, 2023 09:34
Bashrc prompt for git
#0. Only aliases, one per line
#1. warning this file is auto-sorted, no script here!
alias ale="vim ~/.bash_aliases && sort -o ~/.bash_aliases ~/.bash_aliases && source ~/.bash_aliases"
alias dc="docker-compose"
alias dcp="docker-compose -f postgres-docker-compose.yml "
alias dcs="docker-compose -f sqlserver-docker-compose.yml "
alias doc-passif="start /home/philippe/Documents/htoh/amadeus/passif/"
alias drive-ext="sshfs -o ssh_command='ssh -4 -p 443' [email protected]:/volume1/public/htoh/ ~/Documents/htoh-drive"
alias drive="sshfs fil@syno:/volume1/public/htoh/ ~/Documents/htoh-drive"
alias g="git"
@pdemanget
pdemanget / version.sh
Last active November 20, 2020 14:11
Using maven versions plugin to release
# On release localement:
# - On laisse l'utilisateur choisir de pousser on pas son tag et son commit
# - Au choix remplacer l'install par un deploy, ou revenir sur le tag pour lancer le deploy.
# mvn -q versions:set -DnewVersion=1.1.0-SNAPSHOT -DprocessAllModules -DgenerateBackupPoms=false
JAVA_HOME=/opt/lib/jdk11/
echo set RELEASE version
mvn -q versions:set -DremoveSnapshot -DprocessAllModules
@pdemanget
pdemanget / .gitconfig
Last active July 21, 2023 11:43
My git aliases and configuration
# This is Git's per-user configuration file.
# [user]
# name =
# email =
# Windows specific uncomment this on windows
# [mergetool "kdiff3"]
# path = C:/Program Files/KDiff3/kdiff3.exe
# trustExitCode = false
#[difftool "kdiff3"]
@pdemanget
pdemanget / README.md
Created February 20, 2018 10:28 — forked from magnetikonline/README.md
List all Git repository objects by size.

List all Git repository objects by size

Summary

Bash script to:

  • Iterate all commits made within a Git repository.
  • List every object at each commit.
@pdemanget
pdemanget / EventStreamController.java
Created February 1, 2018 16:11
Server Sent event
/**
* Server sent event dom using Spring webflux.
*
* @author Philippe.DEMANGET
*/
@RestController
@RequestMapping("/event/stream")
public class EventStreamController {
private Logger logger = LoggerFactory.getLogger(getClass());
@pdemanget
pdemanget / TableViewUtils.java
Created January 19, 2018 09:15
Javafx utils
public static <ROW> Callback<TableColumn<ROW, Boolean>, TableCell<ROW, Boolean>> getCheckboxCell(){
return column -> {
CheckBoxTableCell<ROW, Boolean> cell = new CheckBoxTableCell<>();
cell.setAlignment(Pos.CENTER);
return cell;
};
}
public static <ROW, T extends Temporal> Callback<TableColumn<ROW, T>, TableCell<ROW, T>> getDateCell(
DateTimeFormatter format) {
#
# use npm install js-yaml
const fs = require('fs')
const jsyaml = require('js-yaml')
const mkdirSync = function (dirPath) {
try {
fs.mkdirSync(dirPath)
@pdemanget
pdemanget / Collection8Utils.java
Last active April 15, 2016 08:52
Java Stream grouping by multiple fields
/**
* Group on 2 levels
*/
protected <K,V> Map<K, Map<K,List<V>>> groupByFields2 (List<V> modelList,Function<? super V, ? extends K> classifier1,Function<? super V, ? extends K> classifier2) {
Collector<V, ?, Map<K, List<V>>> groupingBy2 = Collectors.groupingBy(classifier2);
Collector<V, ?, Map<K, Map<K,List<V>>>> groupingBy = Collectors.groupingBy(
classifier1
,groupingBy2
);