Skip to content

Instantly share code, notes, and snippets.

View rido-min's full-sized avatar
💭
coding

Rido rido-min

💭
coding
View GitHub Profile
openssl pkcs12 -in key.pfx -out key.pem -nodes
$c = New-SelfSignedCertificate -Subject "CN=RidoEdgeBox" -CertStoreLocation "Cert:\CurrentUser\My"
Export-Certificate -Cert $c -FilePath RidoEdgeBox.cer -Type CERT
certutil -encode .\RidoEdgeBox.cer .\RidoEdgeBox.der
bash -c "openssl x509 -in RidoEdgeBox.der -out RidoEdgeBox.cer.pem"
$mypwd = ConvertTo-SecureString -String "1234" -Force -AsPlainText
Export-PfxCertificate -Cert $c -FilePath RidoEdgeBox.pfx -Password $mypwd
bash -c "openssl pkcs12 -in RidoEdgeBox.pfx -out RidoEdgeBox.key.pem -nodes"
process.argv.push("-mk:MASTERKEY")
process.argv.push("-di:DEVICEID")
var dpsKeygen = require("dps-keygen")
@rido-min
rido-min / CreateConsoleLogger.cs
Created February 26, 2020 00:12
CreateConsoleLogger
var logger = LoggerFactory.Create(builder => { builder.AddConsole(); }).CreateLogger("Cat1");
@rido-min
rido-min / .gitignore
Last active March 7, 2020 06:39
basic_node_iot_client
node_modules/
.vscode/
@rido-min
rido-min / AddTo-SystemPath.ps1
Last active March 23, 2020 22:32
AddTo-SystemPath.ps1
Function AddTo-SystemPath {
Param(
[array]$PathToAdd
)
$VerifiedPathsToAdd = $Null
Foreach($Path in $PathToAdd) {
if($env:Path -like "*$Path*") {
Write-Host "Currnet item in path is: $Path"
@rido-min
rido-min / my-pnp-device-model.json
Last active June 2, 2020 07:12
simple-dotnet-device
{
"@context": "dtmi:dtdl:context;2",
"@id": "dtmi:com:example:mypnpdevice;1",
"displayName": "MyPnPDevice",
"@type": "Interface",
"contents": [
{
"@type": "Property",
"name": "myProperty",
"schema": "string"
@rido-min
rido-min / dtdl-snippets.json
Last active September 3, 2020 04:02
dtdl-snippets.json
"Add DTDL Property" : {
"prefix": ["dtp"],
"body" : ["{ \n\t\"@type\" : \"Property\", \n\t\"name\" : \"$1\", \n\t\"schema\" : \"$0\" \n},"],
"description": "Adds a DTDL property"
},
"Add DTDL Telemetry" : {
"prefix": ["dtt"],
"body" : ["{ \n \t\"@type\" : \"Telemetry\", \n\t\"name\" : \"$1\", \n\t\"schema\" : \"$0\" \n},"],
"description": "Adds a DTDL Telemetry"
},
@rido-min
rido-min / mydevice.json
Last active July 27, 2020 21:28
PnP device
{
"@context": "dtmi:dtdl:context;2",
"@id": "dtmi:com:example:mydevice;1",
"@type": "Interface",
"displayName": "mydevice",
"contents": [
{
"@type": "Telemetry",
"name": "workingSet",
"schema": "double"
@rido-min
rido-min / hub-service-api.js
Created February 3, 2021 02:13
CallHubAPIs.js
const https = require('https')
const crypto = require('crypto')
const hubUrl = 'xxx.azure-devices.net'
const path = '/devices?api-version=2020-09-30'
const key = 'xxxxxxxxxxxx'
const generateSasToken = (resourceUri, signingKey, policyName, expiresInMins) => {
resourceUri = encodeURIComponent(resourceUri);