Skip to content

Instantly share code, notes, and snippets.

@davehague
davehague / meta-llama-in-ollama-librechat.md
Created April 7, 2025 13:59
Use Llama models in ollama and Librechat

To download and use Llama models in LibreChat on your Mac, potentially via Ollama, follow these steps:


Step 1: Download the Llama Models

1. Request Access

  • Visit the Meta Llama Downloads page.
  • Complete the access request form and accept Meta's Community License Agreement.
  • Once approved, you’ll receive a signed URL for downloading the model weights.
@davehague
davehague / librechat-integrations.md
Last active March 10, 2025 15:29
Connect LibreChat to Ollama Local (Mac) or OpenRouter

Integrating Librechat

Connecting Librechat and Ollama

  1. First, follow the official LibreChat instructions to update your librechat.yaml file in the base directory.

  2. (unclear if needed) Set the environment variable launchctl setenv OLLAMA_HOST "0.0.0.0:11434" to expose the ollama API before ollama serve, per this github issue

  3. Set the volume to your docker-compose.override.yml for Librechat (under the service named api):

services:

@davehague
davehague / python_gitignore
Last active February 24, 2025 14:03
Python .gitignore file
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python

Paypal cards offer partner rebates, but you have to go in an manually click them.
Use this script when you're on the offer page to click all of them, and then if you happen to purchase the item in the partner reward, you'll be alerted of a rebate via email!

Offers found at https://www.paypal.com/offers/

Here's a guide on bookmarklets if you're not familiar with how they work.

Here's the code.

@davehague
davehague / default-formatter-vs-code.md
Created November 25, 2024 15:43
Configure Default Formatter in VS Code

Default Formatter in VS Code

VS code will ask you the first time but if you make the wrong choice or want to change it, here's how you change it:

  1. Access the Command Palette by pressing Ctrl+Shift+P (Windows/Linux) or Cmd+Shift+P (Mac).
  2. Type and select "Format Document With..." from the command palette.
  3. At the bottom of the list, click on "Configure Default Formatter...".

To test, on a file use Alt-Shift-F to format.

Note for Vue: Use "Vue Official", it works better than Prettier.

@davehague
davehague / markedjs-new-tab.md
Last active November 15, 2024 16:55
Have the marked (markedjs) library open links in new tab

In some cases I'd like the marked library open links in new tabs, but the default behavior is to open in the same tab. This means you have to override then renderer but the documentation doesn't make it completely obvious how to do that. Here's how you can do it.

// src/utils/markdown.ts
import { marked } from "marked";
import type { Token, Tokens } from "marked";

export const renderMarkdown = (content: string) => {
  try {
 const renderer = new marked.Renderer();
@davehague
davehague / ps-file-tree.md
Last active February 6, 2025 16:10
Print a nicely formatted file tree

Often I'll find it helpful to give a LLM context of my file structure for coding projects, so I co-wrote this script to only grab the relevant files and output them in a nicely formatted tree.

It ignores common directories in a VS code (Nuxt and Vue) project and in a Pycharm (Python) project. It also only grabs files with approved extensions.

Powershell

function Print-Tree {
    param (
@davehague
davehague / Powershell-Command-History.md
Created September 19, 2024 18:24
Powershell version of Linux's `history` command

Wouldn't it be nice if Powershell could simulate history | grep "alembic"? Now it can.

Place this in your Powershell profile (PS> $PROFILE to find the path)

function Get-CommandHistory {
    param (
        [string]$Pattern = "*"
    )
@davehague
davehague / undo-commit-with-sensitive-data.md
Last active November 8, 2024 16:16
Undoing a commit that includes sensitive data

If you accidentally perform a commit with sensitive data, I found this recovery approach to be fairly straightforward.

  1. (Optional) If you want to keep the file but not the changes, save off the file that has the secret. The command below will completely remove the file.
  2. Install Python if not already installed
  3. From command line pip install git-filter-repo
  4. Clone a fresh copy of the repository
  5. Run the command to remove the file
@davehague
davehague / ChatGPT Chat Extractor.md
Last active September 19, 2024 14:05
ChatGPT Chat Extractor

Index ChatGPT chats to local browser storage (IndexedDB)

Tampermonkey script
// ==UserScript==
// @name         ChatGPT Chat Extractor
// @namespace    http://tampermonkey.net/