Skip to content

Instantly share code, notes, and snippets.

View naftulikay's full-sized avatar
🌞

Naftuli Kay naftulikay

🌞
View GitHub Profile

Keybase proof

I hereby claim:

  • I am naftulikay on github.
  • I am naftulikay (https://keybase.io/naftulikay) on keybase.
  • I have a public key whose fingerprint is 6D63 865D 1C6E EB0F 92C3 94A1 5D21 FFA2 7D8D CC66

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am naftulikay on github.
  • I am rfkrocktk (https://keybase.io/rfkrocktk) on keybase.
  • I have a public key whose fingerprint is 6D63 865D 1C6E EB0F 92C3 94A1 5D21 FFA2 7D8D CC66

To claim this, I am signing this object:

@naftulikay
naftulikay / generate-complex-passphrase.py
Created October 13, 2016 05:59
Generate a random password with a given problem space complexity.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from math import ceil, log
from string import ascii_lowercase, ascii_uppercase, digits
# use system random
from random import SystemRandom
random = SystemRandom()
@naftulikay
naftulikay / generate-shadow-pass.py
Last active December 10, 2021 16:46
Generate an /etc/shadow compatible passphrase.
#!/usr/bin/env python3
from crypt import crypt
from getpass import getpass
from random import SystemRandom ; random = SystemRandom()
from string import ascii_lowercase, ascii_uppercase, digits
salt_chars = ascii_lowercase + ascii_uppercase + digits
# generate a SHA-512 passphrase from user input with a 16 byte random salt
@naftulikay
naftulikay / fedora-kexec-demo.sh
Created October 2, 2016 20:37
Reboot a machine using kexec.
# tell kexec that when we reboot, we want the given kernel image and the given
# initramfs, and that we want to use the exact same kernel command line as was
# used to boot previously
kexec \
-l /boot/vmlinuz-4.7.5-200.fc24.x86_64 \
--initrd /boot/initramfs-4.7.5-200.fc24.x86_64.img \
--reuse-cmdline
# the above doesn't actually do the reboot, so we need to tell kexec to start
# rippin' via systemd
@naftulikay
naftulikay / git-branch-clean
Created September 30, 2016 23:51
Usage: `git branch-clean`
#!/bin/bash
# Usage: git branch-clean
#
# Removes all branches which have been successfully merged safely.
# Uses -d instead of -D to ensure only merged branches will be
# deleted.
#
# Install this script on your PATH somewhere.
set -ex

RabbitMQ TLS Config in Puppet/Hiera

# enable rabbitmq ssl port
rabbitmq::ssl: true
rabbitmq::ssl_cert: "%{::pki_public_dir}/mydomain.com.pem"
rabbitmq::ssl_cacert: /etc/pki/tls/certs/ca-bundle.crt
rabbitmq::ssl_key: "%{::pki_private_dir}/mydomain.com.key"
rabbitmq::ssl_versions: [tlsv1.2, tlsv1.1]
rabbitmq::ssl_ciphers: ['dhe_rsa,aes_256_cbc,sha256']

RabbitMQ Clustering on RHEL7

The version of RabbitMQ provided in the RHEL7 (and CentOS 7) repositories is too old and does not have declarative clustering available. Therefore, it is necessary to get a newer version of RabbitMQ and then to work around what is lacking in the newer package version.

Checklist:

  • Install PackageCloud RabbitMQ (official) RPM repository.
  • Install RabbitMQ >= 3.6.5.

Keybase proof

I hereby claim:

  • I am rfkrocktk on github.
  • I am rfkrocktk (https://keybase.io/rfkrocktk) on keybase.
  • I have a public key whose fingerprint is 6D63 865D 1C6E EB0F 92C3 94A1 5D21 FFA2 7D8D CC66

To claim this, I am signing this object:

@naftulikay
naftulikay / s3-cloudfront-invalidation.sh
Last active November 7, 2022 21:44
Sync a directory to S3 and invalidate the CloudFront cache for changed resources.
#!/bin/bash
# output format is like this:
# upload: index.html to s3://$BUCKET/index.html
#
# so we grab the second item which is the file path and pass that via xargs to the
# cloudfront invalidation command
aws s3 sync --sse AES256 s3://$BUCKET/ site/ | awk '{print $2;}' | \
xargs aws cloudfront create-invalidation --distribution-id $CF_DISTRO_ID --paths