Skip to content

Instantly share code, notes, and snippets.

Avatar
🐫
Killing bugz

Julien Bouquillon revolunet

🐫
Killing bugz
View GitHub Profile
@revolunet
revolunet / sync.sh
Last active Jun 21, 2021
backup/restore some volume/db
View sync.sh
#!/bin/sh
#
# Volumes
#
# copy preprod
kubectl --context dev2 --namespace xxx-224-preprod-dev2 cp strapi-68db665b4f-qlxzx:/app/public/uploads ./xxx-preprod
# to prod
@revolunet
revolunet / README.md
Last active Jun 10, 2021
kubectl memo. some bash/jq/yq/kubectl black magic
View README.md

List all images in use :

#!/bin/sh

CONTEXT=dev2
CONTAINERS=$(kubectl --context $CONTEXT get pods --all-namespaces -o json | jq  '.items[] | {namespace:.metadata.namespace,name:.metadata.name,image:.spec.containers[].image}')
INITCONTAINERS=$(kubectl --context $CONTEXT get pods --all-namespaces -o json | jq  '.items[] | select(.spec.initContainers | length > 0) | {namespace:.metadata.namespace,name:("initcontainer-" + .metadata.name),image:.spec.initContainers[].image}')
JOBS=$(kubectl --context $CONTEXT get jobs --all-namespaces -o json | jq  '.items[] | 
{namespace:.metadata.namespace,name:("job-" + .metadata.name),image:.spec.template.spec.containers[].image}')
@revolunet
revolunet / example.js
Created Feb 1, 2021
hast-util-find-and-replace
View example.js
const parse = require("rehype-parse");
const unified = require("unified");
const findAndReplace = require("hast-util-find-and-replace");
const stringify = require("rehype-stringify");
// mapping with texts to replace
// todo: generate variations with diacritics
const valueMap = [[/réclamation/i, (text) => getTooltipElement(text)]];
// replace matches with this
@revolunet
revolunet / tech.md
Last active Dec 16, 2020
Convention fiche tech
View tech.md

Startup

Liens

  • Code source :
  • Doc :

Outils projet

  • trello ?
@revolunet
revolunet / ds-fetch.py
Created Nov 20, 2020
Python fetch dossiers demarches simplifiées
View ds-fetch.py
#
# Fetch les 100 premiers dossiers d'une démarche DS
#
# usage: DS_TOKEN=xyz python3 ds-fetch.py
#
import requests
import os
import json
View extract-outils-refs.js
const fetch = require("node-fetch");
// remove some garbage from legifrance urls
const cleanUrl = (url) => {
if (!url.match(/https?:\/\//)) {
return null;
}
const u = new URL(url);
const acceptableKeys = [
"idSectionTA",
View main.go
package main
import (
"crypto/aes"
"crypto/cipher"
"crypto/rsa"
"crypto/sha256"
"encoding/binary"
"errors"
"fmt"
@revolunet
revolunet / seal.js
Last active Aug 7, 2020
sealed-secret-encrypt not working
View seal.js
//
// attempt to convert original HybridEncrypt source // https://github.com/bitnami-labs/sealed-secrets/blob/946a69eb52f9874fe871d3ce08eb205726380931/pkg/crypto/crypto.go#L35
// online GO REPL : https://repl.it/@revolunet/sealed-secrets-HybridEncrypt#main.go
// algo description : https://github.com/bitnami-labs/sealed-secrets/blob/master/docs/crypto.md
//
// this give : type: 'Warning' reason: 'ErrUnsealFailed' Failed to unseal: no key could decrypt secret (VALUE)
//
const crypto = require("crypto");
@revolunet
revolunet / ingress.yml
Created Jun 30, 2020
Kubernetes nginx ingress controller to proxy remote basic auth. useful eg for kibana
View ingress.yml
apiVersion: v1
kind: Service
metadata:
name: external1
spec:
type: ExternalName
ports:
- port: 80
protocol: TCP
targetPort: 9243