Skip to content

Instantly share code, notes, and snippets.

View fanf's full-sized avatar

François Armand fanf

View GitHub Profile
def getTools() {
stage("Get tool") {
environment {
GITHUB_CREDS = credentials('git') // actually an uuid from the .../jenkins/credentials/ page
}
sh '''
mkdir -p tools
'''
dir("tools") {
checkout([
@fanf
fanf / api-description.log
Created December 12, 2017 17:27
Teasing API processor
debug: Connecting 'updateGroup', request type 'post' to URLs: [v7] api/7/groups/{id}; [v8] api/8/groups/{id}; [v9] api/9/groups/{id}; [v9] api/latest/groups/{id}; [v7] api/groups/{id}; [v8] api/groups/{id}; [v9] api/groups/{id}; [v7] secure/api/7/groups/{id}; [v8] secure/api/8/groups/{id}; [v9] secure/api/9/groups/{id}; [v9] secure/api/latest/groups/{id}; [v7] secure/api/groups/{id}; [v8] secure/api/groups/{id}; [v9] secure/api/groups/{id}
debug: Connecting 'groupDetails', request type 'get' to URLs: [v7] api/7/groups/{id}; [v8] api/8/groups/{id}; [v9] api/9/groups/{id}; [v9] api/latest/groups/{id}; [v7] api/groups/{id}; [v8] api/groups/{id}; [v9] api/groups/{id}; [v7] secure/api/7/groups/{id}; [v8] secure/api/8/groups/{id}; [v9] secure/api/9/groups/{id}; [v9] secure/api/latest/groups/{id}; [v7] secure/api/groups/{id}; [v8] secure/api/groups/{id}; [v9] secure/api/groups/{id}
debug: Connecting 'deleteGroupCategory', request type 'delete' to URLs: [v7] api/7/groups/categories/{id}; [v8] api/8/groups/categories/
@fanf
fanf / errors.scala
Last active November 22, 2017 10:27
Handling and composing errors
object TypicalUseCase {
final case class UUID(value: String)
final case class DomainThingy(stuff: String)
final case class ValidatedDomainThingy(moreStuff: String)
// in some module or part of the system
sealed trait MyParserError { def msg: String }
final case class IOError(val msg: String, ex: Throwable) extends MyParserError
final case class ParsingError(val msg: String, token: String) extends MyParserError
@fanf
fanf / log.text
Created October 19, 2017 09:01
Scala IDE exception: java.lang.UnsupportedOperationException: Position.point on NoPosition
2017-10-19 10:47:05,133 ERROR [Scala Presentation Compiler [rudder-web]] - System.err - java.lang.UnsupportedOperationException: Position.point on NoPosition
2017-10-19 10:47:05,133 ERROR [Scala Presentation Compiler [rudder-web]] - System.err - at scala.reflect.internal.util.Position.fail(Position.scala:17)
2017-10-19 10:47:05,133 ERROR [Scala Presentation Compiler [rudder-web]] - System.err - at scala.reflect.internal.util.UndefinedPosition.point(Position.scala:95)
2017-10-19 10:47:05,133 ERROR [Scala Presentation Compiler [rudder-web]] - System.err - at scala.reflect.internal.util.UndefinedPosition.point(Position.scala:90)
2017-10-19 10:47:05,133 ERROR [Scala Presentation Compiler [rudder-web]] - System.err - at scala.tools.nsc.typechecker.TypeDiagnostics$TyperDiagnostics$checkUnused$UnusedPrivates.$anonfun$unusedTerms$4(TypeDiagnostics.scala:593)
2017-10-19 10:47:05,133 ERROR [Scala Presentation Compiler [rudder-web]] - System.err - at scala.tools.nsc.typechecker.TypeDiagnostics$TyperDiagnostics$checkUnus
Thread 7 (Thread 0x7fdf8a9fd700 (LWP 12185)):
#0 0x00007fdfaafd2fd3 in select () at /usr/lib/libc.so.6
#1 0x000055eda7dcb56a in e_powersave_sleeper_sleep (sleeper=0x55eda8ee5130, poll_interval=<optimized out>) at src/bin/e_powersave.c:186
tim = 6979882
rfds = {fds_bits = {134217728, 0 <repeats 15 times>}}
wfds = {fds_bits = {0 <repeats 16 times>}}
exfds = {fds_bits = {0 <repeats 16 times>}}
tv = {tv_sec = 4, tv_usec = 206891}
ret = <optimized out>
Bringing machine 'debian8_relay' up with 'virtualbox' provider...
==> debian8_relay: Importing base box 'cargomedia/debian-7-amd64-default'...
==> debian8_relay: Matching MAC address for NAT networking...
==> debian8_relay: Checking if box 'cargomedia/debian-7-amd64-default' is up to date...
==> debian8_relay: A newer version of the box 'cargomedia/debian-7-amd64-default' is available! You currently
==> debian8_relay: have version '0.15.0'. The latest is version '0.23.0'. Run
==> debian8_relay: `vagrant box update` to update.
==> debian8_relay: Setting the name of the VM: rudder-tests_debian8_relay_1485507888115_37325
==> debian8_relay: Fixed port collision for 22 => 2222. Now on port 2201.
==> debian8_relay: Clearing any previously set network interfaces...
/*
* In our code, we have dozen of class to model our domain.
* Most of them have a name, or an id which happen to be implemented
* by a string.
* As we want the compiler to work for us especially during refactoring,
* we have zillions of things like that:
*/
final case class DirectiveId(value: String)
final case class Directive(
-startup
plugins/org.eclipse.equinox.launcher_1.3.200.v20160318-1642.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.400.v20160518-1444
-vmargs
-Xmx3G
-Xms3G
-Xss32m
-XX:+UnlockExperimentalVMOptions
-XX:+UseLargePages
/*
* Follow up of https://gist.github.com/fanf/845273a15377347a04375d51a0139b78
* trying to use the new onionT1/onionT2/onionT3 from cats 0/6
*/
object Test1 {
type Maybe[A] = Xor[String, A]
final case class Query(value: String)
object Test {
/*
* This is a clearer version of https://gist.github.com/fanf/f26eee67ae33bf54e363e4e5dce01388
*/
type Maybe[A] = Xor[String, A]
final case class Query(value: String)
final case class Result(value: String)