This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef _BASE64_H_ | |
#define _BASE64_H_ | |
#ifndef BASE64_ALLOC | |
#include <stdlib.h> | |
#define BASE64_ALLOC malloc | |
#endif | |
#ifndef BASE64_STRLEN | |
#include <string.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function fetch(url, options) | |
local command = "curl \"" .. url .. "\" --silent" | |
if options.method then | |
command = command .. " -X \"".. options.method .. "\"" | |
end | |
if options.body then | |
local body = options.body:gsub("\"", "\\\"") | |
command = command .. " --data \"".. body .. "\"" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function jsonParse(str) | |
if not str then return nil end | |
str = str:match("^%s*(.-)%s*$") | |
if #str == 0 then return nil end | |
local t = str:sub(1, 1) | |
str = str:sub(2, -2):match("^%s*(.-)%s*$") .. ',' | |
local obj = {} | |
local depth = 0 | |
local last = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const TelegramBot = require("node-telegram-bot-api"); | |
const OPENAI_TOKEN = "openai_token"; | |
const TELEGRAM_TOKEN = "telegram_token"; | |
const bot = new TelegramBot(TELEGRAM_TOKEN, { polling: true }); | |
bot.on("message", async msg => { | |
bot.sendMessage(msg.chat.id, "Pensando..."); | |
if (msg.photo) { | |
const link = await bot.getFileLink(msg.photo[msg.photo.length-1].file_id); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <locale.h> | |
#include <windows.h> | |
wchar_t *atow(char *str) { | |
wchar_t *result; | |
int length; | |
if (str == NULL) return NULL; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import openai | |
from doctr.models import ocr_predictor | |
from doctr.io import DocumentFile | |
from telegram.ext import ApplicationBuilder, MessageHandler, filters | |
TELEGRAM_TOKEN = "telegram_token_here" | |
OPENAI_TOKEN = "openai_token_here" | |
def image_to_text(image_path): | |
image = DocumentFile.from_images(image_path) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef _WEBDRIVER_H_ | |
#define _WEBDRIVER_H_ | |
#include "cmdl.h" /* https://gist.github.com/opsJson/515644eff27b29ad91b79522ca3b2c40 */ | |
#include "makestr.h" /* https://gist.github.com/opsJson/ce29f980360713b74e4abc152217849a */ | |
#include "json_parser.h" /* https://gist.github.com/opsJson/d79503f7b206c6697f20d8c979e3e74a */ | |
#include "json_maker.h" /* https://github.com/opsJson/json-maker */ | |
#include <stdbool.h> | |
#define STRINGIFY(...) #__VA_ARGS__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef _JSON_PARSER_H_ | |
#define _JSON_PARSER_H_ | |
#include <stdlib.h> | |
#include <string.h> | |
#include <ctype.h> | |
#ifndef JSON_ALLOC | |
#define JSON_ALLOC malloc | |
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef CMDL_H_ | |
#define CMDL_H_ | |
#ifdef _WIN32 | |
#include <windows.h> | |
static const char *cmdl_errlist[] = { | |
"No Error.", | |
"CreatePipe() failed: could not create a pipe.", | |
"CreateProcessA() failed: could not create child process.", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef LIST_H_ | |
#define LIST_H_ | |
#define LIST(TYPE, SIZE) \ | |
\ | |
static TYPE list_##TYPE[SIZE]; \ | |
static int list_start_##TYPE = 0; \ | |
static int list_end_##TYPE = 0; \ | |
int list_##TYPE_size = SIZE; \ | |
\ |
NewerOlder