Skip to content

Instantly share code, notes, and snippets.

@jonhattan
jonhattan / tmux.md
Last active March 9, 2018 11:03
tmux quickstart

tmux quickstart

$ tmux

CTRL+B C -> create new pane

CTRL+B [num] -> go to a pane

CTRL+D -> finish bash session, closes the pane. Closing all panes will destroy the window and thus the tmux

@jonhattan
jonhattan / migrate-one.sh
Last active February 1, 2024 14:19
[DRUPAL] Shell script to run a migration in chunks of 3k
ALIAS=@foo
MIGRATION=foo_news
LOG_FILE=/tmp/foo-migrate-logs/migration-foo_news.log
rm -f $LOG_FILE
date > $LOG_FILE
# Run migrations in chunks of 3000 items.
THRESHOLD=3000
TOTAL=$(COLUMNS=160 drush $ALIAS migrate-status $MIGRATION | tail -n 1 | awk '{print $3}')
@jonhattan
jonhattan / composer
Last active September 3, 2024 09:47
Bash wrapper to run composer via docker
#!/bin/bash
# Place this file in /usr/local/bin/composer and chmod +x
docker run --rm \
-u `id -u`:`id -g` \
--volume "${PWD}":/app \
--volume "${COMPOSER_HOME:-$HOME/.composer}":/tmp \
--volume "$SSH_AUTH_SOCK":/ssh-agent --env SSH_AUTH_SOCK=/ssh-agent \
--volume /etc/ssh/ssh_known_hosts:/etc/ssh/ssh_known_hosts \