Skip to content

Instantly share code, notes, and snippets.

View atomaras's full-sized avatar

Anargyros Tomaras atomaras

  • Esri
  • United States
View GitHub Profile
@atomaras
atomaras / redis-lua-sliding-window-rate-limiter-with-remaining-tokens-support.lua
Created March 28, 2024 01:07
Redis Lua Script that implements the Sliding Window Rate Limiting algo with support for returning remaining_tokens
local curr_key = KEYS[1] -- Get the key from the KEYS array.
local current_time = redis.call('TIME') -- Get the current server time.
local current_seconds = tonumber(current_time[1]) -- Extract the seconds part and convert it to a number.
local num_windows = tonumber(ARGV[1]) -- Get the number of windows/rules from the first argument.
local request_counts = {} -- Store the request counts for each window.
-- Iterate through each window/rule to check the rate limits and get initial request counts.
for i = 2, num_windows * 2, 2 do
local window_seconds = tonumber(ARGV[i]) -- Get the window duration in seconds.
@atomaras
atomaras / odata-v7.18-regression.cs
Created February 22, 2024 17:46
Odata.Core v7.18 regression
using Microsoft.OData.ModelBuilder;
using Microsoft.OData.UriParser;
namespace LearnOdata;
internal class Program
{
static void Main(string[] args)
{
// create the Edm Model
@atomaras
atomaras / controllers.application.js
Last active March 16, 2017 20:52
Flex Liquid-Fire
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
show: true,
notShow: Ember.computed.not('show')
});
import Ember from 'ember';
export default Ember.Component.extend({
a:'initial'
});
@atomaras
atomaras / PullToRefreshListView.cs
Last active April 15, 2016 07:01
PullToRefreshListView Control for UWP
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Runtime.InteropServices.WindowsRuntime;
using System.Windows.Input;
using Windows.Foundation;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Media;