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 FixedSizeDictonary<TKey, TValue> : Dictionary<TKey, TValue> where TKey : notnull | |
{ | |
int size; | |
Queue<TKey> orderedKeys = new Queue<TKey>(); | |
public FixedSizeDictonary(int maxSize) => size = maxSize; | |
public new void Add(TKey key, TValue value) | |
{ | |
orderedKeys.Enqueue(key); | |
if (size != 0 && Count >= size) Remove(orderedKeys.Dequeue()); | |
base.Add(key, value); |
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
dotnet watch test --logger:"console;verbosity=detailed" |
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
/** | |
* @param {string} id - element id | |
* @returns {HTMLElement} | |
*/ | |
const gbid = (id) => { | |
const el = document.getElementById(id) | |
if (el === null) { | |
throw new Error('element not found: ' + id) | |
} | |
return el |
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
const sleep = (delay) => new Promise(resolve => setTimeout(resolve, delay)) |
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
using Microsoft.Extensions.Configuration; | |
using Microsoft.Extensions.Logging; | |
using System; | |
using System.Threading; | |
using System.Threading.Tasks; | |
namespace TemperatureController2 | |
{ | |
class Program | |
{ |
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
var wsUri = "ws://127.0.0.1:8999"; | |
ws = new WebSocket(wsUri); | |
ws.onopen = (e) => console.log(e) | |
ws.onmessage = (e) => console.log(e) |
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
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -name "SecurityLayer" -value 0 | |
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -name "UserAuthentication" -value 0 | |
Set-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -name "fAllowSecProtocolNegotiation" -value 0 | |
Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server' -name "fDenyTSConnections" -Value 0 |
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
'use strict'; | |
const iothub = require('azure-iothub') | |
const registry = iothub.Registry.fromConnectionString(process.env.IOTHUB_CONNECTION_STRING) | |
const device = {deviceId: 'ppr-bb-' + new Date().getTime(), status: 'enabled'} | |
registry.create(device, (err) => { | |
if (err) throw(err) | |
console.log(`Device ${device.deviceId} created`) |
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
import * as msRest from '@azure/ms-rest-js' | |
import {IoTHubTokenCredentials} from './iothub_token_credentials' | |
export type DigitalTwinGetResponse = { | |
body: any; | |
_response: msRest.HttpResponse & { | |
bodyAsText: string; | |
parsedBody: any; | |
}; | |
}; |
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
{ | |
"$schema": "https://aka.ms/terminal-profiles-schema", | |
"globals" : | |
{ | |
"alwaysShowTabs" : true, | |
"copyOnSelect" : false, | |
"defaultProfile" : "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}", | |
"initialCols" : 120, | |
"initialRows" : 30, | |
"keybindings" : |