Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html>
<body>
<script src="https://unpkg.com/@lottiefiles/lottie-player@latest/dist/lottie-player.js"></script>
<lottie-player src="https://assets3.lottiefiles.com/packages/lf20_hdReMa.json" background="transparent" speed="1" style="width: 300px; height: 300px;" loop controls autoplay></lottie-player>
</body>
</html>
@jmizgajski
jmizgajski / dato_offset_cumsum.py
Created August 3, 2015 15:59
Cumsum prototype using dato distributed SFrame methods
def offset_cumsum(sf, group_by, ordering, summed_column, starting_element=0, prefix='', suffix='_cumsum'):
import graphlab as gl
from copy import copy
from itertools import islice
def _cumsum(l, initial, element=lambda (_, i): i, op=lambda acc, el: acc + el):
prev = copy(initial)
yield list(l[0] + (copy(initial),))
if isinstance(initial, collections.Iterable):
for i in islice(l, 1, None):
@jmizgajski
jmizgajski / moses.lua
Created May 15, 2014 10:34
Mnified moses (Underscore for Lua) prepared for usage with redis scripts.
local _aa,aaa,baa,caa=next,type,unpack,select;local daa,_ba=setmetatable,getmetatable
local aba,bba=table.insert,table.sort;local cba,dba=table.remove,table.concat
local _ca,aca,bca=math.randomseed,math.random,math.huge;local cca,dca,_da=math.floor,math.max,math.min;local ada=rawget;local bda=baa
local cda,dda=pairs,ipairs;local __b={}local function a_b(dab,_bb)return dab>_bb end
local function b_b(dab,_bb)return dab<_bb end;local function c_b(dab,_bb,abb)
return(dab<_bb)and _bb or(dab>abb and abb or dab)end
local function d_b(dab,_bb)return _bb and true end;local function _ab(dab)return not dab end;local function aab(dab)local _bb
for abb,bbb in cda(dab)do _bb=(_bb or 0)+1 end;return _bb end
local function bab(dab,_bb,abb,...)local bbb
local cbb=abb or __b.identity;for dbb,_cb in cda(dab)do
@jmizgajski
jmizgajski / group_chain.py
Created May 10, 2014 13:28
Chaining two groups of tasks in celery.
#task is a task that is not interested in any results from other tasks
#callback is a task you want to call after each group is finished (ex. log time)
# and has to take a list of results as first arguement
@app.task(base=Task)
def task(i):
#do stuff
pass
@app.task(base=Task)