Skip to content

Instantly share code, notes, and snippets.

View kaharlichenko's full-sized avatar
🇺🇦

Ihor Kaharlichenko kaharlichenko

🇺🇦
  • Cracow, Poland
  • 10:45 (UTC +01:00)
View GitHub Profile
@kaharlichenko
kaharlichenko / easy217.fs
Last active August 29, 2015 14:24
Solution for /r/dailyprogrammer 217 easy challange without input parsing
// See https://www.reddit.com/r/dailyprogrammer/comments/3840rp/20150601_challenge_217_easy_lumberjack_pile/
let pileUpCollectionOnce distributeLogs collection logs =
let rec pileUpCollectionOnceRec acc element logs =
match acc, element, logs with
| acc, [], _ -> (List.rev acc, logs)
| acc, _, 0 -> (List.append (List.rev acc) element, logs)
| acc, head :: tail, logs ->
let newElement, remainingLogs = distributeLogs head logs
pileUpCollectionOnceRec (newElement :: acc) tail remainingLogs
@kaharlichenko
kaharlichenko / unix-domain-socket.patch
Created September 19, 2014 12:06
Unix Doman Sockets for Twisted@802ba0f on Python3
commit 37114709f33b0818ed3f18174d740015c786fff9
Author: Ihor Kaharlichenko <[email protected]>
Date: Fri Sep 19 15:21:30 2014 +0400
Port Unix Domain Socket support to Python3
See https://twistedmatrix.com/trac/ticket/6466
diff --git a/twisted/internet/endpoints.py b/twisted/internet/endpoints.py
index 238c272..f851ee4 100644
@kaharlichenko
kaharlichenko / regexp.py
Created June 2, 2012 08:57
Parsing subset of regexp
#!/usr/bin/env python
# We will consider the following regular expressions:
#
# single characters # a
# regexp1 regexp2 # ab
# regexp * # a*
# regexp1 | regexp2 # a|b
# ( regexp ) # (a|b)* -- same as (?:a|b)