Skip to content

Instantly share code, notes, and snippets.

View CIPop's full-sized avatar

Cristian Pop CIPop

  • Microsoft
  • Redmond
View GitHub Profile
@CIPop
CIPop / client_ipv4_ipv6.c
Created August 19, 2022 19:42
Dual-mode IPv4/IPv6 socket client for Linux
// Based on the dual-mode IPv4/IPv6 example in "The Linux Programming Interface", M. Kerrisk, 2010
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <netdb.h>
#include <errno.h>
#include <unistd.h>
#define PORT_NUM "443"
@CIPop
CIPop / AzureFunction.cs
Last active March 10, 2022 00:02
DPS_CustomAllocation
#r "Newtonsoft.Json"
using System.Net;
using System.Text;
using Newtonsoft.Json;
//using Microsoft.Azure.Devices.Shared;
//using Microsoft.Azure.Devices.Provisioning.Service;
//This function will return the iot hub hostname to provision to based on which of the list of hub names has the longest host name
public static async Task<HttpResponseMessage> Run(HttpRequestMessage req, TraceWriter log)
@CIPop
CIPop / Program.cs
Created April 15, 2021 21:31
Azure IoT SAS Enrollment Group
using System;
using System.Security.Cryptography;
using System.Text;
namespace dps_group_sas
{
class Program
{
public static string ComputeDerivedSymmetricKey(byte[] masterKey, string registrationId)
@CIPop
CIPop / moved.md
Last active June 4, 2021 20:50
Certificate Generation
@CIPop
CIPop / windows_terminal_solarized_dark.md
Last active February 7, 2024 18:39
Windows Terminal Solarized Dark
@CIPop
CIPop / detect_baud.ps1
Created November 6, 2018 03:45
Powershell Baud Detector
Write-Output "Available COM ports: "
[System.IO.Ports.SerialPort]::getportnames()
$Global:portName = "COM5"
Function TryBaud($rate)
{
$port= new-Object System.IO.Ports.SerialPort $Global:portName,$rate,None,8,one
$port.open()
$port.ReadTimeout = 1000
@CIPop
CIPop / ImportIntermediateCerts.cs
Last active November 6, 2018 03:46
Tool to import certificates into the My\Intermediate Certificate store.
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the https://github.com/dotnet/corefx project root for more information.
// Usage: <ImportIntermediateCerts.exe> <certificateChain.p7b>
// Importing certificates into the Intermediate Certificate store is required if the remote server
// has access only to the Root CA but not to the entire chain.
using System;
using System.Security.Cryptography.X509Certificates;
@CIPop
CIPop / Echo.ashx
Created September 30, 2016 17:43
Simple IIS/ASP.Net POST handler
<%@ WebHandler Language="C#" Class="Echo" %>
using System;
using System.Web;
using System.IO;
public class Echo : IHttpHandler {
public void ProcessRequest (HttpContext context) {
if (context.Request.HttpMethod == "POST")