Skip to content

Instantly share code, notes, and snippets.

Avatar
🐫
Killing bugz

Julien Bouquillon revolunet

🐫
Killing bugz
View GitHub Profile
@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
@revolunet
revolunet / README.md
Last active May 21, 2020
Setup private IPFS node
View README.md
@revolunet
revolunet / start-container.sh
Last active May 17, 2020
traefik v2 with Docker discovery and secure dashboard
View start-container.sh
#!/bin/sh
docker run -d --restart=always \
--name revominimal \
--label traefik.http.routers.revominimal.rule="Host(\`blabal.domain.com\`)" \
--label traefik.http.routers.revominimal.middlewares="https-redirect@file" \
--label traefik.port=80 \
--label traefik.frontend.entryPoints="http,https" \
--network traefik \
docker-image:latest
@revolunet
revolunet / README.md
Last active May 8, 2020
Convert Docx to ODT using docker + converter-service
View README.md

Using https://gitlab.com/zaaksysteem/converter-service

# Build and run converter server
docker run --rm -p 5032:5032 converter
 
# Magic oneliner for input.docx -> output.odt
jq -n --arg content `cat input.docx | base64` \
  '{ "to_type": "application/vnd.oasis.opendocument.text", "content": $content }' \
  | curl -X POST -H "Content-Type: application/json" -d @- http://127.0.0.1:5032/v1/convert \
@revolunet
revolunet / LoginBox.js
Created May 6, 2020
LoginBox with react-bootstrap
View LoginBox.js
import React, { useState } from "react"
import { Button, Form, Alert } from "react-bootstrap"
const LoginForm = ({ authenticate, resetPassword, onSuccess }) => {
const [status, setStatus] = useState("idle")
const [error, setError] = useState(null)
const [email, setEmail] = useState("")
const [password, setPassword] = useState("")
@revolunet
revolunet / psql.md
Last active Apr 29, 2020
PSQL tips and tricks
View psql.md

JSON dump some table

docker run--rm -e PGPASSWORD=xxx postgres:11 \
  psql -A -h 127.0.0.1 -p 5435 -U postgres postgres \
  -tc "SELECT json_agg(tests) FROM tests;" > out.json

Create bcrypt password

You can’t perform that action at this time.