Skip to content

Instantly share code, notes, and snippets.

View bsbodden's full-sized avatar

Brian Sam-Bodden bsbodden

View GitHub Profile
@bsbodden
bsbodden / gist:01cc706a842df10ba683dbf10785c2fe
Created September 5, 2024 14:04
langchain-redis with Sentinel connection
# establish a Sentinel connection
from redis import Sentinel
sentinel = Sentinel([('localhost', 26379)], socket_timeout=0.1)
index_name = f"test_index_{str(ULID())}"
store = RedisVectorStore.from_texts(
texts,
OpenAIEmbeddings(),
index_name=index_name,
@bsbodden
bsbodden / uao.sh
Created May 15, 2024 18:25
UAO but with bash bitch!
#!/bin/bash
function run() {
echo "Running: $1"
eval "$1"
}
if [ $# -lt 2 ]; then
echo "Usage: $0 <zip_file> <destination_folder> [--ide=idea|vsc]"
exit 1
@bsbodden
bsbodden / redis-bloom-cli-demo.md
Last active October 7, 2021 17:37
Redis Bloom CLI Demo

Keys / Key Spaces / Expire / Scan / Get/Set

set actor:001 "Cobie Smulders"
exist actor:001
get actor:001
get "actor:001"
get 'actor:001'
type actor:001
@bsbodden
bsbodden / machine.js
Created June 13, 2020 14:47
Generated by XState Viz: https://xstate.js.org/viz
const askForProduct = (context, event) => {}
const confirmOperation = (context, event) => {}
const askForReplacementReason = (context, event) => {}
const askForReplacementReasonExplanation = (context, event) => {}
const regularExchangeFlow = Machine(
{
id: 'regular-exchange',
initial: 'inactive',
context: {
operation: 'exchange',
@bsbodden
bsbodden / machine.js
Created June 13, 2020 14:41
Generated by XState Viz: https://xstate.js.org/viz
const askForReasonForRemoval = (context, event) => {}
const askForReplacementReasonExplanation = (context, event) => {}
const confirmOperation = (context, event) => {}
const removeProductsFlow = Machine(
{
id: 'remove-products',
initial: 'inactive',
context: {
@bsbodden
bsbodden / machine.js
Last active June 13, 2020 14:40
Generated by XState Viz: https://xstate.js.org/viz
const askForProduct = (context, event) => {}
const confirmOperation = (context, event) => {}
const installProductsFlow = Machine(
{
id: 'install-products',
initial: 'inactive',
context: {
operation: 'install',
targetProduct: null,
@bsbodden
bsbodden / binnacle-heroku-add-on-test-instructions.asc
Last active May 9, 2016 19:02
Binnacle Heroku Add-on Test Instructions
Verifying that +bsbodden is my blockchain ID. https://onename.com/bsbodden
@bsbodden
bsbodden / drools_loans_dsl.txt
Created August 10, 2015 03:38
Drools Loans DSL snippet
[condition][]the lender is “{mortgage_company}"=
mortgage:Mortgage(lender:lenderName == “{mortgage_company}",product:mortgageName)
[condition][]and there is an application=
application:LoanApplication(lenders contains lender)
[condition][]- with a FICO score below {score}=ficoScore<{score}
[consequence][]reject the application because “{message}"=
application.addMessage("Declined by " + lender + " because {message}");
@bsbodden
bsbodden / acme_fico_rule
Created August 10, 2015 03:36
ACME-Fico DSLR Rule
rule "ACME-Fico"
when
the lender is "ACME Mortgage"
and there is an application
- with a FICO score below 680
then
reject the application because "a FICO score of at least 680 is required"
end