Skip to content

Instantly share code, notes, and snippets.

View ainsofs's full-sized avatar

Ainsof So'o ainsofs

View GitHub Profile
@ainsofs
ainsofs / composer.json
Last active March 4, 2025 03:17
Composer helper scripts for Drupal
"scripts": {
"build": [
"drush site:install minimal --existing-config --db-url=mysql://root:password@mariadb:3306/drupal -y",
"drush cr"
],
"build2": [
"drush site:install --existing-config --db-url=mysql://root:password@mariadb:3306/drupal -y",
"drush cr"
@ainsofs
ainsofs / .gitignore
Last active February 24, 2025 23:46
docker4drupal gitpod setup
# Ignore gitpod files
.env.gitpod
@ainsofs
ainsofs / generator.md
Last active January 23, 2025 02:30
Salt generator for drush

https://drupalsun.com/eelke/2018/08/24/quick-tip-generating-hash-salt-drupal-8

Use this to generator a salt hash so that its not included in your settings.php file if you commit that file to your repo.

cli

drush php-eval 'echo \Drupal\Component\Utility\Crypt::randomBytesBase64(55)' > salt.txt

// alternative
drush php-eval 'echo \Drupal\Component\Utility\Crypt::randomBytesBase64(55)' > drupal\salt.txt
@ainsofs
ainsofs / captureScreenshot.php
Created January 20, 2025 02:14
Make screenshot window bigger
// make screenshot window bigger using https://git.drupalcode.org/project/dtt
$session = $this->getSession();
$session->resizeWindow(1920, 1080); // Full HD resolution
$this->captureScreenshot($tp->id());
@ainsofs
ainsofs / restart_wodby.sh
Created November 5, 2024 00:12
Helper script to restart docker services
#!/bin/bash
# ref https://wodby.com/docs/1.0/infrastructure/disk/#3-moving-docker-and-wodbys-data-to-new-volume
echo "Stopping all Kubernetes components and Docker..."
# Stop all services in parallel
systemctl stop kube-apiserver &
systemctl stop kube-controller &
systemctl stop kube-kubelet &

install upgrade status

composer require drupal/upgrade_status --dev
drush en upgrade_status

analyse custom modules

drush upgrade_status:analyze --all --ignore-contrib

install drupal rector for automated fixes

@ainsofs
ainsofs / .bash_aliases
Last active February 13, 2025 07:19
Dot files
# docker aliases
## https://gist.github.com/ainsofs/ba947741b230606be5d2f4aad6faf7bf
## common
alias dc='docker compose'
alias dup='docker compose up -d --remove-orphans'
alias dstop='docker compose stop'
alias drm='docker compose rm'
## helpers
alias dupp='docker compose up -d && docker compose exec php bash' # Start project and open php container.
@ainsofs
ainsofs / user_requirement_template.md
Last active August 7, 2023 23:25
User requirements template

002 - Some Title

Brief sentence or two.

Primary Actor

Customer

Precondition(s)

@ainsofs
ainsofs / check.txt
Created April 23, 2023 23:07
Check which process is using a port and show details
# display all processes running on port 80
netstat -aon | findstr 0.0:80
# diplay the process details
tasklist /FI "PID eq 18748"
@ainsofs
ainsofs / table-size.sql
Created July 26, 2022 21:13
Get table sizes on Ms SQL
-- DROP TABLE #tmpTableSizes
CREATE TABLE #tmpTableSizes
(
tableName varchar(100),
numberofRows varchar(100),
reservedSize varchar(50),
dataSize varchar(50),
indexSize varchar(50),
unusedSize varchar(50)
)