Skip to content

Instantly share code, notes, and snippets.

#include <stdlib.h>
#include <assert.h>
/*
* DYNAMIC ARRAY
*/
/*
* Dynamic array structure.
{-
module level doc here
-}
module Main ( main )
where
import qualified Data.Map as Map
import Data.List
import Data.Maybe
import System.Random (RandomGen, getStdGen)
@PiotrJander
PiotrJander / ucontext.h
Created November 10, 2016 01:25
ucontext.h
/* Copyright (C) 1997-2014 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
/**
* Initialization, just saves the output stream destination
*/
@Override
public void prepare(Map<String,String> stormConf,
TopologyContext context, OutputCollector collector) {
this.collector = collector;
this.context = context;
if (!stormConf.containsKey("mapClass"))
@PiotrJander
PiotrJander / SchedulerProcessCleanup.md
Last active February 3, 2019 05:07
Scheduler process cleanup

Scheduler process cleanup

Problem: recall that each process in Penn OS is implemented by a ucontext instance.

An instance of ucontext_t has the uc_link field. When the context's main function (the one set by makecontext) finishes and uc_link is NULL, then the whole Penn OS finishes and this is clearly not what we want.

Therefore, we want to have a cleanup_context (either one global or one for each process) such that we have uc_link = cleanup_context. The cleanup_context would perform cleanup (among other things set the state of the process to ZOMBIE) and then invoke the scheduler to schedule a new process.

select
word, url,
ranking(page_rank, prm, prd, tfidf, tfidfm, tfidfd) as ranking,
normalized(page_rank, prm, prd) as page_rank_norm,
normalized(tfidf, tfidfm, tfidfd) as tfidf_norm,
page_rank, prm, prd,
tfidf, tfidfm, tfidfd,
tf, idf, term_count, max_count, doc_count,
normal, title, document_url, heading, stop_word, out_link, in_link, host
from (
module Lib
(
) where
import Prelude
import Control.Monad.Reader
import Data.Matrix
@PiotrJander
PiotrJander / output.txt
Created April 14, 2017 07:18
Error on running the distDocker task with debugging JVM option set
chess piotr$ ./gradlew distDocker --info --stacktrace
Connected to daemon DaemonInfo{pid=24251, address=[a39f97b5-4164-4998-a5cc-45b912526881 port:64016, addresses:[/0:0:0:0:0:0:0:1, /127.0.0.1]], idle=true, context=DefaultDaemonContext[uid=debe9277-d03e-4b1c-8cac-44c829bfd45b,javaHome=/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home,daemonRegistryDir=/Users/piotr/.gradle/daemon,pid=24251,idleTimeout=10800000,daemonOpts=-XX:MaxPermSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=UTF-8,-Duser.country=PL,-Duser.language=pl,-Duser.variant]}. Dispatching request Build{id=91547ebe-655d-4413-a938-230546aaf80e.1, currentDir=/Users/piotr/projects/chess}.
Received result org.gradle.launcher.daemon.protocol.BuildStarted@1e16c0aa from daemon DaemonInfo{pid=24251, address=[a39f97b5-4164-4998-a5cc-45b912526881 port:64016, addresses:[/0:0:0:0:0:0:0:1, /127.0.0.1]], idle=true, context=DefaultDaemonContext[uid=debe9277-d03e-4b1c-8cac-44c829bfd45b,javaHome=/Library/Java/JavaVirtualMachines/jd
@PiotrJander
PiotrJander / gruzja.md
Last active June 6, 2021 20:02
Zbieramy na bilet do Gruzji dla Marcina

Jak to działa?

Próbujemy: zbieramy na urodzinowy bilet do Gruzji dla Marcina.

Okazja: dwudzieste drugie urodziny Marcina.

Cel: 600 złotych. Tyle właśnie kosztują najtańsze bilety wakacyjne WizzAirem do Kutaisi. Jeżeli będzie trzydzieści osób, z których każda będzie gotowa włożyć 20 złotych, damy radę.

Jak działamy: każdy, kto chciałby się zaangażować, niech napisze w komentarzu. Jeżeli będzie dość dużo osób, uzgodnimy, jak dalej.

#include <cstdio>
#include "funkcje.h"
#include "klasy.h"
#include <conio.h>
//#include "silnik.h"
//deklaracja obiekt�w:
gracz geralt;
gracz wrog;
przedmiot rzecz[6];