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
#!/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 |
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
#include <windows.h> | |
#include <iostream> | |
#include <string> | |
#include <vector> | |
#include "mathskills.h" | |
using namespace std; | |
using namespace mathskills; | |
DWORD WINAPI ThreadOne(LPVOID lpParameter) |
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
# -*- 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' |
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
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 |
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 zmq, os | |
times = {} | |
reaction = {} | |
done = {} | |
number_of_tasks = 1.0 | |
mean = lambda l: sum(l)/len(l) | |
def actuality(t): |
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
.DS_Store |
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
<?xml version='1.0'?> | |
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'> | |
<!-- | |
1. Download the Symbola font: | |
http://users.teilar.gr/~g1951d/Symbola707.zip | |
2. unzip the file and put Symbola.ttf (and any of the other fonts that strike your fancy) | |
in your ~/.fonts/ directory | |
3. run `fc-cache -f`. You can check to make sure the new fonts |
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
# add this file to your ~/.zshrc file and restart zsh | |
# or just run "curl https://gist.github.com/zemlanin/5322437/raw/p.sh >> ~/.zshrc; exec zsh" | |
# | |
# input: | |
# p 2+4 4.0/3 _0+_1 | |
# | |
# and get output like: | |
# _0> 6 | |
# _1> 1.3333333333333333 | |
# _2> 7.333333333333333 |
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
# Генерируем цвет фона prompt'а, основываясь на md5-сумме hostname (только первые 2 шестнадцатеричные цифры) | |
export TERM=xterm-256color | |
__colorcode=$( | |
( | |
echo "ibase=16"; hostname | md5sum | cut -c1-2 | tr "[:lower:]" "[:upper:]" | |
) | bc | awk '{printf "[48;5;%dm", $1}' # Перед "[" стоит ESC-символ, который не отображается в браузере | |
) |
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 itertools, string, operator, requests | |
cypher = map(int, requests.get('https://projecteuler.net/project/cipher1.txt').text.split(',')) | |
for pwd in itertools.product(string.ascii_lowercase, repeat=3): | |
phrase = ''.join(itertools.imap(lambda x,y: chr(operator.xor(x, y)), cypher, itertools.cycle(map(ord, pwd)))) | |
if 'the' in phrase.lower() and 'and' in phrase.lower() and ' ' in phrase: | |
print phrase, '\n|\n+->\t', ''.join(pwd), '\n' |
OlderNewer