View gist:38c9cb42e990d459b0a9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import string | |
class Node: | |
def __init__(self): | |
self._links = {} | |
self._is_finite = False | |
def set_link(self, letter, node): | |
if letter == '.': |
View gist:02711dc9c16242afd96f
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from multiprocessing import Pool, Pipe, Process | |
def work(process_name, pipe): | |
while True: | |
print("%s Start w8!" % process_name) | |
data = pipe.recv() | |
print("%s You sent %s" % (process_name, data)) | |
if __name__ == "__main__": |
View gist:e411985a9dd0a496f7b3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from multiprocessing import Process, Manager, Event | |
from random import randint | |
children_count = 5 | |
block_size = 10000 | |
def find(my_id, found): | |
print("Process with id %s has been started" % my_id) | |
left = block_size * my_id | |
right = left + block_size |
View gist:74783a5329ce957e2bf0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from multiprocessing import Process, Queue | |
from time import sleep | |
def func(q, cnt, log): | |
for i in range(0, cnt): | |
item = q.get() | |
message = "Got an item %s\n" % item | |
log.put(message) | |
if __name__ == '__main__': |
View gist:5b763e36b128170cdb77
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module("test-app", []) | |
.controller("PDFDownloadController", ["$scope", "$http", function($scope, $http) { | |
function handleResponse(response){ | |
var pdfFile = new Blob([response.data], { type : 'application/pdf' }) | |
var downloadURL = URL.createObjectURL(pdfFile); | |
var link = document.createElement('a'); | |
link.href = downloadURL; | |
link.download = "preview.pdf" | |
document.body.appendChild(link); | |
link.click(); |
View gist:93c12dbd0ef5636e154b
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
# 1) a, b- min(x) a^x <= b | |
# 2) list - a, b; (a - b ) union (b - a) | |
# 3) a - find last atom | |
# 4) depth - the deepest sublist with sublists | |
# 5) sublists count | |
# 6) лінеаризація | |
# 7) min-max tree optonal | |
*/ |
View gist:3e77bc5299277ccdc137
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('geomApp') | |
.controller('MainCtrl', function ($scope) { | |
$scope.testesTriangles = []; | |
//$scope.points = [{x: 40, y: 400}, | |
// {x: 16, y: 300}, | |
// {x: 230, y: 200}, | |
// {x: 430, y: 100}, | |
// {x: 330, y: 400}, | |
// {x: 130, y: 270}]; | |
$scope.points = [{x: 116, y: 300}]; |
View gist:b376e3c3cfbd648e3983
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#from os import urandom | |
from random import randint | |
from time import * | |
__author__ = 'mlavrynenko' | |
smal_rsa_primes = [ | |
2 , 3 , 5 , 7 , 11 , 13 , 17 , 19, | |
23 , 29 , 31 , 37 , 41 , 43 , 47 , 53, | |
59 , 61 , 67 , 71 , 73 , 79 , 83 , 89, | |
] |
View gist:52c90f02379c85c40ce3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>English learner</title> | |
<link rel="stylesheet" type="text/css" href="bower_components/bootstrap/dist/css/bootstrap.css"> | |
<link rel="stylesheet" type="text/css" href="1.css"> | |
</head> | |
<body ng-app="LearnerApp" ng-controller="WordCtr"> | |
<div class="navbar navbar-static"> | |
<div class="container"> | |
<div class="navbar-header"> |
View gist:103feabce9e63ad39d22
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;Macro study | |
(defun range-helper(x) | |
(if (= x 0) | |
(list x) | |
(cons x (range-helper (- x 1))) | |
) | |
) | |
(defun range (x) | |
(reverse (range-helper (- x 1))) |
NewerOlder