Skip to content

Instantly share code, notes, and snippets.

View Stryzhevskyi's full-sized avatar

Serhii Stryzhevskyi Stryzhevskyi

View GitHub Profile
@Stryzhevskyi
Stryzhevskyi / faces.json
Created October 22, 2016 21:47 — forked from joakin/faces.json
ascii art (faces and stuff)
[
{
"txt": "Table Flip",
"val": "(╯°□°)╯︵ ┻━┻"
},
{
"txt": "umadbro?",
"val": "¯\\_(ツ)_/¯"
},
{
CREATE OR REPLACE FUNCTION insta5.next_id(OUT result bigint) AS $$
DECLARE
our_epoch bigint := 1314220021721;
seq_id bigint;
now_millis bigint;
shard_id int := 5;
BEGIN
SELECT nextval('insta5.table_id_seq') %% 1024 INTO seq_id;
SELECT FLOOR(EXTRACT(EPOCH FROM clock_timestamp()) * 1000) INTO now_millis;