This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export WORKON_HOME=~/Envs | |
source /usr/local/bin/virtualenvwrapper.sh | |
export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{- | |
Updated to latest version - fixing a bug I didn't notice before with merge commit or binary file lines. | |
This tool parses a git history into a Haskell data type. | |
The history can then be further analysed using the ghci command line (all important | |
metrics are known / saved: commit hash, author, files it modifies and size of contributions). | |
I also added an example that prints a graphviz representation of the commit / file graph. | |
-} | |
import Text.Parsec | |
import Text.Parsec.Combinator |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE ScopedTypeVariables #-} | |
{-# LANGUAGE BangPatterns #-} | |
-- Needs bytestring-lexing installed to work! | |
import qualified Data.ByteString.Char8 as B | |
import qualified Data.ByteString.Lex.Double as B | |
import qualified Data.ByteString.Lex.Integral as B | |
import Data.Maybe | |
import Data.List |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE ScopedTypeVariables #-} | |
import Data.Char | |
import Data.List | |
import Data.Maybe | |
import Data.IORef | |
import qualified Data.Vector.Unboxed as V | |
import qualified Data.Vector.Generic.Mutable as MV | |
import Control.Monad | |
import System.Exit | |
import System.IO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE TypeSynonymInstances #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
import Control.Monad | |
{- | |
USAGE: | |
use the functions directly (if you know what you're doing), | |
or simply use the provided showStep function to get the matrix | |
after a certain number of relaxation iterations. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Control.Monad.State | |
import Prelude hiding (reads) | |
-- A list of dirty records, along with the transactions that wrote to them | |
-- Also contains a list of read records | |
data TransactionState = TransactionState | |
{ dirtyRecs :: [(Reg, Int)] | |
, reads :: [(Reg, Int)] | |
, dirtyCommits :: [Int] | |
, dirtyReads :: [Int] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def computeDifference(in: BufferedImage, compare: BufferedImage): BufferedImage = { | |
val w = in.getWidth | |
val h = in.getHeight | |
var result = new BufferedImage(w,h, BufferedImage.TYPE_INT_ARGB) | |
val graphics = result.getGraphics | |
graphics.setColor(java.awt.Color.BLACK) | |
graphics.clearRect(0,0,w,h) | |
for{ | |
x : Int <- 0 until w | |
y : Int <- 0 until h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Linear interpolation of a 2D double array | |
private double[,] Interpolate(double[,] matrix, int dim) | |
{ | |
double[,] result = new double[dim, dim]; | |
double sf = (double)(matrix.GetLength(0) - 1) / (double)(dim - 1d); | |
for (int x = 0; x < dim; x++) | |
{ | |
for (int y = 0; y < dim; y++) | |
{ |