Skip to content

Instantly share code, notes, and snippets.

//https://github.com/Hopsken/openai-api-proxy
const upstream = 'https://api.openai.com'
export interface Env {
OPENAI_API_KEY: string
}
export default {
async fetch(
request: Request,
@likev
likev / server.py
Last active July 11, 2022 10:27 — forked from mdonkers/server.py
Simple Python 3 HTTP server for logging all GET and POST requests
#!/usr/bin/env python3
"""
Very simple HTTP server in python for logging requests
Usage::
./server.py [<port>]
"""
from http.server import BaseHTTPRequestHandler, HTTPServer
import logging
import cgi
@likev
likev / conrec.js
Created January 19, 2021 09:34 — forked from sdowsland/conrec.js
/**
* Copyright (c) 2010, Jason Davies.
*
* All rights reserved. This code is based on Bradley White's Java version,
* which is in turn based on Nicholas Yue's C++ version, which in turn is based
* on Paul D. Bourke's original Fortran version. See below for the respective
* copyright notices.
*
* See http://local.wasp.uwa.edu.au/~pbourke/papers/conrec/ for the original
* paper by Paul D. Bourke.
@likev
likev / max_sum_submatrix.cpp
Last active June 2, 2022 12:46
Given an n by m matrix of integers, find the submatrix with the maximum sum. Return the sum, left, right, top, bottom.
#include "max_sum_submatrix.h"
#include <iostream>
#include <vector>
int main()
{
std::vector<int> v = { 4,6,8,3,-233,6,5,-2,83,2,3,6,4 };
std::vector< std::vector<int> > matirx = {