Skip to content

Instantly share code, notes, and snippets.


Jonathan-David Schröder myselfhimself

  • France
View GitHub Profile
myselfhimself /
Last active Nov 12, 2020
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 Apr 13, 2021
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 Jul 28, 2021
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 Jun 10, 2019
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
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 Jan 26, 2018
Programmatically enable no_autop (automatic p removal by tinymce), within tinymce_advanced Wordpress plugin
View some_wordpress_bootstrapped_code.php
// 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 Dec 6, 2017
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)
myselfhimself /
Created Dec 6, 2017
Copying directory contents onto a Google Cloud Compute engine's instance with scp
gcloud compute scp --project "myproject" --zone "my-zone" --scp-flag=-r ~/my-local-path "remote-image-name":/home/my-remote-path