Skip to content

Instantly share code, notes, and snippets.

@jcttrll
jcttrll / copy-ec2-root-volume.sh
Last active October 20, 2016 22:05
Copies a root (i.e., bootable) EC2 instance volume to a new volume, using rsync to exclude undesirable files
if findmnt -M /mnt >/dev/null 2>&1; then
umount /mnt
fi
DISK_LEADIN_BYTES=$(fdisk -l /dev/xvdb | awk '
/^Device.* Start .* End / {
# Input line will be like:
#
# Device Boot Start End Sectors Size Id Type
#
@jcttrll
jcttrll / amazon-wishlist-total.js
Created October 13, 2016 05:11
Total prices from Amazon wishlist
// No one knows why Amazon doesn't simply provide a total of item prices for wishlists.
// But with a little script in the F12 Developer Console, you can calculate a total.
Array.from(document.getElementsByClassName("g-item-sortable"))
.map((i) => {
return /\$([0-9.]+)/.exec(i.innerText)[1] - 0
})
.reduce((a,b) => {
return a+b
})
.toLocaleString([], {