Skip to content

Instantly share code, notes, and snippets.

@joachimesque
joachimesque / 100.json
Last active November 22, 2024 16:47
`100.json` est l’exemple de sortie JSON que Wordpress propose pour chaque post, `import-authors.py` et `import.py` sont deux versions de la moulinette, pas vraiment faites pour être relues, mais bref.
{
"id": 100,
"date": "2012-12-07T00:00:55",
"date_gmt": "2012-12-06T23:00:55",
"guid":
{
"rendered": "http://www.24joursdeweb.fr/?p=100"
},
"modified": "2012-12-06T21:52:21",
"modified_gmt": "2012-12-06T20:52:21",
@joachimesque
joachimesque / ffmpeg_generate_frequencies.sh
Created October 26, 2018 20:43
get ffmpeg to generate an animation of the frequencies of an audio file on top of a static image, useful for podcasts and such
ffmpeg -i test.wav -y -loop 1 -i bg.jpg -filter_complex \
"[0:a]showfreqs=cmode=separate:mode=bar:ascale=cbrt:fscale=log:s=600x600:colors=#ffffff[tmp]; \
[tmp]alphaextract,format=yuv420p,split=3[box][up][down]; \
[up]crop=in_w:in_h/2:0:0[up]; \
[down]crop=in_w:in_h/2:0:in_h/2,vflip[down];[up][down]vstack[tmp]; \
[tmp]gblur=sigma=10,curves=master='0/0 0.49/0 0.51/1 1/1',format=rgba[tmp]; \
[box]drawbox=w=600:h=600:c=#ffffff:t=fill:replace=1,format=rgba[box]; \
[box][tmp]alphamerge[tmp]; \
[tmp]crop=in_w:in_h/2:0:in_h/4[tmp]; \
[1:v]scale=1280:-1,crop=in_w:720[bg]; \
@joachimesque
joachimesque / script.py
Last active August 23, 2023 15:40
A simple command line utility that returns a JSON-formatted definitions list of the handle and url of a Fediverse address/handle/url
"""Returns a JSON-formatted definitions list of the handle and url of a Fediverse address."""
import json
import re
import click
import requests
API_ASK = ".well-known/webfinger?resource=acct:"
API_REL_PROFILE = "http://webfinger.net/rel/profile-page"
@joachimesque
joachimesque / m3u.bash
Created June 27, 2023 20:50
Little bash script to display a M3U-ready file list. `m3u > list.m3u` to generate the list, ready to be ingested.
#!/usr/bin/env bash
SERVER="sftp://WHATEVER.local"
# https://askubuntu.com/questions/343727/filenames-with-spaces-breaking-for-loop-find-command#comment439889_343727
IFS=$'\n'
# https://stackoverflow.com/questions/37309551/how-to-urlencode-data-into-a-url-with-bash-or-curl
# converted to Python3 : urllib.quote => urllib.parse.quote
urlencode() {
@joachimesque
joachimesque / script.py
Created December 3, 2022 21:26
Convert a Grav pages tree to a Kirby content tree
# pip install frontmatter
# python script.py
import glob
import os
import pathlib
import re
import shutil
import frontmatter # https://pypi.org/project/python-frontmatter/
@joachimesque
joachimesque / import_libs.py
Created July 27, 2022 17:20
Python script to download and check external front-end libs
#!/usr/bin/env python3
"""Downloads and checks external front-end libs
Avoid CDNs for front-end libraries:
https://blog.wesleyac.com/posts/why-not-javascript-cdn
"""
import os
import base64
@joachimesque
joachimesque / config.php
Created January 4, 2018 15:19
CSP headers with a script-src nonce directive for Kirby
<?php
/*
---------------------------------------
CSP
---------------------------------------
*/
$csp_nonce = base64_encode(random_bytes(20));
$csp_header = "Content-Security-Policy: default-src 'self'; script-src 'self' 'nonce-" . $csp_nonce . "';";
// set `csp-nonce` so it's accessable
@joachimesque
joachimesque / get_bandcamp_tags_from_autocomplete.py
Created November 14, 2020 18:13
Get Bandcamp tags from autocomplete suggestions
import requests
from json import dumps
from csv import writer
import linecache
import sys
csv_file = open('data.csv', 'a+')
csv_writer = writer(csv_file)
current_index = int(linecache.getline('current_index.txt',1))
<main class="main" id="main" tabindex="-1">
<div class="content">
<h1 class="separation separation--primary">
Archives
</h1>
<p>Revoir et explorer les éditions précédentes de Paris Web, plus de 350 conférences à (re)découvrir !</p>
<form id="search-filters" action="/pages/archives/" method="get">
<div class="form-oneline form-oneline--inline">
<div class="form-oneline__field form-field">
<div class="form-field__label">

Quoi faire ?

v1.2.4
2019-09-20

Importance de l’action environnementale en entreprise

Entre « petits gestes » (changer ses ampoules, des gestes militants mais seulement en tant que consommateurs) et « grands gestes politiques » (régulation d’industries ou désinvestissement, très efficaces mais inaccessibles aux citoyens), l’action en entreprise est un troisième levier : le collectif peut agir sur l’impact environnemental/énergétique de l’ensemble.

Trois axes par le biais desquels on peut agir sur l’impact d’une entreprise :