Instantly share code, notes, and snippets.

View aspnetcore-2.0-windowsservercore-1709
# escape=`
# Installer image
FROM microsoft/windowsservercore:1709 AS installer-env
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
# Retrieve the runtime store
RUN @('2.0.0', '2.0.3', '2.0.5', '2.0.6') | % { `
$downloadUrl = \"https://dist.asp.net/runtimestore/${_}/win-x64/aspnetcore.runtimestore.zip\"; `
View dotnet-2.0.6-windowsservercore-1709
# escape=`
# Installer image
FROM microsoft/windowsservercore:1709 AS installer-env
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
# Retrieve .NET Core Runtime
ENV DOTNET_VERSION 2.0.6
ENV DOTNET_DOWNLOAD_URL https://dotnetcli.blob.core.windows.net/dotnet/Runtime/$DOTNET_VERSION/dotnet-runtime-$DOTNET_VERSION-win-x64.zip
View coroutine-simple.cpp
#include <future>
#include <iostream>
using namespace std;
future<int> async_add(int a, int b)
{
auto fut = std::async([=]() {
int c = a + b;
return c;
View sqlite-await.js
'use strict'
var sqlite = require('sqlite3').verbose();
var db = new sqlite.Database('test_db');
db.getAsync = function (sql) {
var that = this;
return new Promise(function (resolve, reject) {
that.get(sql, function (err, row) {
if (err)
View sqlite-promise.js
'use strict'
var sqlite = require('sqlite3').verbose();
var db = new sqlite.Database('test_db');
db.getAsync = function (sql) {
var that = this;
return new Promise(function (resolve, reject) {
that.get(sql, function (err, row) {
if (err)
View sqlite-callback.js
'use strict'
var sqlite = require('sqlite3').verbose();
var db = new sqlite.Database('test_db');
function vote(voter, callback) {
var val;
var getStmt = `SELECT Name, Count FROM Voters WHERE Name="${voter}"`;
console.log(getStmt);
db.get(getStmt, function(err, row) {
View rw_spin_lock.h
class rw_spin_lock
{
public:
rw_spin_lock()
{
_readers = 0;
}
public:
void acquire_reader()
View idispatch.cs
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication3
{
class Program
View valuetype.cs
using System;
interface IAdd
{
void Add(int val);
}
struct Foo : IAdd
{
public int value;
View host.cpp
#include <iostream>
#include <limits.h>
#include <stdlib.h>
#include <dlfcn.h>
#include <string.h>
#include <set>
#include <dirent.h>
#include <sys/stat.h>
#include "coreclrhost.h"