Mounting
sshfs {user}@{host}:{path} {mounting_path} -o ServerAliveInterval=60 -o allow_other
MacOS unmount
umount -f {path}
| FROM debian:trixie-slim | |
| ENV HOME="/root" | |
| ENV LOCAL_BIN="$HOME/.local/bin" | |
| ENV PATH="$PATH:$LOCAL_BIN:$HOME/.hsthrift/bin:$HOME/.ghcup/bin" | |
| ENV LD_LIBRARY_PATH="$HOME/.hsthrift/lib" | |
| ENV PKG_CONFIG_PATH="$HOME/.hsthrift/lib/pkgconfig" | |
| ENV CABAL_CONFIG_FLAGS="-f-bundled-folly -fclang -f-hack-tests -f-rust-tests -f-python-tests" | |
| ENV CLANG_VER="19" |
| import weaviate, { WeaviateClient, Collection, vectors, generative } from 'weaviate-client'; | |
| // Best practice: store your credentials in environment variables | |
| const weaviateUrl = process.env.WEAVIATE_URL as string; | |
| const weaviateApiKey = process.env.WEAVIATE_API_KEY as string; | |
| async function importData(collection: Collection) { | |
| const data : { sentence: string }[] = [ | |
| // Nationalities | |
| "British", |
| module Database.MySQL | |
| ( Connected | |
| , withConnection | |
| , connected | |
| ) where | |
| import Control.Concurrent (MVar, newMVar, newEmptyMVar, putMVar, takeMVar, tryPutMVar, modifyMVar_) | |
| import Control.Concurrent.Async (withAsyncBound, withAsync, wait, waitEither) | |
| import Control.Exception (SomeException, SomeAsyncException, fromException, bracket, throwIO, tryJust, tryJust) | |
| import Control.Monad (unless, forever) |
| Wed Jul 3 12:04 2024 Time and Allocation Profiling Report (Final) | |
| main +RTS -p -RTS test ghcup | |
| total time = 56.65 secs (56648 ticks @ 1000 us, 1 processor) | |
| total alloc = 338,254,238,432 bytes (excludes profiling overheads) | |
| COST CENTRE MODULE SRC %time %alloc | |
| serialize.write Main Main.hs:(99,3)-(107,53) 27.6 27.7 |
| // run with `node index.js` | |
| function bubbleSort(list) { | |
| for (let limit = 1; limit < list.length; limit++) { | |
| for (let i = 0; i < list.length - limit; i++) { | |
| let left = list[i]; | |
| let right = list[i + 1]; | |
| if (left > right) { | |
| list[i] = right; | |
| list[i+1] = left; |
| {- Unnecessarily knot tying solution to https://github.com/josevalim/nested-map-reduce-traversal | |
| You can run it with: | |
| $ ghc Main.hs && ./Main | |
| Which outputs: | |
| Numbered 0 ("One",[Numbered 0 "A",Numbered 1 "B"]) | |
| Numbered 1 ("Two",[Numbered 2 "C",Numbered 3 "D",Numbered 4 "E"]) | |
| Numbered 2 ("Three",[Numbered 0 "F",Numbered 1 "G"]) | |
| Numbered 3 ("Four",[]) |
| {- This is a solution to https://github.com/josevalim/nested-map-reduce-traversal | |
| without using explicit accumulators. | |
| You can run it with: | |
| $ ghc Main.hs && ./Main | |
| Which outputs: | |
| Numbered 0 ("One",[Numbered 0 "A",Numbered 1 "B"]) | |
| Numbered 1 ("Two",[Numbered 2 "C",Numbered 3 "D",Numbered 4 "E"]) | |
| Numbered 2 ("Three",[Numbered 0 "F",Numbered 1 "G"]) |
Mounting
sshfs {user}@{host}:{path} {mounting_path} -o ServerAliveInterval=60 -o allow_other
MacOS unmount
umount -f {path}
| import Data.Function | |
| import Data.List | |
| import Data.Maybe | |
| import qualified Data.Set as Set | |
| import qualified Data.Map as Map | |
| -- Longest increasing subsequence | |
| -- O(nlogn) | |
| lis :: Ord a => [a] -> [a] | |
| lis = buildResult . snd . mapAccumL takeMax (Set.empty, Nothing) |