Skip to content

Instantly share code, notes, and snippets.

View xiaoyvr's full-sized avatar

Yu Xiaoqiang xiaoyvr

  • ThoughtWorks
  • Dallas
View GitHub Profile
@xiaoyvr
xiaoyvr / Either.cs
Created October 24, 2016 08:47 — forked from siliconbrain/Either.cs
Implemetation of Haskell's Either type in C#
/// <summary>
/// Interface definition of Either
/// </summary>
/// <typeparam name="Tl">type of the Left value</typeparam>
/// <typeparam name="Tr">type of the Right value</typeparam>
public interface IEither<out Tl, out Tr>
{
/// <summary>
/// Check the type of the value held and invoke the matching handler function
/// </summary>
@xiaoyvr
xiaoyvr / docker-cleanup-resources.md
Created November 23, 2017 14:03 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

curl -LI mazgi.com -o /dev/null -w '%{http_code}\n' -s
@xiaoyvr
xiaoyvr / stash_dropped.md
Created February 10, 2022 00:01 — forked from joseluisq/stash_dropped.md
How to recover a dropped stash in Git?

How to recover a dropped stash in Git?

1. Find the stash commits

git log --graph --oneline --decorate ( git fsck --no-reflog | awk '/dangling commit/ {print $3}' )

This will show you all the commits at the tips of your commit graph which are no longer referenced from any branch or tag – every lost commit, including every stash commit you’ve ever created, will be somewhere in that graph.