Skip to content

Instantly share code, notes, and snippets.

View d1egoaz's full-sized avatar

Diego Alvarez d1egoaz

View GitHub Profile
@d1egoaz
d1egoaz / chatgpt.el
Created March 2, 2023 16:36
First attempt to use chatgpt using Emacs
(require 'request)
(require 'json)
(defun chatgpt-query (input)
"Interact with the ChatGPT API and return the response."
(let* ((api-key "<YOUR API KEY>")
(url "https://api.openai.com/v1/chat/completions")
(model "gpt-3.5-turbo")
(headers `(("Content-Type" . "application/json")
("Authorization" . ,(concat "Bearer " api-key))))
@d1egoaz
d1egoaz / nodeMock.js
Last active August 29, 2015 14:16
simple node express example
var express = require('express');
var request = require('request');
var app = express();
app.all('*', function(req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
next();
});