Skip to content

Instantly share code, notes, and snippets.

@scalp42
Forked from nateware/gist:3955947
Created March 24, 2014 21:04
Show Gist options
  • Select an option

  • Save scalp42/9749143 to your computer and use it in GitHub Desktop.

Select an option

Save scalp42/9749143 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Get crazy throughput if you do this (>5000 puts/sec)
#
# What some customers have done is something like this: say this is the filename:
#
# mybucket/17476/26466/16.png
#
# Then to get the hash do something that seems silly but works great (pretty
# much any two characters from the hash will work):
#
# echo '/17476/26466/' | openssl dgst -md5 -hex | cut -c22-23
#
# So this key ends up being:
#
# mybucket/6e/17476/26466/16.png
#
echo $filename | cut -d/ -f1 | openssl dgst -md5 -hex | cut -c22-23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment