Skip to content

Instantly share code, notes, and snippets.

@rhettg
rhettg / todo.py
Created April 6, 2023 14:34
GPT-4 Generated python library for interacting with the TODO example specification
"""
TODOPlugin api library based on spec from https://platform.openai.com/docs/plugins/examples
Generated via:
Given the compressed api specification below, write a python library for interacting with the TODO api.
OAS3|TODO Plugin|v1|https://example.com|/todos/{username}|get|getTodos|path|username|string|Get the list of todos|200|application/json|#/components/schemas/getTodosResponse|post|addTodo|Add a todo to the list|requestBody|#/components/schemas/addTodoRequest|delete|deleteTodo|Delete a todo from the list|#/components/schemas/deleteTodoRequest|getTodosResponse|object|array|items|string|The list of todos.|addTodoRequest|todo|string|The todo to add to the list.|deleteTodoRequest|todo_idx|integer|The index of the todo to delete.
"""
import requests
@rhettg
rhettg / main.cpp
Created October 19, 2021 02:31
OV2640 to base64
#include <ArduCAM.h>
#include <SPI.h>
#include <Wire.h>
#include <base64.hpp>
#define cameraconnection Serial1
#define SPI_CS 8
ArduCAM myCAM(OV2640, SPI_CS);
#include <Adafruit_VC0706.h>
#include <base64.hpp>
#define cameraconnection Serial1
Adafruit_VC0706 cam = Adafruit_VC0706(&cameraconnection);
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
import pandas as pd
import requests
from bs4 import BeautifulSoup
import matplotlib.pyplot as plt
import seaborn as sns
# Método para extrair várias páginas de uma só vez
def scrape_stats(base_url, year_start, year_end):
years = range(year_start,year_end+1,1)
@rhettg
rhettg / django.md
Created June 14, 2019 18:09
Django at Scale
  1. Learn and Practice best-practices. Have a styleguide and a shared understanding of what features are approprate to use, and when. Your problems are probably not that unique so if someone from another company with Django experience dropped into your codebase they should be immediately productive.

  2. Application architecture can be really important for keeping complexity under control. Design your apps "to do one thing, and do them well". Try to avoid ending up with a single app with a giant models.py file where everything is dependent on everything else. Create multiple apps and make sure you don't add circular dependencies. If it helps you can think of each app as a microservice. Present a good and limited API to communicate between them.

Error applying plan:
1 error(s) occurred:
* aws_instance.vpn: diffs didn't match during apply. This is a bug with Terraform and should be reported as a GitHub Issue.
Please include the following information in your report:
Terraform Version: 0.6.16
Resource ID: aws_instance.vpn

Keybase proof

I hereby claim:

  • I am rhettg on github.
  • I am rhettg (https://keybase.io/rhettg) on keybase.
  • I have a public key ASDZdSujGb58CvIN-DJZGdfI-XoOb9gB_Fp-h7t4Ynhe8wo

To claim this, I am signing this object:

@rhettg
rhettg / repeater.go
Last active November 25, 2015 18:00
package main
import "fmt"
func repeater(in, out chan string) {
msg := ""
for {
select {
case msg = <-in:
fmt.Printf("Updated to %s\n", msg)
@rhettg
rhettg / consul-lock.py
Created July 24, 2015 18:25
Consul lock
import argparse
import requests
import pprint
import json
import sys
BASEHOST = "http://127.0.0.1:8500"
def force_release(key):
r = requests.get(
@rhettg
rhettg / gist:c4aa7331c46a71d8d009
Created June 12, 2015 00:25
A better snappy StreamDecompressor for if you need each chunk
class SnappyDecompressor(object):
def __init__(self, file):
self._file = file
self._header_found = False
def __iter__(self):
return self
def next(self):