Skip to content

Instantly share code, notes, and snippets.

View revolunet's full-sized avatar
🐫
Killing bugz

Julien Bouquillon revolunet

🐫
Killing bugz
View GitHub Profile
@revolunet
revolunet / publicodes.schema.json
Last active February 29, 2024 12:57
publi.codes sample JSON-schema
{
"$schema": "https://json-schema.org/draft-07/schema",
"additionalProperties": {
"$ref": "#/definitions/mecanismes/valeur"
},
"definitions": {
"mecanismes": {
"variations": {
"title": "variations",
"markdownDescription": "Contient une liste de conditions (si) et leurs conséquences associées (alors), ainsi qu’un cas par défaut (sinon).\n\nPour la première condition vraie dans la liste, on retient la valeur qui lui est associée.\n\nSi aucune condition n’est vraie, alors ce mécanisme renvoie implicitement non.\n\nCe mécanisme peut aussi être utilisé au sein d’un autre mécanisme avec des attributs, tel que produit ou barème.\n\nDoc: https://publi.codes/docs/api/m%C3%A9canismes#variations",
@revolunet
revolunet / scalingo.schema.json
Created February 5, 2024 23:16
scalingo.json validation schema
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "scalingo.json schema https://doc.scalingo.com/platform/app/app-manifest",
"description": "Extracted from https://developers.scalingo.com/scalingo-json-schema/",
"type": "object",
"additionalProperties": false,
"properties": {
"$schema": { "type": "string" },
"name": {
"description": "Complete name of the project",
@revolunet
revolunet / publicodes.yml
Created January 23, 2024 18:16
Economies si on arrête de fumer, en publicodes
#
# https://publi.codes/studio/r%C3%A9sultat#prix%20paquet%3A%20%0A%20%20valeur%3A%2012%0A%20%20unit%C3%A9%3A%20%E2%82%AC%0A%0Aconsommation%20par%20jour%3A%0A%20%20question%3A%20Combien%20de%20cigarettes%20fumez-vous%20par%20jour%20en%20moyenne%20%3F%0A%20%20valeur%3A%208%0A%0Aeconomies%20par%20jour%3A%0A%20%20valeur%3A%20consommation%20par%20jour%20*%20(prix%20paquet%20%2F%2020)%0A%20%20unit%C3%A9%3A%20%E2%82%AC%0A%0Aeconomies%20par%20an%3A%0A%20%20valeur%3A%20economies%20par%20jour%20*%20365%0A%20%20unit%C3%A9%3A%20%E2%82%AC%0A%0Acommentaire%3A%0A%20%20variations%3A%0A%20%20%20%20-%20si%3A%20economies%20par%20an%20%3E%201500%0A%20%20%20%20%20%20alors%3A%20%22'Vous%20pourriez%20vous%20offrir%20un%20beau%20v%C3%A9lo%20%C3%A9l%C3%A9ctrique.'%22%0A%20%20%20%20-%20si%3A%20economies%20par%20an%20%3E%201000%0A%20%20%20%20%20%20alors%3A%20%22'Ca%20fait%20un%20beau%20petit%20voyage%20en%20Italie.'%22%0A%20%20%20%20-%20si%3A%20economies%20par%20an%20%3E%20500%0A%20%20%20%20%20%20alors%3A%20%22'Ca%20fait%20un%20tr%C3%
@revolunet
revolunet / verdaccio.md
Last active December 1, 2023 11:28
Verdaccio tips 👉 https://verdaccio.org

run with docker

create ~/verdaccio/conf/config.yaml from example then:

V_PATH=~/verdaccio; docker run -it --rm --name verdaccio \
  -p 4873:4873 \
  -v $V_PATH/conf:/verdaccio/conf \
  -v $V_PATH/storage:/verdaccio/storage \
 -v $V_PATH/plugins:/verdaccio/plugins \
@revolunet
revolunet / nginx.conf
Last active November 2, 2023 15:15
OpenAI API nginx timeout proxy
#
# Sometimes openai API hangs and the openai-python lib doesnt make it easy to set timeouts via llamaindex
# This nginx conf lets you pop a nginx cluster that will force to kill long queries
# Llama index for example has good request retry policy so this makes the whole thing faster
#
# Put that file in /etc/nginx/conf.d/default.conf
#
# for ex with docker: `docker run -p 8080:8080 -v $PWD/nginx.conf:/etc/nginx/conf.d/default.conf nginx:alpine3.18`
#
# Add this to your imports:
@revolunet
revolunet / docker-compose.yaml
Created October 23, 2023 22:50
minimal elastic+kibana with docker-compose
version: '3.7'
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.15.0
environment:
- "ES_JAVA_OPTS=-Xms256M -Xmx256M"
- node.name=elasticsearch
- cluster.name=docker-cluster
- cluster.initial_master_nodes=elasticsearch
ports:
# /Users/xxx/Library/Application Support/k9s/hotkey.yml
hotKey:
# Hitting Shift-0 navigates to your CNPG clusters
shift-Q:
shortCut: Shift-Q
description: Viewing CNPG clusters
command: postgresql.cnpg.io/v1/clusters
@revolunet
revolunet / downtime-monitor.sh
Last active August 31, 2023 19:41
downtime-monitor.sh : Monitor HTTP status changes on some URL with curl
#!/bin/bash
#
# request some URL and report HTTP status changes
# ./downtime-monitor.sh https://some.url
#
URL="$1"
INTERVAL=0.1
@revolunet
revolunet / examples.md
Last active August 29, 2023 21:52
Wikidata, SparQL

Querying Wikidata with SparQL

Liste des ministères

SELECT ?item ?itemLabel 
WHERE 
{
  ?item wdt:P31 wd:Q14037025. # doit avoir comme nature "ministry of France"
  FILTER NOT EXISTS {?item wdt:P576 ?filter.}. # ne doit pas avoit de "dissolved date"
@revolunet
revolunet / example.ts
Last active April 24, 2023 19:47
TypeScript + kubernetes-models
/*
run and apply with `ts-node ./example.ts | kubectlapply -f -`
*/
import { Pod } from "kubernetes-models/v1/Pod";
const pod = new Pod({
metadata: {
name: "my-pod",
namespace: "test-app",