Skip to content

Instantly share code, notes, and snippets.

View buanzo's full-sized avatar

Arturo Busleiman aka Buanzo buanzo

View GitHub Profile
@buanzo
buanzo / gist:47c56e18e42d8ba5cf0b972db56c9c72
Created September 30, 2023 13:59
buanzo's dyson.py - openai llm aided meta-functions
import os
import openai
import inspect
from typing import Callable
import json
class Dyson:
def __init__(self, func: Callable, model='gpt-4'):
self.func = func
self.model = model
@buanzo
buanzo / docstringer.py
Created September 27, 2023 13:05
Uses GPT to generate docstrings for functions in python files automagically
#!/usr/bin/env python3
# By Arturo 'Buanzo' Busleiman
# YMMV
import openai
import ast
import astunparse
import sys
import shutil
from itertools import takewhile
Kilu is a YAML-based template system that enables you to generate project files for any project that you indicate. The syntax of a Kilu template is as follows:
A basedir field specifies the base directory for the project. It should be a string value.
A files field contains a list of file entries. Each file entry should have a name and content field. The name field should be a string value that specifies the name of the file, and the content field should be a multiline string that defines the contents of the file.
# This is a work in progress. There are still bugs. Once it is production-ready this will become a full repo.
import os
def count_tokens(text, model_name="gpt-3.5-turbo", debug=False):
"""
Count the number of tokens in a given text string without using the OpenAI API.
This function tries three methods in the following order:
1. tiktoken (preferred): Accurate token counting similar to the OpenAI API.
2. nltk: Token counting using the Natural Language Toolkit library.
# This code snippet shows one way we could use gpt inside a Jinja2 template
# to hack-around the context limitations. Have fun! And remember, the ART is the prompt...
# MAKE SURE you modify the 'set titulo' (titulo is title in spanish)
# Author: Arturo "Buanzo" Busleiman <buanzo@buanzo.com.ar>
import os
import openai
import json
from jinja2 import Template
@buanzo
buanzo / buanzo.jcf
Created July 8, 2020 12:53
Buanzo's Color Scheme for Joe's Own Editor - Based off gruvbox.jcf by Pavel Pertsev - https://github.com/morhetz/gruvbox
# Buanzo is a VIM scheme by Arturo 'Buanzo' Busleiman, based in gruvbox written by Pavel Pertsev
# Original Gruvbox version at version at https://github.com/morhetz/gruvbox
.colors 16
# Palette
.set bg 0
.set dark_red 124
.set dark_green 106
.set dark_yellow 172
@buanzo
buanzo / notimplemented.py
Last active May 6, 2020 14:35
Python 3 Argparse.Action to use on not-implemented arguments
#!/usr/bin/env python3
import sys
import argparse
""" This class allows to work on getting your Argparse object
ready even if nothing useful happens when used.
Save this git on some file then import the class.
Usage:

Keybase proof

I hereby claim:

  • I am buanzo on github.
  • I am buanzo (https://keybase.io/buanzo) on keybase.
  • I have a public key whose fingerprint is 7350 B06E 7AEA 78FD E739 F3AD 025A 4EB0 6857 704D

To claim this, I am signing this object: