Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
####################################################################################
#
# Author: Lucas Halbert <https://www.lhalbert.xyz>
# Date: 01.23.2018
# Last Edited: 01.23.2018
# Version: 2018.01.23
# Description: Performs a backup of the entire slapd DIT. Can be run from cron
# License: BSD 3-Clause License
#

Keybase proof

I hereby claim:

  • I am lucashalbert on github.
  • I am lhalbert (https://keybase.io/lhalbert) on keybase.
  • I have a public key whose fingerprint is 56BF 565F DCA9 7EAB D929 707E 0247 2564 C93D 8196

To claim this, I am signing this object:

@lucashalbert
lucashalbert / ssh-reagent.sh
Last active August 6, 2018 16:55
Function to add to bashrc to remap ssh-agent after disconnect
# Function intended to remap an SSH agent socket after reconnection
function ssh-reagent() {
# find new ssh-agent socket
SSH_AUTH_SOCK=$(find /tmp/ssh-* -user `whoami` -name agent\* -printf '%T@ %p\n' 2>/dev/null | sort -k 1nr | sed 's/^[^ ]* //' | head -n 1)
# Check if SSH_AUTH_SOCK is a socket and if it is a symbolic link
if [ -S "${SSH_AUTH_SOCK}" ] && [ ! -h "${SSH_AUTH_SOCK}" ]; then
# Map SSH_AUTH_SOCK to Canonical Socket in ~/.ssh/
echo "Mapping ${SSH_AUTH_SOCK} to ~/.ssh/ssh_auth_sock as a symbolic link"
ln -sf ${SSH_AUTH_SOCK} ~/.ssh/ssh_auth_sock
@lucashalbert
lucashalbert / slapd-post-upgrade.sh
Last active January 29, 2019 17:05
Post upgrade script to run after recompiling OpenLDAP server
#!/bin/bash
####################################################################################
#
# Author: Lucas Halbert <https://www.lhalbert.xyz>
# Date: 06/12/2018
# Last Edited: 01/29/2019
# Version: 2019.01.29
# Description: Moves necessary schema and LDIF files from old slapd instance to
# newly compiled instance. Fixes permissions as necessary for slapd
# to run.
@lucashalbert
lucashalbert / delete-all-confluence-cloud-spaces.sh
Last active January 29, 2019 17:12
Deletes all iterable spaces in Confluence Cloud using the RESTful API. Requires the jq json utility.
#!/bin/bash
####################################################################################
#
# Author: Lucas Halbert <https://www.lhalbert.xyz>
# Date: 01/25/2019
# Last Edited: 01/25/2019
# Version: 2019.01.25
# Description: Leverage the Confluence Cloud RESTful API to batch delete all
# iterable spaces.
# License: BSD 3-Clause License
@lucashalbert
lucashalbert / generate-salted-sha512-hash.py
Created January 29, 2019 17:15
Script to generate a salted sha512 hash
#!/usr/bin/python
import sys;
import getpass;
import crypt;
import uuid;
password = getpass.getpass("New Password: ");
salt = uuid.uuid4().hex [0:8];
@lucashalbert
lucashalbert / Chrome-thisisunsafe.ahk
Created March 5, 2019 19:47
AutoHotKey script to send the string "thisisunsafe" when navigating to an "unsafe" page in Chrome.
; AutoHotKey script to send the string "thisisunsafe" when navigating to an "unsafe" page in Chrome.
#F5::Send, thisisunsafe
@lucashalbert
lucashalbert / slapd-backup.sh
Last active March 19, 2019 13:42
Performs a backup of the entire slapd DIT. Can be run from cron
#!/bin/bash
print_version() {
cat <<EOF
####################################################################################
#
# Author: Lucas Halbert <contactme@lhalbert.xyz>
# Date: 01.23.2018
# Last Edited: 01.23.2018
# Version: 2018.01.23
# Description: Performs a backup of the entire slapd DIT. Can be run from cron
@lucashalbert
lucashalbert / regenerate_ssh_host_keys.sh
Last active March 19, 2019 13:42
Script to regenerate SSH host keys
#!/bin/bash
print_version() {
cat <<EOF
####################################################################################
#
# Author: Lucas Halbert <contactme@lhalbert.xyz>
# Date: 10/21/2015
# Last Edited: 10/21/2015
# Version: 2015.10.21
# Description: Regenerate SSH host keys
@lucashalbert
lucashalbert / bind-util.sh
Last active March 19, 2019 13:42
Utilizes named and DNSSEC utilities to assist in generating KSKs and ZSKs as well as assisting in signing DNS zones with DNSSEC. This utility also has the ability to leverage rndc commands for reloading/refreshing zones on local and remote bind servers.
#!/bin/bash
print_version() {
cat <<EOF
##########################################################################
#
# Author: Lucas Halbert <contactme@lhalbert.xyz>
# Date: 04/29/2016
# Last Edited: 03/07/2019
# Version: 2019.03.07
# Description: Utilizes named and DNSSEC utilities to assist in