Skip to content

Instantly share code, notes, and snippets.

View chhh's full-sized avatar

Dmitry Avtonomov chhh

View GitHub Profile
@MaxWellHays
MaxWellHays / Heap.cs
Created October 27, 2020 19:17
C# Heap implementation
using System;
using System.Collections.Generic;
public class Heap<T>
{
List<T> a = new List<T>();
Comparer<T> comparer;
public Heap(Comparer<T> comparer)
{
// Copyright (c) 2019 Andrey Akinshin
// Licensed under The MIT License https://opensource.org/licenses/MIT
using System;
using System.Collections.Generic;
using System.Linq;
/// <summary>
/// The ED-PELT algorithm for changepoint detection.
///
/// <remarks>
@kvnxiao
kvnxiao / arch-linux-install-xps-15-9550.md
Last active April 24, 2020 18:32
arch-linux-install-xps-15-9550.md
@JamesRandall
JamesRandall / RedBlackTree.cs
Last active July 16, 2024 13:46
Red-Black Tree Implementation in C#
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
namespace OpinionatedCode.Collections
{
public sealed class RedBlackTree<TKey, TValue>
{
private readonly RedBlackTreeNode<TKey, TValue> _leaf = RedBlackTreeNode<TKey, TValue>.CreateLeaf();
@grossbart
grossbart / nix.md
Last active October 19, 2024 09:00
Nix on macOS

Nix

Nix is a powerful package manager that makes package management reliable and reproducible. It provides atomic upgrades and rollbacks, side-by-side installation of multiple versions of a package, multi-user package management and easy setup of build environments.

Installation

@nipafx
nipafx / build.gradle
Last active August 8, 2018 23:32
Publish project snapshots to Sonatype's snapshot repo with Gradle's maven-publish Plugin
// This is the Gist for a post I wrote about publishing snapshots with Gradle's maven-publish plugin:
// http://blog.codefx.org/tools/snapshots-gradle-maven-publish-plugin
// PROJECT_NAME is defined in settings.gradle
group 'PROJECT_GROUP'
version 'PROJECT_VERSION'
apply plugin: 'java'
apply plugin: 'maven-publish'
@subfuzion
subfuzion / empty-example.md
Last active February 26, 2024 20:39
Protocol Buffer example of importing and using empty

How to import and indicate empty request or reply messages:

import "google/protobuf/empty.proto";

service SomeService {
    rpc SomeOperation (google.protobuf.Empty) returns (google.protobuf.Empty) {}
}
@staltz
staltz / introrx.md
Last active November 14, 2024 11:27
The introduction to Reactive Programming you've been missing
@chrismccoy
chrismccoy / gitcheats.txt
Last active October 16, 2024 15:36
git cheats
# alias to edit commit messages without using rebase interactive
# example: git reword commithash message
reword = "!f() {\n GIT_SEQUENCE_EDITOR=\"sed -i 1s/^pick/reword/\" GIT_EDITOR=\"printf \\\"%s\\n\\\" \\\"$2\\\" >\" git rebase -i \"$1^\";\n git push -f;\n}; f"
# sort list of git repos with gh cli
gh repo list --limit 300 --json name -q '.[].name' | sort
# count total commits in a repo
git rev-list --all --count
@dgoguerra
dgoguerra / p4merge-git-tool.md
Last active July 6, 2024 08:51
Setup p4merge as difftool and mergetool on Windows

Setting up p4merge as diff and merge tool on Windows. Tried for Git version 1.8.4.msysgit.0.

Two alternatives are explained: using the command line, and directly editing the config file.

Setting up from the command line

Being the installation path "C:Program Files\Perforce\p4merge.exe", just run:

$ git config --global diff.tool p4merge