Skip to content

Instantly share code, notes, and snippets.

@leachryan
leachryan / uuid.sh
Last active May 3, 2024 20:00
MacOS UUID Generator
# uuidgen generates a UUID, but in capital letters
# The generated UUID is piped into tr which transforms it to lowercase
# The lowercase output is piped into another tr, but this removes any newline characters
# Finally, that output is piped into pbcopy, which copies the UUID to the clipboard
uuidgen | tr "[:upper:]" "[:lower:]" | tr -d '\n' | pbcopy
@leachryan
leachryan / calculateUPC.php
Created December 7, 2018 14:32
Calculate 12 digit UPC from an 11 digit UPC
<?php
/**
* Compute the check digit of a UPC
*
* Example : 01595830676
* Product : 015958306760
*
* @param string $upc
* @return string $upc