Skip to content

Instantly share code, notes, and snippets.

@mikedamoiseau
mikedamoiseau / wget-download-ftp-recursive-folder
Created September 22, 2015 08:14
How to download a folder with all its content recursively using wget
Use this command line:
wget -r -nH --cut-dirs=3 -nc --ftp-user=jfc-ftp --ask-password ftp://jfc.bitbakers-kunden.de//htdocs/wp-content/uploads
And give the password. Better to use --ask-password so that the password is not saved in the history of the bash
@mikedamoiseau
mikedamoiseau / wp-setup.sh
Created October 21, 2016 10:05
Wordpress project - setup script
#!/bin/bash
# This setup script is to be used for new Wordpress project setup
# The file structure should be like this:
# /var/www/root-folder-project
# |_ /htdocs/
# |_ /dev/setup.sh
#
# The website will be installed in the `htdocs` folder
# if you can't execute the script, try `chmod +x ./setup.sh`
@mikedamoiseau
mikedamoiseau / relaunch-services.sh
Last active March 30, 2017 14:53
Script to automatically relaunch Nginx and MySQL servers
#!/bin/bash
#settings
EMAIL="me@example.com"
SUBJECT="THE EMAIL SUBJECT"
# date
DATETIME=$(date +%F_%T)
DATE=$(date +"%Y-%m-%d")
@mikedamoiseau
mikedamoiseau / backup-db.sh
Last active November 27, 2022 07:23
Script to backup a MySQL database and send the dump by email and/or scp
#!/bin/bash
# ----------------------------------
# DEFINED - Global variables
# ----------------------------------
# defined temporary folder
DBBACKUP="dbbackup"
# database configure
@mikedamoiseau
mikedamoiseau / gist:c4a7b92cf831b32fbe4a5a0f0e878c5c
Last active July 6, 2017 03:23
Alias to ssh with password
1. Install sshpass `sudo apt-get update && sudo apt-get install sshpass`
2. edit file `~/.bash_aliases`
3. add the line `alias name_of_alias='sshpass -f <(printf "%s\n" "our_password") ssh user@hostname'
4. compile your `.bash_aliases` file: `source .bash_aliases``
@mikedamoiseau
mikedamoiseau / drupal-create-new-paragraph.md
Last active August 26, 2020 04:24
Drupal 8 - Steps to create a new paragraph
  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
drush ev "drupal_set_installed_schema_version('aaa_sigel', 8109);"
@mikedamoiseau
mikedamoiseau / d8-backup-db.sh
Created August 28, 2020 08:46
Drupal - Backup DB using Drush
#!/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}')"
@mikedamoiseau
mikedamoiseau / ftp-download-upload.md
Created September 16, 2020 09:26
FTP: Download and upload through command line

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 / gist:1d05957077b3c72ab7fd5ac06330e8a5
Created September 26, 2020 07:47
Format drive partition to exFAT on Ubuntu
Need to install these tools:
`sudo apt install exfat-utils exfat-fuse`
Use software `Disks`