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
@shawnyeager
shawnyeager / opencode-systemd-tailscale.md
Last active April 23, 2026 02:32
Run OpenCode as a persistent systemd service with Tailscale access

OpenCode Web Server Setup

Run OpenCode as a persistent background service, accessible from any device via Tailscale.

Why?

  • Access from anywhere — Start a task from your phone, check results from your laptop
  • Sessions persist — Close the browser, come back later, your session is still there
  • Multiple clients — Terminal TUI and browser can connect to the same session simultaneously
  • Survives crashes — systemd restarts the server automatically
@jsadoski-rockhall
jsadoski-rockhall / SKILL.md
Created January 30, 2026 13:33
Logging Best Practices Skill
name Logging Best Practices
description Use before implementing logs in a medium to large scale production system.

This skill is adpated from "Logging sucks. And here's how to make it better. by Boris Tane.

When helping with logging, observability, or debugging strategies, follow these principles:

Core Philosophy