You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Instantly share code, notes, and snippets.
🐢
Moving slowly and fixing things
Matt Stancliff
mattsta
🐢
Moving slowly and fixing things
This is code I've freed.
This is not all my code.
You can hire me to create solutions for you in the form of process improvements and l33t code hax.
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
PoC for approximating the median of a Stream via stochastic averaging in Redis with Lua
Approximating the median of a Stream via stochastic averaging
Often it is useful to have access to the median value for fields of a data stream since they are more robust with respect to outliers.
The median is defined as the value of a dataset such that, when sorted, 50% of the data is smaller than the value and 50% of the data is larger then the value. Ordinarily this is difficult to calculate on a stream because it requires the collection and sorting of all data.
The median of a data stream can be approximated with a technique called stochastic averaging. To approximate the median value of a data stream one could use the following approach:
Given the current estimate of the median M. If the next observed value in the stream is larger than M, increase the current estimate by r (= the learning rate). If it is smaller, decrease the estimate by r. When M is close to the median, it increases as often as it decreases, and therefore it stabilizes.
This approach was taken from the book "Real-time Analytics -
Example for computing various running statistics with Lua in Redis backed by a hash
Running statistics with Redis and Lua
This is an example for computing running statistics with Lua backed by a hash in Redis.
We support counting, average (with and without exponential smoothing), stddev, variance, min, max, sum of observed values.
An example for approximating a running median can be found here: https://gist.github.com/thomasdarimont/fff68191d45a001b2d84
Data structure
We use a hash for storing various statistic value under the key "stats_value" in redis.
Note: If you need a specific alpha value for smoothing the average, then set the desired alpha -> e.g. alpha 0.7.
If alpha is 0.0 then no smoothing is applied.
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
A python script that converts MIDI message numbers to notes and instruments (and vice-versa)
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
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
(Scraped from the Internet Wayback Machine. Original content by Eran Hammer / hueniverse.com July 26, 2012)
OAuth 2.0 and the Road to Hell
They say the road to hell is paved with good intentions. Well, that’s OAuth 2.0.
Last month I reached the painful conclusion that I can no longer be associated with the OAuth 2.0 standard. I resigned my role as lead author and editor, withdraw my name from the specification, and left the working group. Removing my name from a document I have painstakingly labored over for three years and over two dozen drafts was not easy. Deciding to move on from an effort I have led for over five years was agonizing.
There wasn’t a single problem or incident I can point to in order to explain such an extreme move. This is a case of death by a thousand cuts, and as the work was winding down, I’ve found myself reflecting more and more on what we actually accomplished. At the end, I reached the conclusion that OAuth 2.0 is a bad
This Gist provides a comprehensive cheatsheet for Sieve scripts, covering various objects, attributes, parameters, and their possible values. Sieve is a powerful scripting language for filtering and organizing emails, commonly used with email clients and servers. This cheatsheet includes tests, actions, comparators, and extensions to help you cr…