Skip to content

Instantly share code, notes, and snippets.

Konrad kgadek

Block or report user

Report or block kgadek

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
@kgadek
kgadek / bench-core.hs
Last active Aug 29, 2015
Comparing fast & slow factorials
View bench-core.hs
[1 of 1] Compiling Main ( bench.hs, bench.o )
==================== Tidy Core ====================
Result size of Tidy Core = {terms: 85, types: 57, coercions: 30}
lvl_r2PK :: Type.Integer
lvl_r2PK = __integer 0
main11 :: Type.Integer
@kgadek
kgadek / gist:9515128
Created Mar 12, 2014
I can into lenses! (pt. 2)
View gist:9515128
{-# LANGUAGE RankNTypes #-}
import Data.Functor.Identity
import Control.Applicative
data Point = Point { _x :: Int, _y :: Int } deriving (Show)
data Rect = Rect { _a :: Point, _b :: Point, _c :: Point, _d :: Point} deriving (Show)
type Lens s a = forall f. Functor f => (a -> f a) -> s -> f s
@kgadek
kgadek / gist:9512169
Created Mar 12, 2014
I can into simple Lenses!
View gist:9512169
{-# LANGUAGE ExistentialQuantification #-}
data Point = Point { x :: Int, y :: Int } deriving (Show)
data Rect = Rect { a :: Point, b :: Point, c :: Point, d :: Point } deriving (Show)
data Lens s a = Lens { get :: s -> a, set :: s -> a -> s}
@kgadek
kgadek / example.erl
Created Mar 28, 2014
sweet two bugs :D
View example.erl
-module(example).
-export(sort/1).
-export(spawnedsort/3, merge/3). % publishing internal funs
% only for debugging
sort(X) ->
ChunkLen = length(X) div 2,
{L1, L2} = lists:split(ChunkLen, X), % pattern matching example 1
@kgadek
kgadek / tmp.py
Last active Aug 29, 2015
Remote debuggging dla Piotrka-Zimnioka
View tmp.py
#!/usr/bin/env python
class CQ(object):
bla = None
"""CQ Instance Object"""
def __init__(self, port, path, init):
self.port = port
self.path = path
self.init = init
@kgadek
kgadek / exercism-workon.sh
Last active Aug 29, 2015
Shell script to start working on exercism.io tasks, customised for my (Haskell) needs.
View exercism-workon.sh
exercism-workon() {
cd "$HOME/exercism.io/haskell/$1"
MODULE=$(runhaskell "$1_test.hs" 2>&1 | awk '/Could not find module/ {print $5}' | sed "s/[\`']//g")
if [ ! -z $MODULE ]; then
touch $MODULE;
else
MODULE=$(ls *.hs | grep -v _test.hs);
fi
@kgadek
kgadek / results.txt
Last active Aug 29, 2015
EvoGIL results
View results.txt
=====================================================================================================================================================================================================
[ PROBLEM ]..[ ALGO ]..[ TEST ]..[Budgt]..[ METRICS ]..[ RELIABLE ]..[ RESULT, confidence interval ]..[C.I]..[ σ ]..[ OUTLIERS ]..[ RES w/o outliers ]..[ σ w/o outliers ]..[ (C INT)/METRICS ]..
ackley :: hgs_ibea :: quick :: 50 :: dst from pareto :: OK :: 3.531 ≤ 4.091 ≤ 4.710 :: 95% :: 0.812 :: 9.09% mild -- extr. :: 3.908 ( -4.451%) :: 0.600 ( -26.056%) :: 28.835% ::
ackley :: :: :: :: distribution :: OK :: 31.714 ≤ 32.978 ≤ 34.100 :: 95% :: 1.620 :: -- mild -- extr. :: 32.978 ( +0.000%) :: 1.620 ( 0.000%) :: 7.235% ::
ackley :: :: :: :: extent :: OK :: 3.591 ≤ 3.756 ≤
@kgadek
kgadek / gist:11380592
Last active Aug 29, 2015
AGH Informatyka (sem 10) :: Zaawansowane Techniki Integracji Systemów :: Laboratoria 1
View gist:11380592
{-# LANGUAGE OverloadedStrings, DeriveGeneric #-}
import Web.Scotty
import Data.Aeson
import GHC.Generics
data Stuff = Stuff { dt :: Things
} deriving (Show, Generic)
instance FromJSON Stuff
instance ToJSON Stuff
data Things = Things { id :: Int
View graphite.md

Installing Graphite:

Graphite does two things:

  1. Store numeric time-series data
  2. Render graphs of this data on demand

What Graphite does not do is collect data for you, however there are some tools out there that know

@kgadek
kgadek / gist:c154992d4adc8b40c762
Last active Aug 29, 2015
Shortcut for print("stuff {key}".format(**locals())). Used a snippet: http://stackoverflow.com/a/6618825/547223
View gist:c154992d4adc8b40c762
def printl(s):
import inspect
frame = inspect.currentframe()
try:
print s.format(**frame.f_back.f_locals)
finally:
del frame
def foo():
a = 123
You can’t perform that action at this time.