Skip to content

Instantly share code, notes, and snippets.

@MurphysChaos
MurphysChaos / guidgen
Created December 11, 2018 17:40
Generate a random GUID/UUID
#!/usr/bin/env bash
# 1. Get 16 characters (128 bits) from a pseudorandom number generator
# 2. Convert characters to hexadecimal representation
# 3. Remove spaces from string
# 4. Insert dashes
echo $(head -c 16 /dev/urandom | od -t x8 -An | sed 's/ //g' | sed -E 's/(.{8})(.{4})(.{4})(.{4})(.{12})/\1-\2-\3-\4-\5/')
@MurphysChaos
MurphysChaos / idgen
Created December 11, 2018 17:32
Generate an ID used by Xcode Interface Builder
#!/usr/bin/env bash
R=$(cat /dev/urandom | gtr -dc 'a-zA-Z0-9' | gfold -w 8 | ghead -n 1)
echo $R | gsed -E 's/(.{3})(.{2})(.{3})/\1-\2-\3/'
@MurphysChaos
MurphysChaos / npi
Created December 11, 2018 17:29
NPI check digit validator / registry query
#!/usr/bin/env bash
# npi - A tool I wrote while working for Stratice Healthcare, a former company
# developing a software solution for DME ordering. I no longer have any
# need for this tool but am keeping it around for posterity. JsonQuery (jq)
# is required for the query functionality.
# Usage:
# npi [-c <count>] [-v] [-f] [<digits>]
# Can be run with zero, nine, or ten digits. When run with zero digits,
@MurphysChaos
MurphysChaos / q
Last active December 11, 2018 17:31
Quick tool for minecraft servers.
#!/usr/bin/env bash
# Copyright (C) 2015-2018 Joel Murphy
# All rights reserved
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
@MurphysChaos
MurphysChaos / agit
Created December 11, 2018 17:06
agit - Script for multiple git repositories
#!/usr/bin/env bash
# agit - Looping Git script
# Copyright (C) 2018 Joel Murphy
# All rights reserved
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights