- Unrecognized configuration section 'runtime' - this happens when machine.config isn't included. Use --machine-config /etc/mono/4.5/machine.config in addition to --config /etc/mono/config
- Some libraries are under /usr/lib/mono/4.5/Facade - things like System.Threading.Task.Extensions.dll. If these are used, then be sure to include them.
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
open System.Drawing | |
[<EntryPoint>] | |
let main argv = | |
let text = argv.[0] | |
use font = new Font("Courier New", 72.0f * 5.0f, FontStyle.Bold) | |
let getTextSize str = | |
use b = new Bitmap (1, 1) | |
use g = b |> Graphics.FromImage | |
g.MeasureString (str, font) |
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
let calcObjHash (objData:byte array) = | |
use sha1 = new System.Security.Cryptography.SHA1Managed () | |
let pre = | |
sprintf "blob %d\000" objData.Length | |
|> System.Text.Encoding.UTF8.GetBytes | |
use ms = new System.IO.MemoryStream () | |
ms.Write (pre, 0, pre.Length) | |
ms.Write (objData, 0, objData.Length) | |
ms.Position <- 0L | |
sha1.ComputeHash (ms) |
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
(* | |
* To get started, `dotnet new --lang f#` | |
* Add these to the 'dependencies' section in project.json: | |
"System.Threading.Tasks": "4.0.11-rc2-*", | |
"Microsoft.AspNetCore.Hosting":"1.0.0-rc2-final", | |
"Microsoft.Extensions.Logging.Console":"1.0.0-rc2-final", | |
"Microsoft.AspNetCore.Server.Kestrel":"1.0.0-rc2-final" | |
* And then edit Program.fs with reqHandler for the RequestDelegate, | |
* wrapping an async workflow. | |
*) |
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
UnixSignal.WaitAny ([|UnixSignal (Signum.SIGINT); UnixSignal (Signum.SIGTERM); UnixSignal (Signum.SIGQUIT)|], -1) |
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
# From debian, e.g. `docker run -it debian bash` | |
apt-get update | |
apt-get install -y ocaml-mingw-w64 gcc-mingw-w64 | |
echo 'print_string "Hello world!\n";;' >> hello.ml | |
/usr/bin/i686-w64-mingw32-ocamlopt -o hello.exe hello.ml |
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
:- module(githubapi, [list_repos/3]). | |
:- use_module(library(http/http_client)). | |
:- use_module(library(http/http_json)). | |
process_repo(J) :- | |
J = json(D), | |
format( | |
'~w \n\t~w \n\tlanguage: ~w \n\tclone url: ~w \n', | |
[D.name, D.description, D.language, D.clone_url] |
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
FROM frolvlad/alpine-glibc | |
RUN apk add --no-cache curl libstdc++ --repository http://dl-3.alpinelinux.org/alpine/edge/testing/ \ | |
&& curl -O https://dotnetcli.blob.core.windows.net/dotnet/master/Binaries/Latest/dotnet-linux-x64.latest.tar.gz \ | |
&& mkdir -p /usr/share/dotnet \ | |
&& tar -xzvf dotnet-linux-x64.latest.tar.gz -C /usr/share/dotnet \ | |
&& rm dotnet-linux-x64.latest.tar.gz \ | |
&& ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet |
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
FROM alpine | |
RUN echo 'using System; \ | |
namespace Program { \ | |
public class MyClass { \ | |
public static void Main(string[] args) { \ | |
Console.WriteLine ("Hello from C#"); \ | |
} \ | |
} \ | |
}' >> Program.cs | |
RUN apk add --virtual build-dependencies --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing --no-cache mono mono-dev musl-dev binutils gcc && \ |
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
let add2 num1 num2 = | |
num1 + num2 | |
// The compiler will do this: | |
let addTwo num1 = | |
fun num2 -> | |
num1 + num2 | |
// Both functions work the same, but the curried form accepts a single parameter and returns a function that accepts another parameter. |
OlderNewer