Skip to content

Instantly share code, notes, and snippets.

View zemlanin's full-sized avatar
💭
wandering aimlessly

Anton Verinov zemlanin

💭
wandering aimlessly
View GitHub Profile
@zemlanin
zemlanin / stats.py
Created December 7, 2012 15:47
ØMQ Queue model
import zmq, os
times = {}
reaction = {}
done = {}
number_of_tasks = 1.0
mean = lambda l: sum(l)/len(l)
def actuality(t):
@zemlanin
zemlanin / cm3tree.visualize.py
Created November 15, 2012 21:27
Graph visualization
def visualize(node, edges, done = [], depth = ()):
# Edge = namedtuple('Edge', 'source, dest')
paths = [e for e in edges if getattr(e, 'source') == node]
for edge in paths:
for d in depth:
if not d:
print '│',
else:
print ' ',
# is current path last in source's paths
@zemlanin
zemlanin / cm3.tree.py
Created November 11, 2012 08:28
Генерация дерева состояний
# -*- coding: utf-8 -*-
from collections import namedtuple
def f_t(k = None, mu = None):
if k:
return 'const('+str(k)+')'
elif mu:
return 'gauss('+str(mu)+')'
DEVICES = 'CPU, NBr1, SBr1, ISA1, COM, ISA2, USB, ATA, VGA, SBr2, RAM, GPU, NBr2'
@zemlanin
zemlanin / main.cpp
Created October 31, 2012 07:33
Win32 Multithreading
#include <windows.h>
#include <iostream>
#include <string>
#include <vector>
#include "mathskills.h"
using namespace std;
using namespace mathskills;
DWORD WINAPI ThreadOne(LPVOID lpParameter)
@zemlanin
zemlanin / loadmodel.py
Created October 31, 2012 07:31
Моделирование нагрузки
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Лабораторная работа №2 по курсу "Компьютерное моделирование"
# тема "Моделирование загрузки компьютерной системы"
# выполнил ст.3 к. ФIОТ, гр. IO-03 Веринов Антон
# Вариант: 3 задачи, 1 ядро; ГП, ВП, ISA, COM
from random import gauss, random
from operator import attrgetter, ne