Skip to content

Instantly share code, notes, and snippets.

View esolitos's full-sized avatar

Marlon (Esolitos) Saglia esolitos

View GitHub Profile
@esolitos
esolitos / script.sh
Last active March 10, 2017 14:14
Help with Wodby, Datadog, Docker
#!/bin/sh
# Some helper commands
# Get the container id based on a pid child process
ps faux | grep -C10 $MY_PID | grep "docker-containerd-shim"
# Given a container name gets the APP_NAME
# For example: $MY_CONTAINER_NAME="k8s_web-backend.416e49d_web-backend-5f3qk_bb561cbf-f330-4188-be92-2ea9f607b71f_69f3bc6a-e240-11e6-ab50-5efaafd16bc4_8950f42d"
docker exec -ti $(docker inspect --format="{{.ID}}:{{.Name}}" $(docker ps -aq --no-trunc) | grep $MY_CONTAINER_NAME | cut -f1 -d':') /usr/bin/env | grep APP_NAME
# Simplified version
varnishlog -aAD -w ./varnish-ban.log -P ./varnish-ban.pid -g raw -q "CLI ~ 'Rd ban obj.*'"
@esolitos
esolitos / .bashrc
Created February 22, 2017 11:10
Useful bash alias/function to update Drupal modules on Composer-Based Drupal 8 installations
# Update Drupal modules on composer-based setups
comp-drup() {
if [ -z "$1" ]; then echo -e "\e[31m[ERR] You MUST specify a module name\e[0m" 1>&2; return -1; fi;
if [ ! -f ./composer.json ]; then echo -e "\e[31m[ERR] Missing composer.json file. Are you sure you're in the correct directory? \e[0m" 1>&2; return -2; fi;
composer update "drupal/$1" --with-dependencies
}
@esolitos
esolitos / settings.php (D7+Composer)
Last active January 6, 2017 11:38
Drupal 7 with Composer Manager example of settings and deploy script for Wodby.
<?php
# [...] All your config
/* Composer Manager configuration */
$conf['composer_manager_vendor_dir'] = realpath(DRUPAL_ROOT .'/../vendor');
$conf['composer_manager_file_dir'] = realpath(DRUPAL_ROOT .'/..');
# [...] more stuff
@esolitos
esolitos / migrate-to-composer.sh
Last active October 27, 2016 13:45
Migrate from drush make based to composer based websites
#!/bin/sh
#
# Argument 1: Source drush-based drupal
# Argument 2: Destination composer-based drupal
#
OLD_ROOT=$1
NEW_ROOT=$2
if [ ! -d "$OLD_ROOT" ]; then
echo "Source directory not found!"
@esolitos
esolitos / deploy-config.yml
Last active October 18, 2016 08:34
Remove develop-only modules and export the config.
# This is a Drupal Console (chain file)[https://docs.drupalconsole.com/en/commands/chain.html].
# Needs to be deployed in `~/.console/chain` directory.
# Can be be run using `drupal chain --file=~/.console/chain/deploy-config.yml`.
#
# The purpouse if this chain is to remove "devel-only" modules and config from the configuration
# export, so that we can avoid issues in the syncronisation in Staging/Production.
#
commands:
# Remove 'devel' modules
- command: module:uninstall
@esolitos
esolitos / check-server.sh
Last active June 26, 2016 10:17
Auto restart Mc server with mscs
#!/bin/sh
#
# Checks if a server is running, otherwise it restarts it
SERVER=$1
if [ -z "$SERVER" ]; then
echo "Server name not provided!" 1>&2
exit 1
fi
@esolitos
esolitos / local.aliases.drushrc.php
Last active April 6, 2016 11:58
Drush Alias File for PROJECT.dev Folder Names within multisites
<?php
$all = $platforms = array();
// Use standard linux 'PATH' style, so if you need more entries separate them using a column ':' char
// For example: '/path/to/platforms/container' OR '/path/to/platforms/container:/path/to/another/location'
// This dorectory will contain one or more drupal roots directories
$platforms_path = '/var/www/platforms';
$paths = explode(':', $platforms_path);
foreach($paths as $path) {
@esolitos
esolitos / Readme.md
Last active October 17, 2019 14:17
Simple drupal module for drush scripts to re-save all the ndoes

This module simply loads and saves the nodes, it increases by 1 second the creation date and by only 5 the "last updated" on nodes.

Version: 1.3

@esolitos
esolitos / ramsaltmedia_setup_platform.sh
Last active June 22, 2019 08:07
Creates a new _Ramsalt Media_ platform and sets it up with Esolitos' default configuration.
#!/bin/sh
#
# Creates a new RamsaltMedia platform and sets it up with Esolitos' default configuration.
#
DRUSH=`which drush`
if [ -z $DRUSH ]; then
echo "ERROR: drush command not found!" 1>&2
exit -1
fi;