Skip to content

Instantly share code, notes, and snippets.

@mikedamoiseau
mikedamoiseau / cakephp-last-executed-query
Created Jul 9, 2014
CakePHP - Display last executed SQL query
View cakephp-last-executed-query
$dbo = $this->Job->getDatasource();
$logs = $dbo->getLog();
$lastLog = end($logs['log']);
debug( $lastLog['query'] );
@mikedamoiseau
mikedamoiseau / backup-db.sh
Last active Sep 9, 2021
Script to backup a MySQL database and send the dump by email and/or scp
View backup-db.sh
#!/bin/bash
# ----------------------------------
# DEFINED - Global variables
# ----------------------------------
# defined temporary folder
DBBACKUP="dbbackup"
# database configure
@mikedamoiseau
mikedamoiseau / .gitconfig
Created Jun 17, 2021 — forked from robmiller/.gitconfig
Some useful Git aliases that I use every day
View .gitconfig
#
# Working with branches
#
# Get the current branch name (not so useful in itself, but used in
# other aliases)
branch-name = "!git rev-parse --abbrev-ref HEAD"
# Push the current branch to the remote "origin", and set it to track
# the upstream branch
publish = "!git push -u origin $(git branch-name)"
View facetime-ubuntu.md
@mikedamoiseau
mikedamoiseau / gist:1d05957077b3c72ab7fd5ac06330e8a5
Created Sep 26, 2020
Format drive partition to exFAT on Ubuntu
View gist:1d05957077b3c72ab7fd5ac06330e8a5
Need to install these tools:
`sudo apt install exfat-utils exfat-fuse`
Use software `Disks`
@mikedamoiseau
mikedamoiseau / ftp-download-upload.md
Created Sep 16, 2020
FTP: Download and upload through command line
View ftp-download-upload.md

Download

wget -m --user="user@login" --password="Pa$$wo|^D" ftp://server.com/

Upload

  1. Download NcFTP
  2. ~/ncftp-3.2.6/bin/ncftpput -R -v -u "USERNAME" HOST REMOTE_FOLDER LOCAL_FOLDER
@mikedamoiseau
mikedamoiseau / d8-backup-db.sh
Created Aug 28, 2020
Drupal - Backup DB using Drush
View d8-backup-db.sh
#!/bin/bash
# staging or production
DB_ENV="staging"
##### DO NOT EDIT FROM HERE #####
# Find the container
CONTAINER="$(docker ps | grep c-${DB_ENV} | awk '{print $1}')"
View d8-reinit-updb.sh
drush ev "drupal_set_installed_schema_version('aaa_sigel', 8109);"
@mikedamoiseau
mikedamoiseau / drupal-create-new-paragraph.md
Last active Aug 26, 2020
Drupal 8 - Steps to create a new paragraph
View drupal-create-new-paragraph.md
  1. Create paragraphs
  2. People > Permissions
  • View content: "Gast" and "Angemeldete Benutzer" ("Guests" and "Authenticated users")
  1. Create Image style
  • S, M, L, L 2x Image Style Name S / Image Style Name M / Image Style Name L / Image Style Name L 2x
  1. Create Responsive Image Style
  • apply the breakpoints
  1. Add fields to the parent paragraph
  2. Manage form display