Skip to content

Instantly share code, notes, and snippets.

View samdoran's full-sized avatar

Sam Doran samdoran

View GitHub Profile
@samdoran
samdoran / luks-encrypt-in-place.sh
Last active March 8, 2024 21:17
Encrypt a physical volume using LUKS without erasing the drive.
#!/bin/bash
# Encrypt existing hard drive in place.
# Requires a second physical drive to temporarily store data. This drive will be erased.
# This script is meant to be run on Clonezilla 1.2.9-19 or later.
# The cryptsetup syntax is different in Clonezilla than in Red Hat.
# --- Variables --- #
@samdoran
samdoran / change-root-pword.sh
Created April 4, 2013 15:34
Change root password on many machines via SSH
#!/bin/bash
#
# SSH into hosts listed in /root/Documents/machines and change root password
# Create list of hosts not online in /tmp/offline-hosts
# Assumes direct root login is available on remote machines
# Works bes if SSH keys are setup to allow passwordless login of root
# --- Variables --- #
@samdoran
samdoran / empty-snapshots.sh
Created April 9, 2013 14:25
Make empty month folders for testing snapshot cleanup.
#!/bin/bash
#
# Make empty month folders for testing backup cleanup
# --- Variables --- #
OS=$(uname -s)
HOST=$(hostname)
DESTINATION="./Backup/$HOST"
@samdoran
samdoran / tc-backup.sh
Last active December 18, 2015 08:09
Backup files on a Time Capsule to the local machine using rsnapshot.
#!/bin/bash
#
# Backup files on Time Capsule excluding sparseimages
# Needs to be passed [hourly] [daily] [weekly] [monthly]
# --- Variables --- #
# See if the Time Capsule (TC) is currently mounted.

How the hell do I [...] with git?

Committing

stage all files for commit including deletes

git add -A
@samdoran
samdoran / grub.cfg
Created July 31, 2014 05:06
Grub 2 USB Drive
# Original grub.cfg and instructions from Lance at Pendrivelinux
# http://www.pendrivelinux.com/install-grub2-on-usb-from-ubuntu-linux/
#set timeout=0
set default=0
set isopath="/iso"
menuentry "Ubuntu 12 64-bit" {
set isofile="$isopath/ubuntu-12.iso"
set gfxpayload=keep
@samdoran
samdoran / es-cluster-restart.yml
Last active December 23, 2021 00:00
Elasticsearch Playbooks
---
- name: Rolling elasticsearch cluster restart
hosts: es
serial: 1
sudo: yes
vars:
uribody_true: '{"transient":{"cluster.routing.allocation.enable":"none"}}'
uribody_false: '{"transient":{"cluster.routing.allocation.enable":"all"}}'
es_http_port: 9200
@samdoran
samdoran / shellshock-osx.yml
Created October 2, 2014 19:36
Update Bash on OS X
# All three packages must be located next to this playbook. Download them first:
# Mountain Lion: http://support.apple.com/kb/DL1768
# Lion: http://support.apple.com/kb/DL1767
# Mavericks: http://support.apple.com/kb/DL1769?viewlocale=en_US&locale=en_US
---
- hosts: osx
sudo: yes
vars:
@samdoran
samdoran / boxsync-darkmode.pl
Created January 14, 2015 17:33
Change the Box Sync menu bar icons so they look good in Dark Mode on Yosemite
#!/usr/bin/perl
#
# Fix Box Sync menu bar icons so they look good in Dark Mode
# use strict;
use warnings;
use File::Copy;
# --- Variables --- #
my $app_dir = "/Applications";
@samdoran
samdoran / rhel6 to rhel7 translation.md
Last active November 10, 2017 15:48
RHEL7 for Seasoned Sysadmins

RHEL 7 for Seasoned Sysadmins

RHEL 7 introduces quite a few changes to how basic things on the system work. This is my scratchpad of how to do things in the new OS.

Services

Show all services

systemctl list-units | grep service