Skip to content

Instantly share code, notes, and snippets.

View jfautley's full-sized avatar

Jon Fautley jfautley

View GitHub Profile

Keybase proof

I hereby claim:

  • I am jfautley on github.
  • I am jfautley (https://keybase.io/jfautley) on keybase.
  • I have a public key ASBYbsgCiBUievdFzhUsfgkTD3_Oa-rTgW0f4cxPDCEsNQo

To claim this, I am signing this object:

@jfautley
jfautley / sss-calculate-hash.py
Created April 24, 2019 08:46
Calculate SSSD ldap_id_mapping ID from AD Domain SID. Likely full of bugs. Doesn't rely on NSS/SSSD being installed, as its a reimplementation of the generation algorithm in Python.
#!/usr/bin/python
import sys
import mmh3
# https://pagure.io/SSSD/sssd/blob/master/f/src/lib/idmap/sss_idmap_private.h
IDMAP_UPPER = 2000200000
IDMAP_LOWER = 200000
IDMAP_RANGE = 200000
max_slices = (IDMAP_UPPER - IDMAP_LOWER) / IDMAP_RANGE
# Create EIP and NAT Gateway (NB: Not HA as only located in a single subnet)
resource "aws_eip" "nat" {
vpc = true
}
resource "aws_nat_gateway" "nat" {
allocation_id = "${aws_eip.nat.allocation_id}"
subnet_id = "${aws_subnet.demo.id[0]}"
}
@jfautley
jfautley / gist:3945009
Created October 24, 2012 09:13 — forked from mdengler/gist:3944990
fixperms.sh
awk -F: '($3 >= 1000) { printf("%s:%s:%s:%s\n", $1, $3, $4, $6) }' /etc/passwd | while read line; do
UNAME=$(echo $line | cut -d: -f1)
USERID=$(echo $line | cut -d: -f2)
GRPID=$(echo $line | cut -d: -f3)
HMDIR=$(echo $line | cut -d: -f4)
echo "Changing user [$UNAME] with home [$HMDIR] to [$USERID:$GRPID]"
#chown -R $USERID:$GRPID $HMDIR
done