Skip to content

Instantly share code, notes, and snippets.

@tosh
tosh / system.md
Created April 29, 2024 17:25
system.md

I have a parquet file named ah.parquet.

It contains Apple Health data and has the following columns:

  • type: Nullable(String)
  • value: Nullable(String)
  • start: Nullable(DateTime64(6))
  • end: Nullable(DateTime64(6))
  • created: Nullable(DateTime64(6))
@RyanBalfanz
RyanBalfanz / llm_webui.py
Created April 16, 2024 02:31
Initial LLM WebUI
import json
import urllib.parse
from dataclasses import InitVar, dataclass
from datetime import datetime, timedelta
from typing import Protocol
import httpx
import llm
import streamlit as st
@montasaurus
montasaurus / llmc.sh
Last active April 20, 2024 21:32
AI Shell Command Generator
llmc() {
local system_prompt='Output a command that I can run in a ZSH terminal on macOS to accomplish the following task. Try to make the command self-documenting, using the long version of flags where possible. Output the command first enclosed in a "```zsh" codeblock followed by a concise explanation of how it accomplishes it.'
local temp_file=$(mktemp)
local capturing=true
local command_buffer=""
local first_line=true
local cleaned_up=false # Flag to indicate whether cleanup has been run
cleanup() {
# Only run cleanup if it hasn't been done yet
This uses llm.datasette.io and OpenAI.
I use `git commit --template` to provide the output from the LLM to Git. This way, if you do not like the results, you
can quit your editor and no commit will be made.
# Shell function for generating a diff and editing it in your default editor:
gcllm() {
GIT_DIR="$(git rev-parse --git-dir)"
TEMPLATE="$GIT_DIR/COMMIT_EDITMSG_TEMPLATE"
@Brandon7CC
Brandon7CC / speak_ollama.sh
Created December 29, 2023 23:38
📣 Giving Ollama a voice with the macOS `say` command! NOTE: Change to Siri in `System Settings.app` for the best results.
function speak_ollama() {
if ! command -v ollama &> /dev/null; then
echo "Error: ollama is not installed."
return 1
fi
if [ "$#" -ne 2 ]; then
echo "Usage: speak_ollama <file_path> <model>"
return 1
fi

Here are my favorite tech newsletters:

  • Frontend Focus: A once–weekly roundup of the best front-end news, articles and tutorials. HTML, CSS, WebGL, Canvas, browser tech, and more.
  • This Week In React: The latest news directly in your inbox!
  • Web Tools Weekly: A weekly newsletter for front-end developers with a specific focus on tools.
  • NEXT.JS Weekly: A newsletter of the best Next.js articles, tools and projects
  • JavaScript Weekly: A newsletter of JavaScript articles, news and cool projects
  • Friday Front-End: Front-end development links tweeted daily, emailed weekly.
  • CSS Weekly: Weekly e-mail roundup of CSS articles, tutorials, experiments, and tools curated by Zoran Jambor
  • Liquid Weekly: Your one-stop shop for all things Shopify Development
@willbchang
willbchang / azure_tts.sh
Last active November 11, 2023 04:55
A simple example to use Azure text to speech REST API with shell script in macOS via Popclip Snippet. You can get the newest version from: https://github.com/willbchang/popclip-azure-text-to-speech
#!/bin/zsh
# #popclip
# name: Azure TTS
# icon: symbol:message.and.waveform
# Please apply for your own key
AZURE_REGION=
AZURE_SUBSCRIPTION_KEY=
# Create a temporary audio file
from langchain.chat_models import ChatOpenAI
from pydantic import BaseModel, Field
from langchain.document_loaders import UnstructuredURLLoader
from langchain.chains.openai_functions import create_extraction_chain_pydantic
class LLMItem(BaseModel):
title: str = Field(description="The simple and concise title of the product")
description: str = Field(description="The description of the product")
def main():
@kylemcdonald
kylemcdonald / function-calling.ipynb
Created June 14, 2023 01:10
Example of OpenAI function calling API to extract data from LAPD newsroom articles.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@CharlesNepote
CharlesNepote / csv2datasette
Last active March 17, 2024 17:02
csv2datasette
#!/usr/bin/env bash
# sudo ln -s "$(pwd)/csv2datasette" /usr/bin/csv2datasette
# csv2datasette is meant to explore CSV data. It is not meant to create a sustainable DB.
# csv2datasette is a bash script which open CSV files directly in Datasette. It offers
# a number of options for reading and exploring CSV files, such as --stats, inspired by WTFCsv.
#
# `--stats` option includes, for each column: the column name, the number of unique values,
# the number of filled rows, the number of missing values, the mininmum value, the maximum value,
# the average, the sum, the shortest string, the longest string, the number of numeric values,