Reading Building a sliding window rate limiter with Redis, and w/o addressing the actual logic (which may or may not work).
Optimize by:
- Lua seems a much better choice: idiompotent, portable, server-side, less bandwidth, atomic...
- The call to
ZRANGEBYSCORE
seems to be unused, should be commented out if so - Looking at the use of
ZRANGE
, it appears thatZCARD
it what's actually needed
The (untested) Lua snippet:
This file contains 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
// Marker Sync Expression | |
// Modified expression based on Dan Ebbert's Marker Sync Expression | |
// Original Version: http://www.motionscript.com/design-guide/marker-sync.html | |
// Full Tutorial: https://www.youtube.com/watch?v=B_3XS2-VWOM&t=698s | |
src = comp(name).layer("Markers"); | |
n = 0; | |
if (marker.numKeys > 0) { | |
n = marker.nearestKey(time).index; | |
if (marker.key(n).time > time) { |
This file contains 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
license: mit |
This file contains 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 cnsl = true; | |
var win = this; | |
var ajax = win["XMLHttpRequest"]; | |
| |
function start() { | |
var cookie_name = "app_" + profile_id; | |
var cookie_time = 40; | |
if (!getCookie(cookie_name) || parseInt(getCookie(cookie_name)) < Date.now() - 60 * 1000 * cookie_time) { | |
createCookie(cookie_name, Date.now(), 1); | |
config = {}; |
Last updated March 13, 2024
This Gist explains how to sign commits using gpg in a step-by-step fashion. Previously, krypt.co was heavily mentioned, but I've only recently learned they were acquired by Akamai and no longer update their previous free products. Those mentions have been removed.
Additionally, 1Password now supports signing Git commits with SSH keys and makes it pretty easy-plus you can easily configure Git Tower to use it for both signing and ssh.
For using a GUI-based GIT tool such as Tower or Github Desktop, follow the steps here for signing your commits with GPG.
This file contains 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
import cv2 | |
import sys | |
class Camera(object): | |
def __init__(self, index=0): | |
self.cap = cv2.VideoCapture(index) | |
self.openni = index in (cv2.CAP_OPENNI, cv2.CAP_OPENNI2) | |
self.fps = 0 |
This file contains 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
import os | |
import yaml | |
import logging.config | |
import logging | |
import coloredlogs | |
def setup_logging(default_path='logging.yaml', default_level=logging.INFO, env_key='LOG_CFG'): | |
""" | |
| **@author:** Prathyush SP | |
| Logging Setup |
This file contains 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
mkfifo reply | |
ncat -kl 8765 < reply | ncat 127.0.0.1 4567 > reply # listens on port 8765 and redirects to localhost:4567. Runs until C-c. | |
rm reply # cleanup after end |