Skip to content

Instantly share code, notes, and snippets.

@bdelbosc
bdelbosc / pain-au-levain.md
Last active November 24, 2023 10:30
Pain au levain
/*
* (C) Copyright 2021 Nuxeo (http://nuxeo.com/) and others.
*
* 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
@bdelbosc
bdelbosc / nx-build-tomcat.sh
Created June 2, 2020 12:57
Build a nuxeo-server-tomcat zip from the source
#!/bin/bash
SRC=${SRC:-/home/ben/dev/nuxeo.git}
set -x
set -e
export MAVEN_OPTS="-Xmx4g -Xms4g -XX:+TieredCompilation -XX:TieredStopAtLevel=1"
cd $SRC
if [ -f ./modules/pom.xml ]; then
export JAVA_HOME=$JAVA_11_HOME
@bdelbosc
bdelbosc / match_phrase_prefix.txt
Created October 9, 2019 14:14
Elasticsearch match_phrase_prefix change between 6.6.2 and 6.7.0
# Start Elasticsearch 6.6.2
docker run -p 9200:9200 docker.elastic.co/elasticsearch/elasticsearch-oss:6.6.2
# 1. Create an index with a mapping
curl -X PUT "http://localhost:9200/my-index?pretty" -H 'Content-Type: application/json' -d'{
"settings": {
"index": {
"number_of_shards": 1,
"number_of_replicas": 0
}
@bdelbosc
bdelbosc / docker-compose-pull.yml
Last active October 16, 2019 13:12
Save the file and run: docker-compose -f docker-compose-pull.yml pull
version: '2'
services:
zookeeper:
image: zookeeper:3.5.5
kafka:
image: wurstmeister/kafka:2.12-2.3.0
kafkahq:
image: tchiotludo/kafkahq:0.9.0
traefik:
image: traefik:maroilles-alpine
# install deps
apt-get install cmake build-essential linux-tools-common linux-tools-generic linux-cloud-tools-generic linux-tools-`uname -r` linux-cloud-tools-`uname -r`
# setup JAVA_HOME
export JAVA_HOME=/usr/lib/jvm/java-8-oracle
export PATH=/usr/lib/jvm/java-8-oracle/bin:$PATH
git clone https://github.com/jrudolph/perf-map-agent.git /usr/local/perf-map-agent
// Gatling upload of file (blobFilename, blobPath, blobMimeType) into bucket with a PUT request (limited to 5g)
.exec(session => {
val script = "/path/to/awsS3Sign.sh " +
bucket + " " + session("blobFilename").as[String] + " " + session("blobMimeType").as[String]
val scriptOutput: String = script.!!
val dateHeader: String = scriptOutput.substring(0, scriptOutput.indexOf('|'))
val authorizationHeader: String = scriptOutput.substring(scriptOutput.indexOf('|') + 1).trim()
println("Upload " + session("blobFilename").as[String])
session.set("awsDate", dateHeader)
.set("awsAuth", authorizationHeader)
/*
* (C) Copyright 2017 Nuxeo SA (http://nuxeo.com/) and others.
*
* 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
#!/bin/sh -x
HERE=`dirname $0`
HERE=`cd $HERE; pwd`
KSAR_JAR=$HERE/kSar.jar
LOG_PATH=$HERE/log
SAR_FILE=$LOG_PATH/bench.sar
SAR_PID=$LOG_PATH/sar.pid
mkdir -p $LOG_PATH
@bdelbosc
bdelbosc / gentiff.sh
Created November 13, 2015 10:17
Script to generate quickly tiff images, requires libtiff-tools
#!/bin/bash
# number of images to generate
MAX=6607360
# directory that contains some tiff images used as template
SAMPLE=/tmp/sample
# directory where new tiff are generated
OUTDIR=/tmp/gentif
#OUTDIR=/opt/nuxeo/repo1/data