Skip to content

Instantly share code, notes, and snippets.

Aleksei Semin alllex

View GitHub Profile
@alllex
alllex / stm-data-collection-test.sh
Created Oct 22, 2015
Script for setting up example of stm-data-collection usage
View stm-data-collection-test.sh
#!/bin/sh
dir=stm-data-collection-test
libdir=stm-data-collection
testdir=stm-data-test
cd /tmp
mkdir $dir
cd $dir
@alllex
alllex / Main.hs
Created Oct 22, 2015
Main file for stm-data-collection-test
View Main.hs
import Control.Monad ( forM_ )
import Control.Concurrent.STM
import qualified Data.STM.Bag as Bag
import qualified Data.STM.PriorityQueue as PQ
pqTest :: IO ()
pqTest = do
putStrLn "Start priority queue test"
pq <- atomically $ (PQ.new :: STM (PQ.Impl Int Int))
@alllex
alllex / stm-data-test.cabal
Created Oct 22, 2015
Cabal file for stm-data-collection-test
View stm-data-test.cabal
name: stm-data-test
version: 0.1.0.0
build-type: Simple
cabal-version: >=1.10
executable stm-data-test
main-is: Main.hs
build-depends: base >=4.8 && <4.9, stm >=2.4 && <2.5, stm-data-collection == 0.1.0.0
default-language: Haskell2010
View gist:35a498bd396b1cfa767e
import Control.Concurrent.STM
import Control.Concurrent.STM.TSkipList -- cabal install tskiplist
import Prelude hiding(minimum, maximum)
main :: IO ()
main = do
pq <- atomically $ new
atomically $ insert 8 80 pq -- insert the only item
atomically $ delete 8 pq -- remove it from skip list
(_, v) <- atomically $ minimum pq -- must be an error!!!
print v -- prints 80
@alllex
alllex / tail.c
Created Nov 9, 2012
Program outputs last lines of input file
View tail.c
/*
Math-Mech 2012-171
Semin A
Tail
*/
#include <stdio.h>
#include <malloc.h>
#include "logList.h"
#include <stdlib.h>
@alllex
alllex / Tail
Created Nov 9, 2012
Program outputs last lines of input file
View Tail
/*
Math-Mech 2012-171
Semin A
Tail
*/
#include <stdio.h>
#include <malloc.h>
#include "logList.h"
#include <stdlib.h>
You can’t perform that action at this time.