Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env bash
set -e
if [ -z "$iso" ] ; then
printf -- ">>> You must invoke with iso=/path/to/winxp.iso $(basename $0)\n"
exit 1
fi
if [ -z "$url" ] ; then
$ echo quote what? ; read quoteme ; printf %q "$quoteme" ; echo
quote what?
The horse said "$)#*@(!!%" when he stubbed his hoof.
The\ horse\ said\ \"\$\)#\*@\(\!\!%\"\ when\ he\ stubbed\ his\ hoof.
$

Manatee Brain Transplant

The goal of this process is to upgrade a manatee of any vintage to Manatee v2. It relies on ZFS send/recv to replicate the data, but is limited to a migration between nodes in ONWM.

step 1. upgrade moray

Upgrading moray to a forward/backward compatible version is a prerequisite of the upgrade. The usual process is to disable one moray node, double-check the stack reconnects correctly, reprovision that node, and then repeat for other moray nodes.

If there is only one moray node deployed, deploying a second using the new image allows you to upgrade the original node as above.

@qdzlug
qdzlug / batcharge.py
Last active August 29, 2015 14:16 — forked from remy/batcharge.py
#!/usr/bin/env python
# saved to ~/bin/batcharge.py and from
# http://stevelosh.com/blog/2010/02/my-extravagant-zsh-prompt/#my-right-prompt-battery-capacity
#!/usr/bin/env python
# coding=UTF-8
import math, subprocess
p = subprocess.Popen(["ioreg", "-rc", "AppleSmartBattery"], stdout=subprocess.PIPE)
output = p.communicate()[0]
# Phase 1 Retrieves directories, creates hierarcy from current working directory.
mfind -t d ~~/stor/winfoo | sed "s,/$MANTA_USER/stor/,," | xargs -I {} mkdir -p "{}"
# This retrieves object paths, splits into download file and target local directory file
# Phase 2 retrieves objects, splits into source/target directories, calls mget
mfind -t o ~~/stor/winfoo | tee dnldfiles.txt | sed -e "s,/$MANTA_USER/stor/,," | xargs -I {} dirname "{}" > dnlddirs.txt
# the dnlddirs.txt file can be prepended with a target directory or windows-ified
cat dnldfiles.txt | xargs -I {} basename "{}" > dnldnames.txt
mfind -t o ~~/stor/winfoo | xargs -I {} mrm "{}"
mfind -t d ~~/stor/winfoo | sort -r | xargs -I {} mrmdir "{}"
echo /${MANTA_USER}/${USER_PATH}/${USER_ORIGINALS}/input_list.txt | \
mjob create ${MJOB_ARGS} "xargs mcat" -m "${CONVERT_JOB} && ${MPIPE_STR} < ${PDIR_STR}"
mfind ~~/public/originals | mjob create 'mrm $MANTA_INPUT_OBJECT'
#!/bin/bash
SITE="https://us-east.manta.joyent.com/mantademo/public/images/getty-open/"
DEST="/$MANTA_USER/public/"
# For more files change "-20" below to a larger number.
# For the complete download, remove "head -20 |" below
mmkdir -p ${DEST}/originals
curl -ksL ${SITE}/filelist.txt | head -20 | mput ${DEST}/filelist.txt
echo ${DEST}/filelist.txt | mjob create -m "xargs -I {} sh -c 'curl -ksL ${SITE}/originals/{} | mput ${DEST}/originals/{}'"