Skip to content

Instantly share code, notes, and snippets.

View rossja's full-sized avatar

Jason Ross rossja

View GitHub Profile
@rossja
rossja / README.md
Created November 13, 2024 00:27
Simple RAG Using Google AI

RAG Implementation with Google Gemini and ChromaDB

A simple example implementation of Retrieval Augmented Generation (RAG) using Google's Gemini API and ChromaDB for document storage and retrieval.

Overview

This code demonstrates a basic RAG system with three main components:

  1. Document embedding using Google's text-embedding-004 model
  2. Vector storage and retrieval using ChromaDB
  3. Question answering using Gemini 1.5 Flash model
@rossja
rossja / index.html
Created September 10, 2024 00:33
web font with built-in color syntax highlighting
<html>
<!--
// neat font for syntax highlighting. see https://blog.glyphdrawing.club/font-with-built-in-syntax-highlighting/
// font download at https://blog.glyphdrawing.club/assets/fonts/FontWithASyntaxHighlighter-Regular.woff2
-->
<head>
<style type="text/css">
@font-face {
font-family: 'FontWithASyntaxHighlighter';
src:
# smuggle text hidden as invisible unicode chars
# credit to jthacker: https://x.com/rez0__/status/1745545813512663203
# and embrace the red: https://embracethered.com/blog/posts/2024/hiding-and-finding-text-with-unicode-tags/
import pyperclip
def convert_to_tag_chars(input_string):
return ''.join(chr(0xE0000 + ord(ch)) for ch in input_string)
# Example usage:
@rossja
rossja / inktober-prompt-list-alpha-with-2024.md
Created August 31, 2024 18:09
Intkober Prompt Lists 2016 - 2024
  • ANCIENT
  • ANGEL
  • ANGULAR
  • ARMADILLO
  • ARMOR
  • ASH
  • Backpack
  • BAD DOG
  • BAIT
  • BAT
@rossja
rossja / check-devices.py
Last active August 29, 2024 02:25
simple script to figure out what pytorch device you are using
import torch
if torch.cuda.is_available():
print ("cuda available")
print(f'available devices: {torch.cuda.device_count()}')
elif torch.backends.mps.is_available():
print ("mps available")
device = torch.device("mps")
x = torch.ones(1, device=device)
print (x)
@rossja
rossja / README.md
Last active June 17, 2024 16:24
Huggingface SFConvertbot Pull Request Scanner

HuggingFace SF_Convertbot Scanner

This script is designed to assist in identifying pull requests to HuggingFace repositories that are sourced from the SFConvertbot user.

The SFConvertbot user is part of an automated tool used by HuggingFace to provide safetensor versions of models. As published by HiddenLayer this bot can be used by malicious actors to potentially insert malicious content into models.

This tool is a simple script to query all models released by a HuggingFace author, and checks all

@rossja
rossja / slack-token-checker.py
Created February 6, 2024 23:39
Slack Token Checker
"""
presumes a list of slack tokens (1 per line)
in a file at ./tokens.txt
runs through them one by one using the slack auth.test endpoint
returns info if they are valid, otherwise no
"""
import requests
url = 'https://slack.com/api/auth.test'
/**
* utils module - provides various utility functions used by the application
* @module utils
*/
/**
* A function to sort an array of indices by a given property
* put simply: this lets you sort an array of json objects by
* whatever property you tell it to use.
* Example: `var teams = data.teams.sort(utils.GetSortOrder("name"))`
@rossja
rossja / web-servers.md
Created October 22, 2021 18:24 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000