Skip to content

Instantly share code, notes, and snippets.

View myselfhimself's full-sized avatar

Jonathan-David Schröder myselfhimself

  • France
View GitHub Profile
myselfhimself / parishScrapingForBrowserDeveloperToolsConsolePasting.js
Last active April 14, 2023 09:50
Parish contact details scraping into CSV
// Just paste everything in any web browser's developer console and press enter to obtain a CSV file
// This is intended for scraping parishes address details from a famous french city's website
// Taylor at your will
// Public domain - no attribution required
(() => {
let consoleLogBuffer = "";
let console_log = (s) => (consoleLogBuffer += s + "\n");
let csvSeparator = "|";
let csvHeader = [
myselfhimself /
Last active April 11, 2023 13:34
Implementing clipboard-js in Symfony / Twig with Webpack Encore

ClipboardJS allows for Flash-less copying into a device's clipboard.

Here are hints on implementing it in a Symfony setup with Wepback Encore already in place.

In the Symfony project's root directory run:

npm install clipboard --save

In /webpack.config.js, add this line:

myselfhimself / Github-based pre-invoice report
Last active November 6, 2022 02:28
Timesheet help from one's Github activity using Github CLI's `gh` and the `gh-user-activity` extension's code
# ./project_reporting.bash
# Thanks to this you know which weekdays you worked on which repository.. and can invoice with exactness
4 monday 2022-10-10 nnnnn-org/nnnproject
5 tuesday 2022-10-11 nnnnn-org/nnnproject
1 tuesday 2022-10-11 jawira/doctrine-diagram-bundle
6 tuesday 2022-10-11 nnnnn-org/nnnproject
2 wednesday 2022-10-12 nnnnn-org/nnnproject
1 wednesday 2022-10-12 jawira/doctrine-diagram-bundle
2 wednesday 2022-10-12 nnnnn-org/nnnproject
3 thursday 2022-10-13 nnnnn-org/nnnproject
myselfhimself /
Last active November 12, 2020 11:35
About G'MIC's "fx_" and "_" prefixed filters or commands

About G'MIC's fx_ and _ prefixed filters or commands, and GUI-oriented commands in general

As I have been learning G'MIC slowly for more than one year already in order to develop the gmic-py G'MIC Python binding, here is something simple and stupid I wish I knew before.

Here is what David, the creator G'MIC told me about fx_ and _-prefixed commands. I thought it would be nice to share this knowledge on the Internet :)


If you intend to write solid scripts relying on the gmic console executable, the C++ libgmic library or Python gmic-py, do it with filters whose behaviour do not change, especially no the fx_ or gimp_ ones, or most of what you see in the GIMP G'MIC plug'in's verbose output. Do to so, avoid the GUI filters, focus on the commands and filters listed on the G'MIC Reference page... Otherwise shut down the internet and prevent G'MIC from updating itself throug

myselfhimself /
Last active October 30, 2023 09:31
Debugging a C Python extension with GDB and CLion

Assuming that you are writing a compiled Python module (ie. that compiles into a .dll .so or .dynlib..) in C/C++, here are tips to setup real-time debugging, both with your own C/C++ source code and within Python's C source.

Instructions here are for Linux only. You should find your way for any different OS..

Debugging your own C/C++ code

  • have your compiled module (with no optimization -O0 and debug symbols -g) is available in your current (virtual environment):
    • for this, make a wheel for your project and load it in your virtual environment
    • OR compile your project as a .so only and make sure you set LD_LIBRARY_PATH= to the directory where your .so is located
  • test your proper module loading:
myselfhimself /
Last active July 28, 2021 08:45
Export G'MIC filters description to a JSON file

About the G'MIC GUI parser for filters (from G'MIC 2.9.0)

G'MIC stores in a zlib compressed format its list of filter parameters, with enough details that GUIs can be built to expose and manipulate them. So far, each application implementing G'MIC with a user interface would either gmic-qt which has its own parser or write their own parser for those parameters.

In order to design webservices or different types of UIs on top of G'MIC (in the case of gmic-blender, compositing/texture nodes), the JSON output format for this parser can come in pretty handy!! One little issue is that the result is long to get, so the JSON file should be generated once for all and possibly embedded in your application, with a per-release refresh.

This json file is stored online on at the url (or 291 etc.. for further G'MIC releases), with possible in-the-hour update, following the contributi

myselfhimself /
Created June 10, 2019 17:08
Quick selenium test with old Firefox on Windows
# This helped me testing successfully python 2.7 x selenium x firefox 45 setup on windows 10
# Firefox 45 x86_46 was downloaded from
# and installed with the custom wizard option allowing non-automatic background upgrades (helps if firefox is started manually by yourself)
# Mashup inspired by and
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
myselfhimself /
Last active May 19, 2022 19:16
Emulating your Python Google Cloud function locally (Python 3)

Emulating your own Python Google Cloud Function (Python >=3.6)

Python Google Cloud Functions have been introduced publically in Q3-Q4 2018. Deploying them takes time (2-10 minutes with gcloud functions deploy. Actually, a Python cloud function equates to a Flask handler. Thus, you can test them cloud function first on your own computer. This spares you from long deployments, difficult step-by-step debugging and bad GCP weather.

Here is how:

  1. keep the traditional Python Cloud Function requirements.txt and untouched.
myselfhimself / some_wordpress_bootstrapped_code.php
Created January 26, 2018 02:36
Programmatically enable no_autop (automatic p removal by tinymce), within tinymce_advanced Wordpress plugin
// This comes in handy for continuous deployment for Wordpress plugins and settings, here TinyMCE Advanced
// Enable no auto p removal in tinymce advanced editor plugin
$tadv_admin_settings = get_option('tadv_admin_settings');
$tadv_admin_settings['options'] = 'no_autop';
update_option('tadv_admin_settings', $tadv_admin_settings);
myselfhimself /
Created December 6, 2017 17:38
Convert an online BigQuery dataset's table schema into a PostgreSQL (eg. on CloudSQL) CREATE TABLE command
from import bigquery
Use this to convert an online BigQuery dataset's table schema into a PostgreSQL (eg. on CloudSQL) CREATE TABLE command.
def get_table_schema(project_name, dataset_name, table_name):
"""Return 'project_name.dataset_name.table_name''s BigQuery table schema object."""
bq_client = bigquery.Client(project=project_name)