Skip to content

Instantly share code, notes, and snippets.

View spencerkittleson's full-sized avatar

Spencer Kittleson spencerkittleson

  • NICE / MindTouch
  • San Diego, CA
View GitHub Profile
@spencerkittleson
spencerkittleson / .editorconfig
Last active November 12, 2024 01:30
c# K&R Editor Config
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
[*.cs]
@spencerkittleson
spencerkittleson / notes.txt
Last active April 8, 2022 20:44
Link To Case
<script async="async" src="https://h7hbzrzw.mindtouch.es/@embed/acfe4e14b3108d82e03675e6b0bc9d22adaed60f156ad62a090e6c3e335211b0.js"></script>
<script type="mindtouch/embed" data-case-id="2" data-search-query="how" id="mindtouch-embed-acfe4e14b3108d82e03675e6b0bc9d22adaed60f156ad62a090e6c3e335211b0"></script>
Example of linking to case
https://h7hbzrzw.mindtouch.es/@embed/acfe4e14b3108d82e03675e6b0bc9d22adaed60f156ad62a090e6c3e335211b0.html?case-id=1
?search-query=how
Window events: https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener
mindtouch-web-widget:salesforce:loaded
@spencerkittleson
spencerkittleson / main.cs
Last active September 20, 2022 18:24
AHK Text to Speech Everywhere!
// See https://aka.ms/new-console-template for more information
using SynthesizerAudio;
using System.Media;
var cts = new CancellationTokenSource();
cts.CancelAfter(TimeSpan.FromSeconds(10));
var text = string.Empty;
if (args.Length > 0 && File.Exists(args[0])) {
text = await File.ReadAllTextAsync(args[0], cts.Token) ?? string.Empty;
} else {
Environment.Exit(1);
@spencerkittleson
spencerkittleson / notes.txt
Created January 23, 2023 21:24
mqtt cli notifications
https://pypi.org/project/mqtt-client/
mqtt-client publish --host=192.168.4.100:1883 --topic=work/notify --payload=ok
namespace UserTriggerTextToSpeech
{
public class Mimic3Service
{
private static readonly HttpClient _client = new();
private readonly Uri _url = new("http://127.0.0.1:59125");
public Mimic3Service() {
}
@spencerkittleson
spencerkittleson / index.js
Last active March 17, 2023 21:14
Bot to get titles
import puppeteer from "puppeteer";
(async () => {
const browser = await puppeteer.launch({ headless: false });
const page = await browser.newPage();
await page.goto(
"https://sfbay.craigslist.org/search/sby/sof#search=1~thumb~0~0"
);
// Set screen size
@spencerkittleson
spencerkittleson / serverSideToken.cs
Created March 29, 2023 17:35
CXOneExpert Server Side Tokens
using System;
using System.IO;
using System.Security.Cryptography;
using System.Net.Http;
// Server API Token key and secret are available from API token management dashboard when Server API Token is generated
var key = "da28b6ec3ea350db524d80099f8c9f40f2fab2f4caf91a8d49d4cb4d659a9785";
var secret = "60a63916a77ef70c0ecf42b134f44fbb9732b395ae33dc6d5165aad2b5668bb4";
// include username prefixed with '='
@spencerkittleson
spencerkittleson / userfavs.py
Created May 17, 2023 22:05
Python Spotify Playlist User Retrieval
from simple_http_server import route, server
from threading import Thread
import spotipy
from spotipy.oauth2 import SpotifyClientCredentials
import spotipy
from spotipy.oauth2 import SpotifyOAuth
import os
from simple_http_server import route, server
@route("/")
@spencerkittleson
spencerkittleson / do.py
Created June 14, 2023 17:24
pytest with ducktyping
import requests
import xml.etree.ElementTree as ET
def get_current_weather(uri: str, client = requests) -> str:
result = client.get(uri)
weather = ET.ElementTree(ET.fromstring(result.text)).getroot().findall("./weather")[0].text
return weather
@spencerkittleson
spencerkittleson / main.py
Created June 26, 2023 16:37
gpt4all with knowledge
from langchain.llms import GPT4All
from langchain.vectorstores import Chroma
from langchain.indexes import VectorstoreIndexCreator
from langchain.indexes.vectorstore import VectorStoreIndexWrapper
from langchain.document_loaders import DirectoryLoader, TextLoader, UnstructuredMarkdownLoader
from langchain.chains import RetrievalQA
import sys
import os
from langchain.callbacks.streaming_stdout import StreamingStdOutCallbackHandler
from langchain.embeddings import HuggingFaceEmbeddings, SentenceTransformerEmbeddings