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)
{
@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 April 28, 2024 19:30
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();
@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 May 3, 2024 13:00
The introduction to Reactive Programming you've been missing
@chrismccoy
chrismccoy / gitcheats.txt
Last active April 20, 2024 08:50
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"
# edit all commit messages
git rebase -i --root
# clone all your repos with gh cli tool
gh repo list --json name -q '.[].name' | xargs -n1 gh repo clone
@dgoguerra
dgoguerra / p4merge-git-tool.md
Last active March 24, 2024 14:02
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
@shsteimer
shsteimer / gist:7257245
Created October 31, 2013 21:10
Tip to delete tags by pattern
#delete all the remote tags with the pattern your looking for, ie. DEV-
git tag | grep <pattern> | xargs -n 1 -i% git push origin :refs/tags/%
#delete all your local tags
git tag | xargs -n 1 -i% git tag -d %
#fetch the remote tags which still remain
git fetch
@jasonrudolph
jasonrudolph / git-branches-by-commit-date.sh
Created February 12, 2012 20:40
List remote Git branches and the last commit date for each branch. Sort by most recent commit date.
# Credit http://stackoverflow.com/a/2514279
for branch in `git branch -r | grep -v HEAD`;do echo -e `git show --format="%ci %cr" $branch | head -n 1` \\t$branch; done | sort -r