- This will set up an ArangoDB instance with default port forwarding, i.e., port 8529 on the container (default ArangoDB port) will be mapped to port 8529 on the host.
- Make sure the volume (e.g.
arangoDbData
) exists on the host prior to trying to mount it (and do not change the destination path on the container unless you know what you're doing!) - To make sure a fresh image is always used, add
--pull always
anywhere in the parameter-defintion section of the command (i.e., before declaring which image to use, e.g., the very lastarangodb
). - Set your
ARANGO_ROOT_PASSWORD
in the environment variable, or useARANGO_NO_AUTH=1
for a non-authenticated ArangoDB instance (not recommended even for testing!), or useARANGO_RANDOM_ROOT_PASSWORD=1
and check the container logs for the generated password. - Example: always pull the default ArangoDB image, and run it with a user-
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
// Don't forget `FSharp.Data`, `Npgsql`, and `SQLProvider` packages in your project references (e.g. via `paket add` or `dotnet add`) | |
open FSharp.Data.Sql | |
[<Literal>] | |
let connString = | |
"Host=<host URL>;Port=26257;Database=vavm;Username=root" | |
type sql = SqlDataProvider<Common.DatabaseProviderTypes.POSTGRESQL, connString, "Common.NullableColumnType.OPTION"> | |
let ctx = sql.GetDataContext() |
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
(* | |
Handling a paginated REST API endpoint response in an optimized, iterative (i.e., stack-safe), tail-recursive, manner. | |
While the approach is general, the implementation details are concrete, but easily swapable. | |
Specifically, for each page of the response, and given the response conforms to the types defined, find any item, in this case CVE(s), that appears in both groups, `activeCves` and `closedCves` - that would indicate an issue with the logic of handling closed, and reopened, CVE(s). | |
Accumulate responses from every page, until finished, and display a summary of the finding. | |
Lastly, robust error handling is in place, handling possible failure to query the (remote) endpoint in a graceful way. | |
*) |
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
#r "nuget: FsCheck" | |
// module CreateStatisticalCollectionsWithFsCheck | |
open FsCheck | |
// FsCheck has a built-in function to choose random elements out of a collection with uniform distribution, i.e., equal chance of pulling any element of the collection: Gen.oneof. | |
let createUniformDistributedList n aSeq = | |
aSeq | |
|> Seq.map (fun elem -> gen { return elem }) |
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
#r "nuget: Expecto" | |
#r "nuget: Swensen.Unquote" | |
#r "nuget: Shouldly" | |
// module AssertionLibrariesExpectoIntegration | |
open Expecto | |
open Swensen.Unquote | |
open Shouldly |
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
module ConvertUnionCasesToStringAndBack | |
open FSharp.Reflection | |
// **Important** | |
// All reflective function in this module will succeed only for union cases that have no fields, e.g., type Blah = A | B | |
// In case of a union case that does have a field, e.g., type Blah = | A of int, an attempt to convert to, or from, that case will fail! | |
// See https://stackoverflow.com/questions/46334181/how-do-i-get-a-discriminated-union-case-from-a-string for an initial idea on how to solve this. | |
// Turn a union case to its string representation. |