Skip to content

Instantly share code, notes, and snippets.

View stevengonsalvez's full-sized avatar
💭
trying to be monkish

Steven Gonsalvez stevengonsalvez

💭
trying to be monkish
View GitHub Profile
@stevengonsalvez
stevengonsalvez / ecommerce_analysis_notebook.ipynb
Last active March 17, 2024 12:04
customer_browser_analysis
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@stevengonsalvez
stevengonsalvez / Text Retrieval Agent with Conversational Agent Executor.md
Created February 20, 2024 10:59
The code snippet creates a retrieval chain for text-based knowledge using a combination of language models and vector stores. It then creates an agent with conversational capabilities and executes a question using the agent and retrieval chain to obtain an answer.

Text Retrieval Agent with Conversational Agent Executor

Preview:
from langchain import SQLDatabase, SQLDatabaseChain
from langchain.prompts.prompt import PromptTemplate
from langchain.chat_models import ChatOpenAI
from langchain.memory import ConversationBufferWindowMemory
from langchain.chains import ConversationChain, LLMChain
from langchain.embeddings import OpenAIEmbeddings
from langchain.chains import RetrievalQAWithSourcesChain, RetrievalQA
@stevengonsalvez
stevengonsalvez / Text Retrieval Chain with Vectorstore and RetrievalQA.md
Created February 20, 2024 10:44
The code snippet defines a function that creates a retrieval chain for text retrieval. It initializes a RetrievalChain object with a language model and a retriever, and then returns the RetrievalChain object. The retriever is created using a vectorstore and

Text Retrieval Chain with Vectorstore and RetrievalQA

Preview:
def text_retrieval_chain():
    # main retrieval chain class
    class RetrievalChain:
        def __init__(self, llm, retriever):
            self.chain = RetrievalQA.from_chain_type(llm=llm, chain_type="stuff", retriever=retriever)

        def run(self, prompt):

Disable Device Enrollment Notification on Mac.md

Restart the Mac in Recovery Mode by holding Comment-R during restart

Open Terminal in the recovery screen and type

csrutil disable
// Example based actions/core documentation
const core = require('@actions/core');
const { decode } = require('jsonwebtoken');
const { axiosClient } = require('./axioshelp');
getIDTokenAction().catch((error) =>{
console.log('errors?',error)
})
async function getIDTokenAction() {
// Sketchy loading of the jsrsasign library into Postman Sandbox
var navigator = {}; //fake a navigator object for the lib
var window = {}; //fake a window object for the lib
eval(pm.globals.get("jsrsasign-js")); //import javascript jsrsasign
var currentTime = +new Date(); // the current time in milliseconds
var issuedAtTimeSeconds = currentTime/1000;
var expirationTimeSeconds = currentTime/1000 + 3600;
// Grab the JWK from the Environment and change to JSON object
@stevengonsalvez
stevengonsalvez / account_client.go
Created February 21, 2023 16:44 — forked from sebnyberg/account_client.go
Some Azure Go SDK auth things
package azurex
import (
"context"
"errors"
"fmt"
"os"
"strings"
"github.com/Azure/azure-sdk-for-go/profiles/2020-09-01/resources/mgmt/subscriptions"
@stevengonsalvez
stevengonsalvez / default-server-platform-response-api.js
Created January 25, 2023 17:00
default-server-platform-response-api.js
const express = require('express')
const os = require('os')
const app = express()
const port = process.env.APP_PORT || 80
var response = '<html><body> <h1>'
response += 'Hello from' + os.hostname() + '</h1>'
response += 'Type:' + os.type() + '<br/>'
@stevengonsalvez
stevengonsalvez / clipper-obsidian.js
Last active January 17, 2023 18:20
alternate-obsidian-web-clipper.js
javascript: Promise.all([import('https://unpkg.com/turndown@6.0.0?module'), import('https://unpkg.com/@tehshrike/readability@0.2.0'), ]).then(async ([{
default: Turndown
}, {
default: Readability
}]) => {
/* Optional vault name */
const vault = "";
/* Optional folder name such as "Clippings/" */
@stevengonsalvez
stevengonsalvez / obsidian-web-clipper.js
Last active January 6, 2023 22:52 — forked from kepano/obsidian-web-clipper.js
Obsidian Web Clipper Bookmarklet to save articles and pages from the web (for Safari, Chrome, Firefox, and mobile browsers)
javascript: Promise.all([import('https://unpkg.com/turndown@6.0.0?module'), import('https://unpkg.com/@tehshrike/readability@0.2.0'), ]).then(async ([{
default: Turndown
}, {
default: Readability
}]) => {
/* Optional vault name */
const vault = "";
/* Optional folder name such as "Clippings/" */