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; \ | |
\ |
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 HASHTABLE_H_ | |
#define HASHTABLE_H_ | |
#include <string.h> | |
unsigned int djb2(const char *str){ | |
unsigned long hash = 5381; | |
int c; | |
while ((c = *str++)) { |
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 _AUTO_BUILD_H_ | |
#define _AUTO_BUILD_H_ | |
#include <stdlib.h> | |
#ifndef AUTOBUILD_TARGET | |
#ifdef _WIN32 | |
#define AUTOBUILD_TARGET "autobuild.exe" | |
#else | |
#define AUTOBUILD_TARGET "./autobuild" |
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 <stdarg.h> | |
#include <wchar.h> | |
char *makestr(char *format, ...) { | |
va_list args; | |
int size; | |
char *result; | |
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 _GO_H_ | |
#define _GO_H_ | |
#include <curl/curl.h> | |
typedef struct { | |
char *headers; | |
char *body; | |
CURL *handle; | |
long int statuscode; |
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 _PRINTER_PAGE_H_ | |
#define _PRINTER_PAGE_H_ | |
#include <windows.h> | |
/* compile with flags -lgdi32 and -lwinspool */ | |
int PrintPage(wchar_t *printer_name, void (*callback)(HDC printer, void *userdata), void *userdata) { | |
HDC printer; | |
DOCINFOA docinfo; |
NewerOlder