Skip to content

Instantly share code, notes, and snippets.

View qrilka's full-sized avatar
🖥️
as always

Kirill Zaborsky qrilka

🖥️
as always
  • FP Complete
  • Arkhangelsk, Russia
View GitHub Profile
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE OverloadedStrings #-}
import Codec.Xlsx as X
import qualified Data.ByteString.Lazy as L
import Control.Lens
import Data.Time.Clock.POSIX
main :: IO ()
main = do
ct <- getPOSIXTime
@qrilka
qrilka / syscalls.md
Last active June 14, 2020 19:06
ZuriHac 2020 hatrace: syscalls to implement

Easy

FS

  • change directory: chdir, fchdir
  • change permissions: chmod, fchmod, fchmodat
  • change ownership: chown, fchown, lchown, fchownat
  • duplicate file descriptors: dup, dup2, dup3
  • create file descriptor for even notifications: eventfd, eventfd2, the latter is used by GHC RTS
  • FS synchronization: fdatasync, fsync, sync, syncfs - could be useful for checking if writes done by a program are durable
qrilka@qdesktop ~/ws/h/pkg-db-problems $ ./test.sh
Up to date
Reading package info from "dist-newstyle/packagedb/ghc-8.6.3/sample-1.0.0-inplace.conf" ... done.
sample-1.0.0: Warning: haddock-interfaces: /home/qrilka/ws/h/pkg-db-problems/dist-newstyle/build/x86_64-linux/ghc-8.6.3/sample-1.0.0/doc/html/sample/sample.haddock doesn't exist or isn't a file
sample-1.0.0: Warning: haddock-html: /home/qrilka/ws/h/pkg-db-problems/dist-newstyle/build/x86_64-linux/ghc-8.6.3/sample-1.0.0/doc/html/sample doesn't exist or isn't a directory
Unregistring single package:
real 0m0,196s
user 0m0,175s
sys 0m0,020s
@qrilka
qrilka / log.txt
Created October 5, 2018 22:58
ByteCodeLink.lookupCE error
qrilka@qdesktop ~/ws/h/lookupCE-error $ stack build
lookupCE-error-0.0.0: configure (lib)
Configuring lookupCE-error-0.0.0...
lookupCE-error-0.0.0: build (lib)
Preprocessing library for lookupCE-error-0.0.0..
Building library for lookupCE-error-0.0.0..
[1 of 2] Compiling Types ( Types.hs, .stack-work/dist/x86_64-linux-tinfo6/Cabal-2.0.1.0/build/Types.o )
[2 of 2] Compiling Storage ( Storage.hs, .stack-work/dist/x86_64-linux-tinfo6/Cabal-2.0.1.0/build/Storage.o )
lookupCE-error-0.0.0: copy/register
Installing library in /home/qrilka/ws/h/lookupCE-error/.stack-work/install/x86_64-linux-tinfo6/lts-11.22/8.2.2/lib/x86_64-linux-ghc-8.2.2/lookupCE-error-0.0.0-COOGtDoxxSQ4wdi6kXNjQW
[Just (ChResponsePkgDbs [ChPkgGlobal,ChPkgSpecific "/home/qrilka/.stack/snapshots/x86_64-linux-tinfo6/lts-11.3/8.2.2/pkgdb",ChPkgSpecific "/home/qrilka/ws/h/haskell-code-explorer/.stack-work/install/x86_64-linux-tinfo6/lts-11.3/8.2.2/pkgdb"]),Just (ChResponseFlags [("libxml2",False)]),Just (ChResponseVersion "GHC" (Version {versionBranch = [8,2,2], versionTags = []})),Just (ChResponseList ["-fbuilding-cabal-package","-O","-outputdir",".stack-work/dist/x86_64-linux-tinfo6/Cabal-2.0.1.0/build","-odir",".stack-work/dist/x86_64-linux-tinfo6/Cabal-2.0.1.0/build","-hidir",".stack-work/dist/x86_64-linux-tinfo6/Cabal-2.0.1.0/build","-stubdir",".stack-work/dist/x86_64-linux-tinfo6/Cabal-2.0.1.0/build","-i","-i.stack-work/dist/x86_64-linux-tinfo6/Cabal-2.0.1.0/build","-i.stack-work/dist/x86_64-linux-tinfo6/Cabal-2.0.1.0/build/autogen","-i.stack-work/dist/x86_64-linux-tinfo6/Cabal-2.0.1.0/build/global-autogen","-isrc","-I.stack-work/dist/x86_64-linux-tinfo6/Cabal-2.0.1.0/build/autogen","-I.stack-work/dist/x86_64-linux-t
diff --git a/wrappers/stack/ghc b/wrappers/stack/ghc
index 25b0c78..dfd21ab 100755
--- a/wrappers/stack/ghc
+++ b/wrappers/stack/ghc
@@ -1,5 +1,7 @@
#!/bin/bash
+set -e
+
# GHC wrapper for indexing Haskell packages.
@qrilka
qrilka / test.hs
Created April 27, 2018 08:43
Bad response for an exception
qrilka@qdesktop ~ $ curl -v localhost:8080/evaluated
* Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 8080 (#0)
> GET /evaluated HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.59.0
> Accept: */*
>
* HTTP 1.0, assume close after body
{-# LANGUAGE OverloadedStrings #-}
import Data.ByteString.Lazy as L hiding (putStrLn)
import Codec.Xlsx
import Control.Lens
import Data.Time.Clock.POSIX (getPOSIXTime)
main = do
bs <- L.readFile "test.xlsx"
let
xlsx0 = toXlsx bs
@qrilka
qrilka / leveldb_result
Last active December 21, 2015 15:10
File backed "dicts"
$ time python leveldb_test.py
real 0m0.153s
user 0m0.040s
sys 0m0.010s
@qrilka
qrilka / test.core
Created April 1, 2015 07:38
if vs case
module 'test' ['a'/1,
'b'/1,
'c'/1,
'module_info'/0,
'module_info'/1]
attributes []
'a'/1 =
%% Line 4
fun (_cor0) ->
%% Line 5