Skip to content

Instantly share code, notes, and snippets.

@ridomin
ridomin / getLinesFromTextArea.js
Created Feb 10, 2021
geLlinesFromTextArea.js
View getLinesFromTextArea.js
/**
* @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
View sleep.js
const sleep = (delay) => new Promise(resolve => setTimeout(resolve, delay))
View ProgramCSWithConfigAndLogging.cs
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using System;
using System.Threading;
using System.Threading.Tasks;
namespace TemperatureController2
{
class Program
{
@ridomin
ridomin / client.js
Created May 31, 2020
WebSocketsDemo
View client.js
var wsUri = "ws://127.0.0.1:8999";
ws = new WebSocket(wsUri);
ws.onopen = (e) => console.log(e)
ws.onmessage = (e) => console.log(e)
View DisableNLA.ps1
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
@ridomin
ridomin / create-aziothub-device.js
Created Apr 21, 2020
create-aziothub-device.js
View create-aziothub-device.js
'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`)
View digital_twin_service_client.msrest.ts
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;
};
};
View windows-terminal-settings.json
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"globals" :
{
"alwaysShowTabs" : true,
"copyOnSelect" : false,
"defaultProfile" : "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
"initialCols" : 120,
"initialRows" : 30,
"keybindings" :
View wts-docker
FROM node:10.16.0-alpine
WORKDIR /usr/app
COPY ./package.json ./
RUN npm install --quiet
COPY . .
RUN npm run build
EXPOSE 3001
View mygitconfig.txt
git config --global user.name ridomin
git config --global user.email ridomin@live.com
git config --global alias.co checkout
git config --global alias.st status