Skip to content

Instantly share code, notes, and snippets.

View YairHalberstadt's full-sized avatar

Yair Halberstadt YairHalberstadt

View GitHub Profile
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Gemini API Interface</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/18.2.0/umd/react.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/18.2.0/umd/react-dom.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/7.23.5/babel.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/tailwind.min.css" rel="stylesheet">
@YairHalberstadt
YairHalberstadt / alignment_simulator.go
Created December 22, 2024 07:08
Alignment Simulator (go)
package main
import (
"context"
"fmt"
"os"
"cloud.google.com/go/ai/generativelanguage/apiv1beta"
"cloud.google.com/go/ai/generativelanguage/apiv1beta/generativelanguagepb"
"google.golang.org/api/option"
@YairHalberstadt
YairHalberstadt / LinqMethodsUsage.md
Created April 22, 2021 13:31
Frequency Of Usage of Linq Methods

Frequency Of Usage of Linq Methods

Frequency Of Usage of Linq Methods

Methodology

I did a case sensitive search for usages of .<MethodName>( on https://grep.app/ in C# files.

For some I removed usages that were obviously not related to Linq where the problem was obvious and common - e.g string.Join( and sb.Append(.

@YairHalberstadt
YairHalberstadt / StringBuilderText.cs
Created December 2, 2020 06:58
Stringbuilder optimization
// 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 project root for more information.
using System;
using System.Diagnostics;
using System.Text;
using Roslyn.Utilities;
namespace Microsoft.CodeAnalysis.Text

Nominal Deconstruction

  • Proposed
  • Prototype: Not Started
  • Implementation: Not Started
  • Specification: Not Started

Summary

@YairHalberstadt
YairHalberstadt / ListDictionary.cs
Created August 26, 2020 05:56
A Dictionary backed by a list, efficient for small dictionary sizes with quick comparisons
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
public class ListDictionary<TKey, TValue> : IDictionary<TKey, TValue>
{
private readonly List<KeyValuePair<TKey, TValue>> _list;
public ListDictionary()
@YairHalberstadt
YairHalberstadt / ImmutableSetInInsertionOrder.cs
Last active August 19, 2020 14:04
ImmutableSet preserving insertion order
using System.Collections;
using System.Collections.Generic;
using System.Collections.Immutable;
namespace StrongInject
{
internal class ImmutableSetInInsertionOrder<T> : IImmutableSet<T>
{
private readonly ImmutableDictionary<T, int> _items;
private readonly ImmutableSortedDictionary<int, T> _insertionOrder;
//#define run
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
//#define run
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
//#define run
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;