Skip to content

Instantly share code, notes, and snippets.

View wolterlw's full-sized avatar
🇺🇦

Volodymyr wolterlw

🇺🇦
View GitHub Profile
from keras.models import Sequential
model = Sequential()
@wolterlw
wolterlw / count_people.sql
Last active June 9, 2017 21:23
beautiful SQL function to count people on position
CREATE OR REPLACE FUNCTION count_max_on_pos(date1 DATE, date2 DATE, id_pos INTEGER) RETURNS INTEGER AS $$
-- date1, date2 - limits of the time interval
-- id_pos - id of the position we examine
DECLARE num_people_array INTEGER ARRAY;
DECLARE max_on_pos INTEGER := 0;
DECLARE curr_on_pos INTEGER := 0;
DECLARE i INTEGER;
BEGIN
SELECT ARRAY(SELECT coalesce(num_pos,0) - coalesce(num_neg,0) FROM