This file contains hidden or 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
""" | |
pip install outlines torch==2.4.0 transformers accelerate typing-extensions pillow pdf2image rich requests | |
may need to install tkinter: https://stackoverflow.com/questions/25905540/importerror-no-module-named-tkinter | |
sudo apt-get install poppler-utils | |
""" | |
from enum import Enum | |
from io import BytesIO |
This file contains hidden or 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 asyncio | |
import os | |
import random | |
import hashlib | |
from datetime import datetime | |
from typing import Dict, List, Type | |
from dotenv import load_dotenv | |
from loguru import logger | |
from pydantic import BaseModel |
This file contains hidden or 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
(ns parquet-layout.core) | |
(defn destock | |
([stock] stock) | |
([stock board] | |
(let [n (dec (stock board))] | |
(if (zero? n) | |
(dissoc stock board) | |
(assoc stock board n))))) |
This file contains hidden or 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
(ns rxjava-datomic.query | |
(:require [datomic.api :as d]) | |
(:use [clojure.repl :only [pst]]) | |
(:import [rx Observable] | |
datomic.Peer)) | |
(defn query [qry & inputs] | |
(Observable/toObservable | |
(Peer/q qry (object-array inputs)))) |
This file contains hidden or 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
(defn- optimal-plan-ordered [bids] | |
(let [optimal-plan-after (fn [flight] | |
(let [earliest (+ (:DEPART flight) (:DUREE flight)) | |
after (drop-while #(< (:DEPART %) earliest) bids)] | |
(if (empty? after) {:gain 0 :path '()} (optimal-plan-ordered after)))) | |
current-plan (fn [flight] | |
(let [{:keys [gain path]} (optimal-plan-after flight)] | |
{:gain (+ (:PRIX flight) gain) :path (conj path (:VOL flight))}))] | |
(reduce #(if (> (:gain %2) (:gain %1)) %2 %1) (map current-plan bids)))) |