Skip to content

Instantly share code, notes, and snippets.

View m4nu56's full-sized avatar
🏠
Working from home

Emmanuel Balpe m4nu56

🏠
Working from home
View GitHub Profile
UPDATE journey_patterns p SET name = (
SELECT l.name
FROM journey_patterns jp
JOIN routes r ON jp.route_id = r.id
JOIN lines l ON r.line_id = l.id
WHERE l.name IS NOT NULL
AND l.name <> ''
AND jp.id = p.id
) || ' - ' || name
@m4nu56
m4nu56 / ApiService.java
Last active May 29, 2020 05:31
Using Generic Types in Java to create a method that will handle any API call
package com.dev1.api;
import com.dev1.api.exception.ApiException;
import com.dev1.api.exception.ApiExceptionNetwork;
import com.dev1.api.exception.ApiExceptionUncaught;
import com.dev1.api.exception.mapper.ErrorMessage;
import com.google.common.collect.ImmutableList;
import org.apache.http.HttpHeaders;
import org.apache.log4j.Logger;
@m4nu56
m4nu56 / ReflectionClassFields.java
Last active November 21, 2019 12:33
Map the fields of a class into a Map with fieldName and fieldValue
import org.apache.commons.lang3.tuple.Pair;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class ReflectionClassFields {
@m4nu56
m4nu56 / .gitlab-ci.yml
Created November 12, 2019 10:25
Pipeline tests nodejs+mongodb + integration tests avec postman
image: docker:19.03.1
variables:
DOCKER_HOST: tcp://docker:2375
DOCKER_DRIVER: overlay2
PROJECT_IMAGE: registry.dev1-0.com/project
PROJECT_RELEASE_IMAGE: $PROJECT_IMAGE:$CI_COMMIT_REF_NAME
DOCKER_TLS_CERTDIR: ""
services:
@m4nu56
m4nu56 / config.json
Created November 11, 2019 20:00
Config for ouroboros auth to registry
{
"auths": {
"registry.domain.com": {
"auth": "tokenXXXX"
}
},
"HttpHeaders": {
"User-Agent": "Docker-Client/18.09.0 (linux)"
}
}
@m4nu56
m4nu56 / docker-compose.yml
Last active November 11, 2019 21:22
Config ouroboros
version: '3'
services:
ouroboros:
container_name: ouroboros
hostname: ouroboros
image: pyouroboros/ouroboros
environment:
- CLEANUP=true
- INTERVAL=300
- LOG_LEVEL=info
@m4nu56
m4nu56 / docker-compose.yml
Last active November 11, 2019 19:51
Stack mongo + nodejs
version: "3.4"
services:
mongo:
container_name: mongo
image: mongo:4.0
restart: unless-stopped
ports:
- 27017:27017
environment:
FROM node:10
ENV TZ=Europe/Paris
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update && apt-get install -y build-essential && apt-get install -y python
# Create app directory
WORKDIR /usr/src/app
image: docker:19.03.1
variables:
DOCKER_HOST: tcp://docker:2375
DOCKER_DRIVER: overlay2
PROJECT_IMAGE: registry.domain.com/project-name
PROJECT_RELEASE_IMAGE: $PROJECT_IMAGE:$CI_COMMIT_REF_NAME
DOCKER_TLS_CERTDIR: ""
services: