Skip to content

Instantly share code, notes, and snippets.

View fanf's full-sized avatar

François Armand fanf

View GitHub Profile
object FreekQuickSearch {
import cats.free.Free
import cats.data.Xor
import freek._
final case class Wrong(message: String, cause: Option[Throwable] = None)
type Maybe[A] = Xor[Wrong, A]
///

Keybase proof

I hereby claim:

  • I am fanf on github.
  • I am fanf42 (https://keybase.io/fanf42) on keybase.
  • I have a public key ASCGuywQu4PHCovlhfQ7Siukvf0PAZqdWQ9VTNoPD-OJQAo

To claim this, I am signing this object:

Fin janvier, j'ai envoyé une quarantaine d'emails (le mail est à la fin du text) à des hommes politiques dans le cadre d'une action coordonnée par le Mouvement Y (https://mouvy.fr/)

Je n'ai eu qu'une seule réponse, de M. Luc CARVOUNAS, Sénateur du Val-de-Marne et Maire d'Alfortville.

Je la publie avec son accord:

2016-02-05 15:07:04] DEBUG com.normation.rudder.services.nodes.NodeInfoServiceCachedImpl - NodeInfo cache is up to date, last modification time: '2016-02-05T01:05:24.000+01:00'
[2016-02-05 15:07:04] DEBUG com.normation.rudder.services.policies.DeploymentServiceImpl - Reports updated in 532ms
[2016-02-05 15:07:04] DEBUG com.normation.rudder.services.policies.DeploymentServiceImpl - Timing summary:
[2016-02-05 15:07:04] DEBUG com.normation.rudder.services.policies.DeploymentServiceImpl - Fetch all information : 282 ms
[2016-02-05 15:07:04] DEBUG com.normation.rudder.services.policies.DeploymentServiceImpl - Historize names : 571 ms
[2016-02-05 15:07:04] DEBUG com.normation.rudder.services.policies.DeploymentServiceImpl - Build current rule values : 11 ms
[2016-02-05 15:07:04] DEBUG com.normation.rudder.services.policies.DeploymentServiceImpl - Build target configuration: 68 ms
[2016-02-05 15:07:04] DEBUG com.normation.rudder.services.policies.DeploymentServiceImpl - U
@fanf
fanf / ImplicitResolutionError.scala
Last active January 6, 2016 15:18
Implicit resolution error with Rapture
package fanf
import rapture.core._
import rapture.core.timeSystems.numeric
import rapture.io._
import rapture.net._
import rapture.json._
import rapture.uri._
import rapture.codec.encodings.`UTF-8`._
import rapture.json.jsonBackends.jackson._
@fanf
fanf / specs2_regex_filtered_file_content_match.scala
Last active December 10, 2015 10:00
Specs2: compare files in two directories, filtering out some line based on regex (for ex when they contains datetime "now", random id, etc)
package test
/**
* Specs2 matcher are wonderful. You're almost sur to find one for your need, whatever the need.
* Mine was to compare the output of an algo writting a directory tree with template filled
* with a reference one. And great! Specs2 has a:
*
* actualDir must haveSameFilesAs(expectedDir)
*
* See: https://etorreborre.github.io/specs2/guide/SPECS2-3.6.6/org.specs2.guide.Matchers.html#optional
def ignoreSomeLinesMatcher[L1 : LinesContent, L2 : LinesContent](): LinesPairComparisonMatcher[L1, L2] = LinesPairComparisonMatcher[L1, L2](
filter = new DifferenceFilter() {
def apply(diffs: (Seq[_], Seq[_])) = {
throw new Exception("OK!")
}
}
)
rootGeneratedPromisesDir must haveSameFilesAs(new File(EXPECTED_SHARE, "root")).withMatcher(ignoreSomeLinesMatcher())
#
# Is this code safe? It seems that it can broke at least at two point:
# - adding in a mutable structure from a parallele processing does not seems to be a good idea
# - throwing an exception for control flow (early out) is kind of acceptable for sequential loop,
# but what happen if two thread of the ".par" processing throw it at the same time ?
# If this is not the good way of doing that, how one process a sequence of things (could be vector
# in place of Seq, the genericity is not really needed here) so that:
# - the processing is parallelized,
# - there is an early out ?
#
@fanf
fanf / demo_file_content.cf
Last active August 29, 2015 14:28
Some example of ncf generic methods for Rudder
#####################################################################################
# Copyright 2015 Normation SAS
#####################################################################################
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, Version 3.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
bundle agent permissions_owner_recurse(path, owner, group)
{
methods:
"placeholder" usebundle => permissions_owner_type_recursion("${path}", "${owner}", "${group}", "all", "inf");
}
bundle agent permissions_owner_type_recursion(path, owner, group, type, recursion)
{
vars:
"class_prefix" string => canonify("permissions_owner_${path}");