Skip to content

Instantly share code, notes, and snippets.

Avatar

Florent Biville fbiville

View GitHub Profile
@fbiville
fbiville / docker-start.sh
Last active Oct 19, 2020
Get Neo4j with Movies dataset
View docker-start.sh
#!/usr/bin/env bash
set -euo pipefail
function main() {
local neo4j_version="${1}"
local data_url="${2}"
local local_movies_path
local_movies_path=$(download_movies_data "${data_url}")
@fbiville
fbiville / registry-source.yaml
Created Aug 12, 2020
https://github.com/fbiville/eventing-contrib/ | registry-source branch | 91efb2b1da5db214e9c839bc23752ffad2543d8c
View registry-source.yaml
# Copyright 2019 The Knative Authors
#
# Licensed 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
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@fbiville
fbiville / wait_for_up_status.sh
Last active Dec 19, 2019
Wait for Spring Boot's health status to be up
View wait_for_up_status.sh
#!/bin/bash
set -Eeuo pipefail
get_health_status() {
curl --request GET http://localhost:8080/actuator/health 2> /dev/null | jq --raw-output '.status'
}
main() {
while [ "$(get_health_status)" != "UP" ]; do
@fbiville
fbiville / summary.md
Last active Sep 25, 2019
HTTP/2 vulnerabilities and Node / Java libs
@fbiville
fbiville / ResultExtensionTest.kt
Last active Mar 1, 2019
kotlin.Result - flatMap extension
View ResultExtensionTest.kt
import net.jqwik.api.ForAll
import net.jqwik.api.Property
// requires compiler option '-Xallow-result-return-type'
fun <T, U> Result<T>.flatMap(function: (T) -> Result<U>): Result<U> {
return if (isSuccess) {
function(getOrNull()!!)
} else {
Result.failure(this.exceptionOrNull()!!)
}
@fbiville
fbiville / gist:3041a07f8e83f3925815c74a68184143
Created Nov 27, 2018
Hands on Neo4j - Devoxx Morocco 2018 - solutions
View gist:3041a07f8e83f3925815c74a68184143
[
{
"instructions": "Find the number of movies",
"solution": "MATCH (m: Movie) RETURN COUNT(m);"
},
{
"instructions": "Find the number of action movies",
"solution": "MATCH (m: Movie {genre: 'Action'}) RETURN COUNT(m);"
},
{
@fbiville
fbiville / prepend_test.go
Last active Oct 5, 2018
Golang property-based testing example
View prepend_test.go
package main
import (
"testing"
"testing/quick"
)
func TestSlicePrepend(t *testing.T) {
f := func(head string, tail []string) bool {
result := prepend(head, tail)
@fbiville
fbiville / configuration-zsh.sh
Created Sep 4, 2018
Zsh custom config in workstation-setup
View configuration-zsh.sh
echo
echo "Configuring zsh"
brew install grc
brew install coreutils
brew install watch
brew install z
touch ~/.z
brew install zsh zsh-completions
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
cp files/dircolors.ansi-dark ~/.dircolors
@fbiville
fbiville / CustomContextInitializer.java
Last active Oct 5, 2019
Dynamic WireMock port in Spring Boot test
View CustomContextInitializer.java
import org.assertj.core.util.Maps;
import org.springframework.context.ApplicationContextInitializer;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.MapPropertySource;
import java.util.Map;
import static org.springframework.util.SocketUtils.findAvailableTcpPort;
public class CustomContextInitializer implements ApplicationContextInitializer<ConfigurableApplicationContext> {
View stack.trace
2018-01-02 13:29:13
Full thread dump Java HotSpot(TM) 64-Bit Server VM (25.151-b12 mixed mode):
"Attach Listener" #151 daemon prio=9 os_prio=0 tid=0x00007f6b89288800 nid=0x219a waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
"BuilderThread 3" #76 prio=5 os_prio=0 tid=0x00007f6b89285800 nid=0x1bac waiting on condition [0x00007f6b6eb34000]
java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for <0x00000000807ff168> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
You can’t perform that action at this time.