Skip to content

Instantly share code, notes, and snippets.

View crakreydiak's full-sized avatar

Jean-Charles Verdier crakreydiak

View GitHub Profile
@crakreydiak
crakreydiak / jq-insert-root.md
Last active October 23, 2023 19:06
JQ wizadry

Add key, value pair to every object in a JSON file where the root element is an array

Content of data.json

[
 { "foo": "bar" },
 { "foo": "bar" }
]
@crakreydiak
crakreydiak / mysql-docker.sh
Created February 7, 2023 13:11 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE