Skip to content

Instantly share code, notes, and snippets.

@suryapratap
suryapratap / DataReaderConverter.cs
Created December 6, 2018 04:04
Create a JSON writer for IDataReader aiming to achieve a mild compression using a format similar to protobuf
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using System;
using System.Collections.Generic;
using System.Data;
namespace NewtonSoft.Json.Converters
{
public class DataReaderConverter : JsonConverter
{
@suryapratap
suryapratap / nipioHelper.js
Created October 20, 2020 05:39
simple helper function to generate nip.io url from a given IPV4
function ip2nipHex(ipv4){
return `http://${(ipv4.split('.').map(x=>parseInt(x).toString(16)).map(x=>('00'+x).substring(x.length)).join(''))}.nip.io`;
}