Skip to content

Instantly share code, notes, and snippets.

View gildas-le-drogoff's full-sized avatar

Gildas Le Drogoff gildas-le-drogoff

View GitHub Profile
$sql = 'INSERT INTO users.contacts (firstname, created_at) VALUES (?, ?)';
$query = $db->prepare($sql);
$faker = Faker\Factory::create('fr_FR');
$insertedPKs = array();
for ($i = 0; $i < 100; $i++) {
$query->bindValue(1, $faker->firstName, PDO::PARAM_STR);
// $stmt->bindValue(2, $faker->lastName, PDO::PARAM_STR);
$query->bindValue(2, $faker->date("Y-m-d H:i:s"), PDO::PARAM_STR);
// $stmt->bindValue(1, $faker->email, PDO::PARAM_STR);
$query->execute();

Journalctl Cheat Sheet

Configuration

Permissions

To see messages from other users and the system as well as performing various log operations from a regular user add it to the group:

sudo usermod -aG systemd-journal $USER

MongoDB Cheat Sheet

Show All Databases

show dbs

Show Current Database

@gildas-le-drogoff
gildas-le-drogoff / cheatsheet-elasticsearch.md
Created January 29, 2023 01:33 — forked from ruanbekker/cheatsheet-elasticsearch.md
Elasticsearch Cheatsheet : Example API usage of using Elasticsearch with curl
CREATE USER `user`@`%` IDENTIFIED VIA mysql_native_password USING '*6048229B303DAF9E889FCB02B385C27823607B85' OR unix_socket;
SHOW CREATE USER `user`@`%`\G
GRANT ALL PRIVILEGES ON *.* TO `user`@`%`;
FLUSH PRIVILEGES;
SET GLOBAL general_log = 'ON';
SET GLOBAL log_output='TABLE';
SET GLOBAL slow_query_log=1;
SET GLOBAL log_output='TABLE';
SET GLOBAL long_query_time=5.0;
@gildas-le-drogoff
gildas-le-drogoff / _golden-ratio.scss
Created August 28, 2023 14:31 — forked from gregrickaby/_golden-ratio.scss
Golden Ratio Typography for Sass
//
// Golden Ratio Typography
// --------------------------------------------------
// Golden Ratio Math
//
// Let's do some math so we can build beautiful typography and vertical rhythm.
// For any magic to happen, set the $ContentWidth variable on _variables.scss
// to match your content box width (normally this is 640px, 740px, etc...).
@gildas-le-drogoff
gildas-le-drogoff / sed_cheatsheet.md
Created April 1, 2026 02:54
Sed oneline cheatsheet

Sed oneline cheatsheet —

1. Espacement de fichier

# Double interligne
sed G

# Double interligne (fichier déjà partiellement espacé)
# La sortie ne contient jamais plus d'une ligne vide consécutive