Skip to content

Instantly share code, notes, and snippets.

View pizycki's full-sized avatar

Paweł Iżycki pizycki

View GitHub Profile
module TreeZipper
type Tree<'value> =
| Item of 'value
| Section of Tree<'value> list
type Path<'value> =
| Top
| Node of Tree<'value> list * Path<'value> * Tree<'value> list
@hermanocabral
hermanocabral / Program.cs
Created January 28, 2012 16:45
RavenDB embedded test
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition.Hosting;
using System.Diagnostics;
using System.IO;
using System.Security.Cryptography;
using System.Text;
using Raven.Client;
using Raven.Client.Embedded;
using Raven.Database.Plugins;
@jboner
jboner / latency.txt
Last active July 28, 2024 12:12
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@thednaz
thednaz / gist:2897337
Created June 8, 2012 18:08
F# list reverse
let rec reverse list =
match list with
|[] -> []
|[x] -> [x]
| head::tail -> reverse tail @ [head]
let rec rev list acc=
match list with
| [] -> acc
| [x] -> x::acc
@kanzure
kanzure / git-commit-cleaner.py
Last active May 17, 2022 17:25
git-filter-branch examples and notes
"""
Creates pretty-looking commit messages for git. This was created to pretty
print the old-commit-id values for filter-branched-rewritten commits in
pyphantomjs from the phantomjs repository.
"""
import os
import sys
@iamarcel
iamarcel / Creating Neat .NET Core Command Line Apps.md
Last active November 28, 2023 10:41
Creating Neat .NET Core Command Line Apps

Creating Neat .NET Core Command Line Apps

You can now read this on my (pretty) website! Check it out here.

Every reason to get more HackerPoints™ is a good one, so today we're going to write a neat command line app in .NET Core! The Common library has a really cool package Microsoft.Extensions.CommandlineUtils to help us parse command line arguments and structure our app, but sadly it's undocumented.

No more! In this guide, we'll explore the package and write a really neat

@troykelly
troykelly / ghost_index.js
Last active May 5, 2019 18:27
Adding HSTS to Ghost Blog
// # Ghost Startup
// Orchestrates the startup of Ghost when run from command line.
var ghost = require('./core'),
express = require('express'),
errors = require('./core/server/errors'),
parentApp = express(),
hsts = require('hsts'),
express_enforces_ssl = require('express-enforces-ssl');
@louthy
louthy / CSharp Free Monad.cs
Last active April 2, 2022 16:20
C# Free Monad
//
// See https://github.com/louthy/language-ext
//
using System;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using LanguageExt;
using static LanguageExt.Prelude;