Skip to content

Instantly share code, notes, and snippets.

@cristiroma
cristiroma / gist:406a3fc0f55f99576a4b293def2f4067
Created February 12, 2018 11:41
Connect from docker container to host service (mysqld)
# docker-compose.yml - creates a new network bridge
# listed in `docker network ls`.
# Note the name, i.e: `br-f60327d77bc2`
services:
tomcat:
image: tomcat:7.0
networks:
- dockernet
networks:
01 08,20 * * * /bin/certbot renew --webroot --webroot-path /var/www/html/letsencrypt --post-hook "systemctl reload httpd"
@cristiroma
cristiroma / drush.md
Last active September 20, 2018 07:42
Nice drush commands
drush sql-dump --structure-tables-list=cache,cache_*,watchdog --gzip --result-file=/abs/path/to/dump.sql
@cristiroma
cristiroma / mailx-ssl-error-sending-email.sh
Last active March 22, 2021 20:46
Error in certificate: Peer's certificate issuer has been marked as not trusted by the.
Operating System: CentOS 7
These are the steps to follow when sending email from command line using SSL, for example:
echo "" | /bin/mail -v -q -s "subject" -r [email protected] -S smtp-auth=login -S smtp=smtps://secure.emailsrvr.com:465 -S smtp-auth-user="[email protected]" -S smtp-auth-password="SECRET" [email protected]
Steps:
1. Fix the Missing "nss-config-dir" variable error
2. Pull the certificate chain using openss s_client -showcerts command
@cristiroma
cristiroma / tripwire.md
Last active September 19, 2018 05:38
Tripwire commands

Accept changes from latest report

/usr/sbin/tripwire --update --twrfile /var/lib/tripwire/report/<name>.twr

Send test email

/usr/sbin/tripwire --test --email [email protected]
server {
server_name example.com;
listen 80;
# Exception rule for certbot renewal
location ^~ /.well-known/acme-challenge/ {
default_type "text/plain";
root /usr/share/nginx/html/letsencrypt;
try_files $uri $uri/ =404;
break;
@cristiroma
cristiroma / drupal8-run-tests.sh
Created November 30, 2018 11:18
Drupal 8 core run tests
#!/bin/env bash
php core/scripts/run-tests.sh --sqlite /path/to/RAMDISK/drupal.sqlite --color --concurrency 8 --all
@cristiroma
cristiroma / settings.local.php
Last active October 17, 2019 11:47
Typical Drupal 8 settings.local.php for local development
# Database
$databases['default']['default'] = array (
'database' => 'TODO_DB',
'username' => 'TODO_DB_USER',
'password' => 'TODO_DB_PASS',
'prefix' => '',
'host' => 'TODO_DB_HOST',
'port' => '3306',
'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
'driver' => 'mysql',
@cristiroma
cristiroma / drupal-login.sh
Created September 6, 2019 10:25
Drupal Log in using cURL command line
SITE="https://www.website.com"
USER="[email protected]"
PASS="password"
# Log in and save session cookies to cookies.txt
curl -c ./cookies.txt -L -X POST $SITE/user/login -d "name=$USER&pass=$PASS&form_id=user_login_form&op=Log In"
# Make authenticated requests
curl -b cookie.txt -X GET $SITE/admin/config/development/performance
@cristiroma
cristiroma / rsync.sh
Created June 16, 2020 13:55
RSYNC 101
# Sync only images
rsync -ravz --progress --include="*/" --include="*/*.jpg" --include="*/*.jpeg" --include="*/*.png" --include="*/*.gif" --include="*/*.svg" --exclude="*" [email protected]:/path/to/folder/ .