Skip to content

Instantly share code, notes, and snippets.

View kkemple's full-sized avatar

Kurt Kemple kkemple

View GitHub Profile
@kkemple
kkemple / custom-llm-action-example.cls
Last active February 15, 2025 15:28
An example Apex action using the Salesforce models API to send prompts to a custom model.
public class CustomLLMAction {
@InvocableMethod(
label='Your label here'
description='Using a custom LLM to ...'
category='AI/ML'
)
public static List<GenerateResponseResult> generateResponse(List<GenerateResponseRequest> requests) {
List<GenerateResponseResult> results = new List<GenerateResponseResult>();
for(GenerateResponseRequest request : requests) {
@kkemple
kkemple / fastify-huggingface-openllmconnector-example.js
Created February 15, 2025 15:20
How to set up quick chat completing for Salesforce Platform Open LLM Connector.
import "dotenv/config";
import Fastify from "fastify";
import { HfInference } from "@huggingface/inference";
const DEFAULT_SYSTEM_CONTENT = `Any default instructions for your model go here.`;
const server = Fastify({
logger: true,
});
import { axios } from "@pipedream/platform"
import { format } from "date-fns"
export default defineComponent({
props: {
notion: {
type: "app",
app: "notion",
}
},
@kkemple
kkemple / etl
Last active April 12, 2022 18:20
// To use any npm package, just import it
// import axios from "axios"
import striptags from "striptags"
export default defineComponent({
async run({ steps, $ }) {
const description = striptags(steps.trigger.event.description, ['br']).replace(/<br>/g, '\n')
const eventTypeMatch = description.match(/Event\sName:\s(\w+)/)
const zoomLink = description.match(/(https:\/\/(?:[\w-]+\.)?zoom.us\/j\/\d+\?pwd=\w+)/)
@kkemple
kkemple / DarkModeImage.js
Created November 28, 2021 18:43
An image component that supports different images for dark mode.
export default function DarkModeImage({ light, dark, alt }) {
return (
<picture>
<source srcSet={dark} media="(prefers-color-scheme: dark)" />
<img src={light} alt={alt} />
</picture>
);
}
@kkemple
kkemple / Dockerfile
Created May 26, 2021 17:53
Snippets for setting up federated GraphQL APIs
FROM node:14
# Create app directory
WORKDIR /usr/src/app
COPY package*.json ./
# Install app dependencies
RUN npm install
@kkemple
kkemple / gatsby-node.js
Created October 22, 2020 17:31
gatsby source plugin for Oribt
// constants for your GraphQL Post and Author types
const fetch = require("isomorphic-fetch")
const MEMBER_NODE_TYPE = `OrbitMember`
const ORBIT_API_KEY = `<YOUR_KEY_HERE>`
exports.sourceNodes = async ({
actions,
createContentDigest,
createNodeId,
@kkemple
kkemple / autonomous.txt
Created June 24, 2020 17:37 — forked from Khaledgarbaya/autonomous.txt
Instructions on how to reset the autonomous desk. This fixes a problem where the desk will not lower (also reportedly fixes incorrectly reported heights).
> Thank you for reaching out to Autonomous! I am sorry to hear that you are having some trouble with your SmartDesk
> but I will be glad to assist. It sounds like your system needs a "hard reset" can I please have you follow these
> steps thoroughly.
Reset Steps:
1. Unplug the desk for 20 seconds. Plug it back in. Wait a full 20 seconds.
2. Press the up and down buttons until the desk lowers all the way and beeps or 20 seconds pass.
3. Release both buttons.
4. Press the down buttons until the desk beeps one more time or 20 seconds pass.
import React, { useState, useEffect } from "react";
import {
TouchableOpacity,
View,
KeyboardAvoidingView,
Modal,
ScrollView,
StyleSheet,
StatusBar
} from "react-native";
import { useState, useEffect } from "react";
import { Auth, API, graphqlOperation } from "aws-amplify";
import parse from "date-fns/parse";
import format from "date-fns/format";
import formatDistance from "date-fns/formatDistance";
import { getEvent } from "../graphql/queries";
import {
onUpdateEvent,