Skip to content

Instantly share code, notes, and snippets.

View redsquare's full-sized avatar
📞
OnCall

steve flitcroft redsquare

📞
OnCall
View GitHub Profile
@stephenlb
stephenlb / functions-rest-api.md
Last active April 8, 2024 15:58
PubNub Functions REST APIs using CURL Commands

PubNub Functions REST APIs using CURL Commands

PubNub Functions

Authenticate with an email and password to receive a session_token. The Session Token will be a top level key called token. The Session Token token is used for all requests after authentication. You also receive a user_id which is used in your apps and keys lookup.

Login

@den-crane
den-crane / AggregatingMergeTree-groupArrayState
Last active July 25, 2023 16:15
AggregatingMergeTree-groupArrayState
----------------------- SimpleAggregateFunction + groupArrayArray ----------------------------
drop table if exists states_raw;
drop table if exists final_states_by_month;
drop table if exists final_states_by_month_mv;
CREATE TABLE states_raw(d date, uid UInt64, s String) ENGINE = Null;
CREATE TABLE final_states_by_month(d date, uid UInt64, a_state SimpleAggregateFunction(groupArrayArray, Array(String)))
ENGINE = AggregatingMergeTree PARTITION BY toYYYYMM(d) ORDER BY (uid);
@stephenlb
stephenlb / huggingface-pubnub-function.js
Last active April 9, 2024 07:04
PubNub Functions HuggingFace - use any model from HuggingFace Serverless API inside PubNub Functions
//
// ** **
// ** Add your API Key to MY SECRETS (Left Panel) **
// ** **
// ** HUGGINGFACE_API_KEY as the Secret Name **
// ** **
//
let HUGGINGFACE_API_KEY = null;
function getAPIKey() {
// Use cached key