Skip to content

Instantly share code, notes, and snippets.

View renshuki's full-sized avatar
🇫🇷 🇯🇵 🇺🇸

Francois-Clement Brossard renshuki

🇫🇷 🇯🇵 🇺🇸
View GitHub Profile
renshuki /
Last active April 23, 2024 13:04
Ubuntu 16.04 + Terminator + Oh My ZSH with Agnoster Theme

Install Terminator (shell)

sudo add-apt-repository ppa:gnome-terminator
sudo apt-get update
sudo apt-get install terminator

Terminator should be setup as default now. Restart your terminal (shortcut: "Ctrl+Alt+T").

Install ZSH

renshuki /
Last active March 4, 2024 13:23
Elasticsearch - Bulk index from a JSON file hits (with jq)
cat file.json | jq -c '.hits.hits[] | { index: {_index:._index, _type:._type, _id:._id}}, ._source' | curl -XPOST -H "Content-Type: application/x-ndjson" localhost:9200/_bulk --data-binary @- | jq .
renshuki / recalculate-acf-locations.php
Last active July 7, 2023 01:15 — forked from RadGH/recalculate-acf-locations.php
Update ACF location fields (Google Map) after WP All Import CSV import (Google map update not triggered correctly) - Credits:
global $ld_recalc;
global $geolocate_api_key;
$geolocate_api_key = "YOUR_GOOGLE_GEOLOCATE_API_KEY";
$ld_recalc = array(
'posts_per_run' => 16,
'post_types' => array( 'distributor' ),
renshuki /
Created October 16, 2019 08:57
Elasticsearch - Painless script to compare the current date with a date already indexed into a document

Elasticsearch Painless script which aims to calculate the difference in days between a date indexed into a document and the current date.

GET days_compare/_search
  "script_fields": {
    "diffdate": {
      "script": {
        "lang":   "painless",
 "source": """
renshuki /
Created May 19, 2022 07:17

If you get a NET::ERR_CERT_COMMON_NAME_INVALID when trying to connect to Kibana from your browser, it means the CN and/or SAN you defined at the certificate generation is incorrect. Please refer to the Encrypt traffic between your browser and Kibana documentation for more details on how to properly generate a server certificate for Kibana.

renshuki /
Last active May 10, 2022 13:30
Elasticsearch threadpool size details using _cat/thread_pool API

Run GET _cat/thread_pool?v&h=node_name,name,max,pool_size,size,type,queue_size

Gives you details on Elasticsearch threadpool size, type, queue_size.

Example output

node_name           name                                    max pool_size size type                  queue_size
instance-0000000009 analyze                                             0    1 fixed                         16
instance-0000000009 ccr                                                32   32 fixed                        100
renshuki /
Last active November 1, 2021 18:42
Wordpress SQL query to find posts having both tags

Please replace TAG ID 1 and TAG ID 2 by the tags you are looking for.

FROM wp_posts AS p
JOIN wp_term_relationships AS tr ON = tr.object_id
JOIN wp_term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id
JOIN wp_terms AS t ON tt.term_id = t.term_id
WHERE t.term_id=_TAG ID 1_ OR t.term_id=_TAG ID 2_ AND p.post_type LIKE 'post'
renshuki /
Created September 27, 2019 11:05
Elasticsearch CSV import via File Data Visualizer (ML) - Convert latitude and longitude column to geo_point using ingest pipeline
  1. Choose your CSV file to import including your coordinates data and upload it


lat,long, timestamp
renshuki /
Created August 13, 2021 04:35
Enable Kibana legacy data table visualization (prior to EUI datagrid)

Add vis_type_table.legacyVisEnabled: true to kibana.yml

renshuki /
Created May 11, 2019 08:51
How to enable slowlogs for all indices and tweak slowlog logger level

Slowlog thresholds for all indices

Add slowlog thresholds for all indices

PUT /_all/_settings 
"": "10s",
"": "5s",
"": "2s",