Skip to content

Instantly share code, notes, and snippets.

View dimchansky's full-sized avatar

Dmitrij Koniajev dimchansky

View GitHub Profile
@dimchansky
dimchansky / app_deps.erl
Created November 14, 2012 07:17 — forked from ferd/app_deps.erl
Quick escript to generate a visualization of app dependencies in Erlang/OTP.
%%% Run with 'escript app_deps.erl'
%%% Change the path in filelib:wildcard/1 as required to capture all
%%% your dependencies.
%%%
%%% Rectangular nodes will represent library apps (no processes involved)
%%% and the circular nodes will represent regular apps. An arrow going from
%%% 'A -> B' means 'A depends on B'.
%%%
%%% This script depends on graphviz being present on the system.
-module(app_deps).
@dimchansky
dimchansky / Hubs.tt
Created April 29, 2013 20:50 — forked from robfe/Hubs.tt
<#@ template debug="true" hostspecific="true" language="C#" #>
<#@ output extension=".d.ts" #>
<# /* Update this line to match your version of SignalR */ #>
<#@ assembly name="$(SolutionDir)\packages\Microsoft.AspNet.SignalR.Core.1.0.0-rc1\lib\net40\Microsoft.AspNet.SignalR.Core.dll" #>
<# /* Load the current project's DLL to make sure the DefaultHubManager can find things */ #>
<#@ assembly name="$(TargetPath)" #>
<#@ assembly name="System.Core" #>
<#@ assembly name="System.Web" #>
<#@ assembly name="System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" #>
<#@ assembly name="System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" #>
@dimchansky
dimchansky / Hubs.tt
Created April 29, 2013 20:51 — forked from upta/Hubs.tt
<#@ template debug="true" hostspecific="true" language="C#" #>
<#@ output extension=".d.ts" #>
<# /* Update this line to match your version of SignalR */ #>
<#@ assembly name="$(SolutionDir)\packages\Microsoft.AspNet.SignalR.Core.1.0.1\lib\net40\Microsoft.AspNet.SignalR.Core.dll" #>
<# /* Load the current project's DLL to make sure the DefaultHubManager can find things */ #>
<#@ assembly name="$(TargetPath)" #>
<#@ assembly name="System.Core" #>
<#@ assembly name="System.Web" #>
<#@ assembly name="System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" #>
<#@ assembly name="System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" #>
(*
This script analyzes the dependencies between top level types in a .NET Assembly.
It is then used to compare the dependency relationships in some F# projects with those in some C# projects.
Note that no attempt has been made to optimize the code yet!
REQUIRES:
* Mono.Cecil for code analysis
From http://www.mono-project.com/Cecil#Download
@dimchansky
dimchansky / DPH-SMVMVectorised.hs
Created November 6, 2013 21:37
Sparse matrix-vector multiplication in Haskell
{-# LANGUAGE ParallelArrays #-}
{-# OPTIONS -fvectorise #-}
module SMVMVectorised (smvmPA) where
import Data.Array.Parallel.Prelude
import Data.Array.Parallel.Prelude.Double as D
import Data.Array.Parallel.Prelude.Int as I
import qualified Prelude as P
import com.twitter.util.{Future => TwFuture}
import scala.concurrent.{Future => ScFuture, promise => ScPromise}
implicit def twFutureToScala[T](twFuture: TwFuture[T]): ScFuture[T] = {
val prom = ScPromise[T]
twFuture.onSuccess { res: T =>
prom.success(res)
}
twFuture.onFailure { t: Throwable =>
prom.failure(t)
}
@dimchansky
dimchansky / README.md
Last active August 29, 2015 14:07 — forked from chrisjacob/README.md

Intro

Description: Setup GitHub Pages "gh-pages" branch and "master" branch as subfolders of a parent project folder ("grandmaster").

Author: Chris Jacob @_chrisjacob

Tutorial (Gist): https://gist.github.com/833223

The Result

@dimchansky
dimchansky / ConvertRulesToJSON.cs
Last active August 29, 2015 14:17
Converts plain text request rules to JSON format
// add reference: Newtonsoft.Json
using System.Globalization;
using System.IO;
using System.Linq;
using Newtonsoft.Json;
namespace Rules.Transformation.Json
{
internal class Program
{
@dimchansky
dimchansky / MaybeMonad.cs
Last active August 29, 2015 14:17
Maybe monad in C#
using System;
namespace MaybeMonad
{
internal class Program
{
private static void Main()
{
var result = from a in "Hello ".ToMaybe()
from b in Nothing<string>.Instance
@dimchansky
dimchansky / Sorted-Word-Frequencies.hs
Created April 4, 2015 10:54
Counts the number of times each word appears in a (non-unicode) file and outputs result to other file sorting by frequencies and then by word (asc).
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TupleSections #-}
module Main where
import qualified Data.ByteString.Lazy as S
import qualified Data.ByteString.Lazy.Builder as SB
import qualified Data.ByteString.Lazy.Char8 as C
import Data.Foldable (foldMap)
import qualified Data.HashMap.Strict as HM
import Data.List (sortBy)