Skip to content

Instantly share code, notes, and snippets.

@otsuarez
otsuarez / Makefile
Created March 31, 2021 19:27
keeping notes
WEEK := "$(shell date +%Y)/$(shell date +%m)"
all: help
check: ## check connection
@ssh -T git@github.com
save: ## commit and push
git add . ; git commit -am'update docs' ; git pull ; git push
tmux: ## run tmux session
@otsuarez
otsuarez / drupal-backup.sh
Created January 3, 2021 16:47
drupal db backup script
#!/bin/bash
# usage: drupal-quick-dump user host database
usage() {
echo -e "usage:"
echo -e "\tdrupal-db-backup [dir]"
echo -e "params:"
echo -e "\tdir\tdirectory for the settings.php file"
}
@otsuarez
otsuarez / mosh-and-tmux.md
Last active January 4, 2020 20:28
tips for using mosh and tmux

Add to ~/.bashrc on client:

tmosh() {
  mosh --no-init $1 -- tmux new-session -ADs main
}  
@otsuarez
otsuarez / Makefile
Last active January 4, 2020 14:37
Makefile for docs
all: help
save: ## save work
git add . ; git commit -am'doc updates' ; git pull ; git push
watch: ## run save in tmux
tmux new-session -s "docs" \; send-keys 'watch make save' C-m \; split-window -v \;
.PHONY: help
@otsuarez
otsuarez / kustomize-with-vars.sh
Created January 2, 2020 19:09
using kustomize with vars
#!/usr/bin/env bash
set -eu
set -o pipefail
# TMPDIR="$(mktemp -d)"
# pushd $TMPDIR 2>&1 >/dev/null
[ -d "base" ] || mkdir -p base/app dev/kustomizeconfig
@otsuarez
otsuarez / kustomize-vars-demo.sh
Created December 31, 2019 21:07
Using vars in kustomize
#!/usr/bin/env bash
set -eu
set -o pipefail
TMPDIR="$(mktemp -d)"
pushd $TMPDIR 2>&1 >/dev/null
[ -d "app" ] || mkdir app kustomizeconfig
@otsuarez
otsuarez / .profile
Last active January 17, 2019 19:18
tmux.conf
# set PATH so it includes user's private bin directories
PATH="$HOME/bin:$HOME/.local/bin:$PATH"
if [[ "$SSH_TTY" != "" ]]
then
if [[ "$TERM" != "screen" ]]; then
screen -dr default
if (($?)); then
screen -ln -S default
fi
fi
@otsuarez
otsuarez / README.md
Last active December 4, 2016 18:47
ns1 xfer to pdns

tl;dr

  1. User creates zone (authorizing xfer from pdns server) and adds record
  2. Ns1 site sends notify to pdns server
  3. Listener service detects the notify
  4. Listener creates the zone in pdns's db if not exists
  5. Pdns detects it has a slave zone unsync'ed with the master's one (in ns1) and request a xfer update.
  6. Pdns syncs the slave zone and applies future updates from then on.

create zone and record

cd /var/www
drush dl drupal-7
mv drupal-7.41 html
cd html
# set variables ...
drush -v site-install standard --db-url=mysql://${DB_USER}:${DB_PASS}@localhost/${DB_NAME} --account-name=${ADMIN_USER} --account-pass=${ADMIN_PASS} --account-mail=${MAIL} --site-name="${SITE_NAME}" --site-mail=${MAIL}
drush --yes dl restful
# Download and enable module and its dependencies
drush --yes dl registry_autoload
drush --yes dl entity_validator-7.x-2.0