Skip to content

Instantly share code, notes, and snippets.

View garyblankenship's full-sized avatar
🎩
I may be slow to respond.

Gary Blankenship garyblankenship

🎩
I may be slow to respond.
View GitHub Profile
@roychri
roychri / README.md
Created May 2, 2024 17:50
Stream Ollama (openai) chat completion API on CLI with HTTPie and jq

Stream Ollama (openai) chat completion API on CLI with HTTPie and jq

Explanation

This command sends a request to the Chat Completion API to generate high-level documentation for the file @src/arch.js. The API is configured to use the llama3-gradient model and to respond in Markdown format.

The messages array contains two elements:

  • The first element is a system message that provides the prompt for the API.
  • The second element is a user message that specifies the file for which to generate documentation.
# Machine Intelligence Made to Impersonate Characteristics: MIMIC
# NOTE run this $ conda install -c conda-forge mpi4py mpich to get mpi working
# accelerate launch --use_deepspeed -m axolotl.cli.train ./config_name_here
base_model: alpindale/Mistral-7B-v0.2-hf
base_model_config: alpindale/Mistral-7B-v0.2-hf
model_type: MistralForCausalLM
tokenizer_type: LlamaTokenizer
is_mistral_derived_model: true
@Artefact2
Artefact2 / README.md
Last active October 11, 2025 23:49
GGUF quantizations overview
@garyblankenship
garyblankenship / deployartifact.yml
Created January 6, 2024 03:26
Workflow to Deploy Laravel to Digital Ocean
name: Deploy to DigitalOcean
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
@0xdevalias
0xdevalias / music-apis-and-dbs.md
Last active October 19, 2025 20:39
A collection of music APIs, databases, and related tools
@garyblankenship
garyblankenship / cache-grace-guide.md
Last active August 30, 2025 19:42
Laravel Cache Grace: Eliminate Cache Stampedes with Stale-While-Revalidate #laravel #caching #performance #php

Laravel's Hidden Cache::grace() Pattern Solves the Stale-While-Revalidate Problem

How to serve cached content instantly while updating it in the background—the pattern major CDNs use, now in your Laravel app

Cache invalidation is one of the two hard problems in computer science, and Laravel's standard cache methods force you into an uncomfortable choice: serve stale data or make users wait for fresh data. The Cache::grace() pattern eliminates this trade-off by implementing the stale-while-revalidate strategy that powers major CDNs and high-performance web applications.

This isn't just another Laravel macro—it's a fundamental shift in how you think about caching. Instead of choosing between speed and freshness, you get both: instant responses for users and background updates to keep data current. The pattern is so effective that it's built into HTTP standards (RFC 5861) and used by services like Cloudflare, but most Laravel developers have never heard of it.

Here's why this single caching pattern can

@garyblankenship
garyblankenship / googleai.php
Last active December 15, 2023 22:42
Google AI Gemini Pro Example Laravel Usage
<?php
$response = Http::post(
"https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent?key=" .
config("services.googleai.key"),
[
"contents" => [
[
"parts" => [
[
@jart
jart / rename-pictures.sh
Created December 12, 2023 15:24
Shell script for renaming all images in a folder
#!/bin/sh
# rename-pictures.sh
# Author: Justine Tunney <[email protected]>
# License: Apache 2.0
#
# This shell script can be used to ensure all the images in a folder
# have good descriptive filenames that are written in English. It's
# based on the Mistral 7b and LLaVA v1.5 models.
#
# For example, the following command:
@goran-popovic
goran-popovic / AssistantController.php
Last active December 10, 2024 03:04
Using Laravel to interact with OpenAI's Assistant API (with Vision) - Basic Example (https://geoligard.com/using-laravel-to-interact-with-openai-s-assistants-api-with-vision)
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use OpenAI\Laravel\Facades\OpenAI;
class AssistantController extends Controller
{
public function generateAssistantsResponse(Request $request)
# Clone the repo
git clone https://github.com/imartinez/privateGPT
cd privateGPT
# Install Python 3.11
pyenv install 3.11
pyenv local 3.11
# Install dependencies
poetry install --with ui,local