Skip to content

Instantly share code, notes, and snippets.

Avatar
🔥
Working hard on Vaccination Campaign in France and Germany

David Gageot dgageot

🔥
Working hard on Vaccination Campaign in France and Germany
View GitHub Profile
@dgageot
dgageot / MergedIterator.java
Last active Dec 5, 2020
Merged Iterator. Uses Guava
View MergedIterator.java
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
import java.util.NoSuchElementException;
import com.google.common.collect.Iterators;
import com.google.common.collect.PeekingIterator;
public class MergedIterator<T> implements Iterator<T> {
private final Comparator<? super T> comparator;
@dgageot
dgageot / FindParametersTypes.java
Created Aug 19, 2014
Find Lambda parameter types
View FindParametersTypes.java
package test;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.Arrays;
import java.util.function.Function;
import static java.util.stream.Stream.of;
public class FindParametersTypes {
@dgageot
dgageot / draft_billet_macos.md
Created Oct 31, 2010
Installation git sous OSX
View draft_billet_macos.md

MacOS est un Unix, et à ce titre, l'installation de git n'est pas trop compliqué :). Pour résumé, vous avez 2 méthodes :

  • installer une version déjà compilée par un tiers
  • installer une version source

Cette dernière méthode est plus contraignante, votre système doit contenir le nécessaire pour compiler (compilateur GCC, outil Make et Autoconf...). Les utilisateurs d'Unix libres (Linux, *BSD) ne seront pas étonnés par ces 2 méthodes d'installation.

Installer une version compilée

Pour ceux qui souhaitent ne pas "se prendre la tête", Il existe le projet Git OSX Installer, qui permet d'installer simplement git sur Mac OS X 10.5 uniquement. Vous pouvez constater que le projet est actif (au 30/11/2010, la version 1.7.3.1 est disponible alors que la dernière version est la 1.7.3.2).

@dgageot
dgageot / PhantomJsDownloader.java
Last active May 28, 2019
PhantomJs / GhostDriver / FluentLenium with automatic install of PhantomJs
View PhantomJsDownloader.java
package com.fractales.synchro.helpers.phantomjs;
import com.google.common.io.ByteStreams;
import com.google.common.io.Files;
import com.google.common.io.InputSupplier;
import com.google.common.io.OutputSupplier;
import com.google.common.io.Resources;
import java.io.File;
import java.io.FileOutputStream;
@dgageot
dgageot / CodeStoryStatusTest.java
Last active May 28, 2019
FluentLenium, PhantomJs, GhostDriver
View CodeStoryStatusTest.java
package net.gageot;
import org.junit.Test;
import static org.fest.assertions.Assertions.assertThat;
public class CodeStoryStatusTest extends PhantomJsTest {
@Override
public String defaultUrl() {
return "http://status.code-story.net";
View .gitconfig
[alias]
wip = !"git add -A; git ls-files --deleted -z | xargs -0 git rm; git commit -m \"wip\""
unwip = !"git log -n 1 | grep -q -c wip && git reset HEAD~1"
rb = !"git wip;git rebase -i origin/master;git unwip"
pr = !"git fetch;git wip;git rebase --stat origin;git unwip;git heads"
head = !"git log -n1"
lost = !"git fsck | awk '/dangling commit/ {print $3}' | git show --format='SHA1: %C(yellow)%h%Creset %f' --stdin | awk '/SHA1/ {sub(\"SHA1: \", \"\"); print}'"
heads = !"git log origin/master.. --format='%Cred%h%Creset;%C(yellow)%an%Creset;%H;%Cblue%f%Creset' | git name-rev --stdin --always --name-only | column -t -s';'"
View main.go
package main
import (
"archive/tar"
"fmt"
"io"
"log"
"os"
tartar "github.com/vbatts/tar-split/archive/tar"
@dgageot
dgageot / git-build
Created May 16, 2012
Unbreakeable build
View git-build
#!/bin/bash
function alert_user {
echo "${1}"
which -s growlnotify && growlnotify `basename $0` -m "${1}"
}
function exit_ko {
alert_user "${1}"; exit 1
}
@dgageot
dgageot / Types.java
Created Jun 22, 2013
Oops, a Lambda tends to forget what's its type.
View Types.java
public class Types {
interface SMI<T> {
T get(T value);
}
public static void main(String[] args) {
SMI<String> inner = new SMI<String>() {
@Override
public String get(String param) {
View main.go
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0