- 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 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
async { | |
use conn = new NpgsqlConnection (connectionString) | |
use cmd = conn.CreateCommand (CommandText="SELECT field1, field5 FROM some_table WHERE foo=:bar") | |
cmd.Parameters.AddWithValue ("bar", "baz) |> ignore | |
do! conn.OpenAsync () |> Async.AwaitTask // Automatically closed when disposed | |
use! reader = cmd.ExecuteReaderAsync() |> Async.AwaitTask | |
// Need a function to iterate through results | |
let rec readData results = async { | |
let! hasRecord = reader.ReadAsync () |> Async.AwaitTask | |
match hasRecord with |
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
# Sets up a development environment for Ubuntu 16.04. | |
sudo apt-get install -y curl | |
# Microsoft source | |
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg | |
sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg | |
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-xenial-prod xenial main" > /etc/apt/sources.list.d/dotnetdev.list' | |
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list' |
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
public class Main { | |
private static String buildBigString (int numStrings) { | |
StringBuffer sb = new StringBuffer(); | |
for(int i = 0; i < numStrings; i++) { | |
sb.append("12345678"); | |
sb.append(","); | |
} | |
return sb.toString(); | |
} |
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
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. |
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
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 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
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 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(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 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
# 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 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
UnixSignal.WaitAny ([|UnixSignal (Signum.SIGINT); UnixSignal (Signum.SIGTERM); UnixSignal (Signum.SIGQUIT)|], -1) |