Skip to content

Instantly share code, notes, and snippets.

@nashby
Created March 2, 2017 13:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nashby/331473e5a5e734d3e20280d5fc500090 to your computer and use it in GitHub Desktop.
Save nashby/331473e5a5e734d3e20280d5fc500090 to your computer and use it in GitHub Desktop.
closudinary files sizes
def get_res(nextу: nil)
Cloudinary::Api.resources(direction: 1, next_cursor: nextу, max_results: 500, resource_type: 'video')
end
def clc_bytes(resp)
resp['resources'].each { |r| $sum += r['bytes'] }
end
resp = get_res;
$sum = 0
clc_bytes(resp)
p resp['resources'].last['created_at']
while resp['resources'].last['created_at'] < 8.months.ago
resp = get_res(nextу: resp["next_cursor"])
clc_bytes(resp)
p $sum
p resp['resources'].last['created_at']
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment