Skip to content

Instantly share code, notes, and snippets.

View ebuildy's full-sized avatar
🤟
South of France

Thomas Decaux ebuildy

🤟
South of France
View GitHub Profile
@ebuildy
ebuildy / Dockerfile
Created October 26, 2024 20:38
Multi stage build
FROM dunglas/frankenphp:1-php8.3 AS php-base
RUN install-php-extensions .....
RUN useradd -D www-data
USER www-data
FROM php-base AS php-builder
@ebuildy
ebuildy / diagram.d2
Created September 23, 2024 12:12
Diagram about platform as-service
grid-rows: 1
legends: {
class: container
grid-rows: 3
explanation: |md
# YAML everywhere
A `project` is defined in YAML format, it contains ALL details:
@ebuildy
ebuildy / main.tf
Created May 29, 2024 18:48
Read YAML file from terraform
locals {
gitlab_groups_files = fileset(path.module, "../../../config/gitlab/*.yaml")
gitlab_groups_flatten = [for f in local.gitlab_groups_files : yamldecode(file(f)).groups]
gitlab_groups = ({
for group in flatten(local.gitlab_groups_flatten) :
group.path => {
name : group.name,
path : group.path,
description : try(group.description, ""),
projects : [for p in try(group.projects, []) : merge(p, group.project_defaults)]

Notebook PMS bug investigation

On doit trouver pourquoi certains produits attributes ont un stock négatifs.

On voit que reserved_quantity reste positif alors que le stock a été shipped côté PMS

query to find wrong stock

SELECT p.id_product, COUNT(*) as declinaisons, SUM(f.quantity) as q  
if ($sql)
{
$product_ids = Db::getInstance()->ExecuteS($sql);
$beginTime = microtime(true);
foreach ($product_ids as $product_id)
{
/**
#!/usr/bin/env python3
"""
To generate json plan:
terraform plan -var-file=..... -out=output.tfplan
terraform show -json output.tfplan > plan.json
"""
import argparse
{{- $podValues := .Values.unsealedJob.pod -}}
{{- $jobValues := .Values.unsealedJob.job -}}
{{- $containerValues := .Values.unsealedJob.container -}}
apiVersion: batch/v1
kind: Job
metadata:
name: vault-unsealed-{{ $jobValues.version }}
spec:
template:
spec:
@ebuildy
ebuildy / k8s_node_capacity_dashboard.json
Created June 26, 2023 20:39
grafana kubernetes node capacity dashboard
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": {
"type": "grafana",
"uid": "-- Grafana --"
},
"enable": true,
@ebuildy
ebuildy / index-compare.sh
Created June 20, 2023 15:30
Compare elasticsearch indices mapping
#!/bin/bash
##
# Requirements: jq, jd, curl
# Variables:
# - ES_AUTH --> elasticsearch auth
##
alias es_curl="curl -H "application/json" -u $ES_AUTH"
@ebuildy
ebuildy / send.json
Created February 17, 2023 18:33
elasticsearch APM get max duration percentiles for 10 minutes
POST apm-*-span/_search
{
"size": 0,
"query": {
"bool": {
"must": [
{
"range": {
"@timestamp": {
"gte": "2023-02-16T13:00:00.540Z"