Skip to content

Instantly share code, notes, and snippets.

Sergey Yavnyi blacktaxi

Block or report user

Report or block blacktaxi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
blacktaxi / Carrotland.hs
Created Sep 29, 2015
Solution for a classic algo problem
View Carrotland.hs
-- stack --resolver lts-2.14 --install-ghc runghc --package hspec --package QuickCheck
module Carrotland where
import Data.List (sort, find, partition)
import Data.Maybe (fromMaybe)
type Point = (Integer, Integer)
-- projection of a segment on X and Y axes, respectively
blacktaxi / stack
Created Sep 29, 2015
stack bootstrapper
View stack
which stack > /dev/null
if [ $? -ne 0 ]; then
if [ ! -f ./.stack/stack ]; then
if [ $OS == "Darwin" ]; then
elif [ $OS == "Linux" ]; then
blacktaxi /
Created Aug 9, 2015
Save space on HD phone videos
# this script recodes phone videos to a lower bitrace encoding to save space.
# phones typically encode at a very high bitrate because they don't have enough
# CPU power to do a more compressed encoding in real time.
# generally this recoding does not affect perceived video quality.
# USAGE: [path]
blacktaxi / StructVsDU.fs
Last active Aug 29, 2015
F#: DU vs Struct performance
View StructVsDU.fs
module Test =
open System
open System.Diagnostics
let bench (actionFactory : unit -> (unit -> unit),
minIterations : int option) =
let minIterations = defaultArg minIterations 1
let properTime (action : unit -> unit)
blacktaxi / ShouldMatch.fs
Created Jul 5, 2015
Poor man's complex pattern matching in F# tests
View ShouldMatch.fs
let shouldMatch f x =
try f x |> ignore
with :? MatchFailureException as e ->
failwithf "Did not expect %A" x
let ``something should something`` () =
some "complicated" (funct "call")
|> shouldMatch (function | This (That _) _ And (These "things") -> ())
blacktaxi / ninject-dynamic-get.cs
Last active Dec 24, 2015
Ninject ConstructorArguments as named parameters to a dynamic invoke
View ninject-dynamic-get.cs
namespace Ninject
public static class NinjectExtensions
private class DynKernel : DynamicObject
private readonly IKernel kernel;
public DynKernel(IKernel inner)
blacktaxi / signextlib.bat
Created Sep 17, 2013
Shell script to sign a .NET assembly.
View signextlib.bat
@echo off
"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\sn.exe" -q -vf "%1" > NUL
echo Already signed: %~nx1
goto END
blacktaxi / markdown_block.rb
Created Aug 30, 2013
Inline markdown blocks in Jekyll layouts/pages.
View markdown_block.rb
module Jekyll
class MarkdownBlock < Liquid::Block
def initialize(tag_name, text, tokens)
require "kramdown"
def render(context)
content = super
View gist:6281977
open System.IO
open System.Net
let wc = new WebClient()
let trainingSetFile = Path.Combine( __SOURCE_DIRECTORY__, "trainingSet.csv")
contents = wc.DownloadString("")
blacktaxi /
Created Jul 28, 2013
Super-hack to enable hamlish-jinja templates in Wok.
from hamlish_jinja import HamlishTagExtension
from jinja2.environment import load_extensions
def enable_haml(page):
env = page.__class__.tmpl_env
env.extensions = load_extensions(env, [HamlishTagExtension])
hooks = {
'page.meta.pre': [enable_haml]
You can’t perform that action at this time.