Skip to content

Instantly share code, notes, and snippets.

View jigargandhi's full-sized avatar

Jigar jigargandhi

View GitHub Profile
@jigargandhi
jigargandhi / README.md
Last active January 5, 2024 11:36
Mariadb Setup instructions on Windows

Start with

https://mariadb.com/kb/en/Building_MariaDB_on_Windows/

Then run mariadb-install-db.exe in sq\RelWithDebInfo dir .\mariadb-install-db.exe --datadir ..\..\datadir

Then start mariadb.exe in the same folder.

In another terminal, run in client\RelWithDebInfo folder

@jigargandhi
jigargandhi / LICENSE
Created December 20, 2021 09:45 — forked from shaneutt/LICENSE
Golang: Demonstrate creating a CA Certificate, and Creating and Signing Certs with the CA
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
@jigargandhi
jigargandhi / BenchmarkResults.md
Last active November 2, 2019 17:02
StringExtensions for Memory<T> type
BenchmarkDotNet=v0.11.5, OS=Windows 10.0.18362
Intel Core i7-8850H CPU 2.60GHz (Coffee Lake), 1 CPU, 12 logical and 6 physical cores
.NET Core SDK=3.0.100
  [Host]     : .NET Core 3.0.0 (CoreCLR 4.700.19.46205, CoreFX 4.700.19.46214), 64bit RyuJIT
  DefaultJob : .NET Core 3.0.0 (CoreCLR 4.700.19.46205, CoreFX 4.700.19.46214), 64bit RyuJIT

@jigargandhi
jigargandhi / CharMemoryHolder.cs
Created November 1, 2019 14:08
CharMemoryHolder
public struct CharMemoryHolder
{
public ReadOnlyMemory<char> Value;
public override int GetHashCode()
{
// Murmur hash
uint c1 = 0xcc9e2d51;
uint c2 = 0x1b873593;
uint m = 5;
uint n = 0xe6546b64;
@jigargandhi
jigargandhi / SyncML.xml
Created October 28, 2019 08:17
Sample SyncML we receive from device
<SyncML xmlns="SYNCML:SYNCML1.2">
<SyncHdr>
<VerDTD>1.2</VerDTD>
<VerProto>DM/1.2</VerProto>
<SessionID>37</SessionID>
<MsgID>2</MsgID>
<Target>
<LocURI>https://jgandhi-w01/DeviceServices/Dm.svc/token/Fc3P6</LocURI>
</Target>
<Source>
@jigargandhi
jigargandhi / GetHashCode.cs
Created October 14, 2019 15:27
Murmur Hash for a ReadonlyMemory
public int GetHashCode(ReadOnlyMemory<char> source)
{
uint c1 = 0xcc9e2d51;
uint c2 = 0x1b873593;
uint m = 5;
uint n = 0xe6546b64;
uint hash = 42;
foreach (var charItem in source.Span)
{
@jigargandhi
jigargandhi / decorator.fsx
Created September 16, 2018 05:30
Decorator pattern in F#
let logger (f: 'a->'b) (valA:'a) =
printfn "Pre"
let result = f valA
printfn "Post"
result
let add5To x =
printfn "calling add5To"
x+5
let decoratedAdd = logger add5To
@jigargandhi
jigargandhi / memento.fsx
Created September 15, 2018 12:27
Memento Pattern in F#
// Memento Pattern in F#
type State<'T> = {State: State<'T> option; CurrentItem: 'T}
//'T -> State<'T>
let createState (instance :'T) =
{State=None; CurrentItem= instance}
//('a->'a)->State<'a>->State<'b'>
let updateState modifier currentState =
let newObject = modifier currentState.CurrentItem
{ State =Some currentState; CurrentItem = newObject}
@jigargandhi
jigargandhi / Form1.cs
Last active December 5, 2017 04:32
Show Modal Dialog
using System;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
@jigargandhi
jigargandhi / IntervalTrees.cs
Last active November 9, 2017 04:36
Segment Trees
using System;
class Program
{
static void Main(string[] args)
{
int[] values = new int[] { 1, 19, 9, 45, 20, 36, 35 };
IntervalTree tree = new IntervalTree(values);
tree.Build();
int x = tree.Query(1, 6);