Skip to content

Instantly share code, notes, and snippets.

View Akii's full-sized avatar
🚀
To the Moon

Akii

🚀
To the Moon
View GitHub Profile
@Akii
Akii / IQR.hs
Created November 11, 2018 12:53
module IQR where
import Prelude
import Data.List (sort)
-- needs to be sorted, non empty
type Sample = [Double]
testSample :: Sample
testSample = [5,7,10,15,19,21,21,22,22,23,23,23,23,23,24,24,24,24,25]
# This is the implicit global project's config file, which is only used when
# 'stack' is run outside of a real project. Settings here do _not_ act as
# defaults for all projects. To change stack's default settings, edit
# '/Users/akii/.stack/config.yaml' instead.
#
# For more information about stack's configuration, see
# http://docs.haskellstack.org/en/stable/yaml_configuration/
#
flags: {}
extra-package-dbs: []
@Akii
Akii / Aha.hs
Created November 5, 2018 21:33
import Pipes
import qualified Pipes.Prelude as P
p1 = each [1,2,3 :: Int]
p2 = each [4,5,6 :: Int]
main :: IO ()
main = do
runEffect ((p1 <> p2) >-> P.print)
{-

Basically I've a pipeline that handles elevator disruption events. Currently there are two sources for events: the remote API and the event store (for already happened events).

API source: https://github.com/Akii/elescore/blob/master/src/Elescore/Integration/DB.hs#L32

Store source: https://github.com/Akii/elescore/blob/master/src/Elescore/Pipeline.hs#L37

I run "projections" aka folds on those events. So when starting the program I replay previous events:

https://github.com/Akii/elescore/blob/master/src/Elescore/Pipeline.hs#L47

@Akii
Akii / Welp
Created November 3, 2018 12:52
In file included from lib/osxcode.cpp:30:
/nix/store/8v9xplbvxm2ddxv4nhbj21iryb4vmbjc-swift-corefoundation-private/Library/Frameworks/CoreFoundation.framework/Headers/CFBundlePriv.h:140:81: error: expected function body after function declarator
CFBundleRef _CFBundleCreateUnique(CFAllocatorRef allocator, CFURLRef bundleURL) API_AVAILABLE(macos(10.11), ios(9.0), watchos(2.0), tvos(9.0));
^
/nix/store/8v9xplbvxm2ddxv4nhbj21iryb4vmbjc-swift-corefoundation-private/Library/Frameworks/CoreFoundation.framework/Headers/CFBundlePriv.h:146:84: error: expected function body after function declarator
CFBundleRef _CFBundleCreateIfMightBeBundle(CFAllocatorRef allocator, CFURLRef url) API_DEPRECATED("Use CFBundleCreate instead", macos(10.6,10.10), ios(2.0,8.0), watchos(2.0,2.0), tvos(9.0,9.0));
^
/nix/store/8v9xplbvxm2ddxv4nhbj21iryb4vmbjc-swift-corefoundation-pri
@Akii
Akii / Eeeek
Created November 2, 2018 16:16
*** Exception: SQLite3 returned ErrorError while attempting to perform step: not an error
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE DefaultSignatures #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
module Test where
import ClassyPrelude
(PIT Day "2018-7-23" 2018-07-23 08:07:16.68912 UTC,952),
(PIT Day "2018-7-24" 2018-07-24 00:00:00 UTC,1440),
(PIT Day "2018-7-25" 2018-07-25 00:00:00 UTC,1440),
(PIT Day "2018-7-26" 2018-07-26 00:00:00 UTC,1440),
(PIT Day "2018-7-27" 2018-07-27 00:00:00 UTC,1440),
(PIT Day "2018-7-28" 2018-07-28 00:00:00 UTC,1147)
# T = Day
# 1 best grade, 6 worst
< 1 T -> 1
<= 1.5 T -> 2
<= 2.5 T -> 3
<= 4 T -> 4
<= 5 T -> 5
> 5 -> 6
rev: self: super:
{
elescore = import (builtins.fetchGit {
inherit rev;
url = https://github.com/Akii/elescore.git;
});
}
# error: value is a set while a string was expected, at /etc/nixos/overlays/elescore.nix:4:12