Skip to content

Instantly share code, notes, and snippets.

@Crazy-Owl
Crazy-Owl / concurrent.d
Created September 10, 2014 07:15
concurrent.d
import std.stdio;
import std.conv;
import std.concurrency;
void workerFunc() {
int value = 0;
value = receiveOnly!int();
while (value >= 0) {
writefln("Worker: %s received", value);
double result = to!double(value) / 5;
@Crazy-Owl
Crazy-Owl / config.xml
Created August 27, 2012 16:56
Config
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<module>
<type>
<class>Scaffolded</class>
<param name="resource">programs</param>
<param name="unicode">title</param>
<param name="name">Программы</param>
</type>
@Crazy-Owl
Crazy-Owl / paukan.py
Created December 9, 2011 16:20
Паукан
#coding: utf-8
import os
from scrapy.contrib.spiders import CrawlSpider, Rule
from scrapy.contrib.linkextractors.regex import RegexLinkExtractor
class ZavtraSpider(CrawlSpider):
@Crazy-Owl
Crazy-Owl / gist:1321909
Created October 28, 2011 08:59
Random prime numbers
(defun random-number (length &key (current 0) odd)
(cond
((and odd (<= length 1)) (if (= 1 (mod current 2)) current (+ 1 current)))
((<= length 1) current)
(t (random-number (- length 1) :current (+ (ash current 1) (random 2)) :odd odd))))
(defun check-prime (n rounds)
(let
((basic-primes '(2 3 5 7 9 11 13 17 19 23 29 31 37 41)))
(if (loop for i in basic-primes
module Parser
open System
open System.Text
type Parser< 'T >(func : string -> Option<'T * string> ) =
member this.eval = func
(* Conditional parse *)
let (<?>) (par : Parser< 'T >) (pred : 'T -> bool) = Parser( fun x ->