This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TimedResourceMethodDispatchProvider implements ResourceMethodDispatchProvider { | |
final ResourceMethodDispatchProvider provider; | |
public TimedResourceMethodDispatchProvider(ResourceMethodDispatchProvider provider) { | |
this.provider = provider; | |
} | |
@Override | |
public RequestDispatcher create(AbstractResourceMethod abstractResourceMethod) { | |
RequestDispatcher dispatcher = provider.create(abstractResourceMethod); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var crypto = require('crypto'); | |
var salt = "some_salt"; | |
function place_in_interval(id) { | |
var m = crypto.createHash('md5'); | |
m.update(salt + ":" + id) | |
var key = m.digest('hex'); | |
return parseInt(key,16) / Math.pow(16,key.length); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'aws-sdk-core' | |
class GlacierAccountId < Seahorse::Client::Plugin | |
option :account_id, '-' | |
# :validate, :build, :sign, :send - where in the stack you want the middleware to apply | |
handle_request(step: :validate, priority: 99) do |context| | |
context.params[:account_id] ||= context.config.account_id | |
end | |
end |