Skip to content

Instantly share code, notes, and snippets.

View noskill's full-sized avatar

Anatoly Belikov noskill

  • SingularityNet
  • Russia, Chekhov
View GitHub Profile
@noskill
noskill / poisson_sagemath
Last active February 26, 2018 11:23
poisson distribution on sagemath
# this code can be run on cloud.sagemath.org
per_day = 1000000
per_sec = per_day/(24 * 3600)
cache = {}
def poisson(mean_per_second, x):
return e ** (-mean_per_second) * mean_per_second ** x / factorial(x)
@noskill
noskill / weather_log_parse.py
Created January 26, 2014 22:37
find requests per second
import argparse
import re
import random
import datetime
import os
import sys
import time
@noskill
noskill / check_login.py
Last active August 29, 2015 13:55
login validation
import re
import random
import time
def make_check_login_regexes():
line_start= r"""^([a-zA-Z])"""
long_line_expr = re.compile(line_start + r"""
([A-Za-z0-9\.-]{0,18}) # латинские буквы, цифры, точки и минус
([a-zA-Z0-9]) # alphanumeric
@noskill
noskill / get_active_ip.py
Created February 3, 2014 12:50
get most active ip addresses from log
import argparse
import re
import random
import datetime
import os
import sys
import time
from random import randrange
@noskill
noskill / next_word.py
Created February 11, 2014 08:11
generate strings in alphabetic order between two input strings
import sys
def next_word(start, current, end, diff_index):
for i in range(len(current) - 1, diff_index - 1, -1):
if current[i] != end[i]:
if i < len(start) - 1:
return current[:i] + chr(ord(current[i]) + 1) + start[i]
else:
return current[:i] + chr(ord(current[i]) + 1) + current[i+1:]
@noskill
noskill / test sort op for theano
Last active August 29, 2015 14:20
test sort op for theano
import numpy
import theano
import theano.tensor as T
theano.config.compute_test_value = 'raise'
theano.config.optimizer='None'
ar = numpy.random.random((2,3, 2))
ar += 1
x = T.dtensor3('x')
@noskill
noskill / github создание проекта
Created June 14, 2015 09:38
создание прокта на github
1) Создаёшь проект на https://github.com/new, к примеру с названием test
В интерфейсе выбираешь добавить подходящий .gitignore и лицензию по желанию.
2) Создаёшь директорию для проекта
В ней выполняешь:
git init
3) Копируешь с страницы проекта ссылку HTTPS clone URL
В директории выполняешь команду:
@noskill
noskill / c
Created August 7, 2015 14:58
Functional list
#include <iostream>
#include <memory>
template<class T>
struct Node
{
Node(T v, std::shared_ptr<const Node> tail): value(v), next(tail) {
// std::cout << "Node " << value << tail << std::endl;
};
const T value;
@noskill
noskill / problem2.pddl
Created November 8, 2016 12:45
pddl softgoal problem
(define (problem start-vms)
(:domain cluster)
(:objects
vm1 - virtualdomain
vm2 - virtualdomain
libvirt - daemon
node1 - node
node2 - node
@noskill
noskill / domain2.pddl
Created November 8, 2016 12:51
pddl softgoal domain
(define (domain cluster)
(:requirements :typing :action-costs )
(:types
resource - object
node - object
daemon - resource
virtualdomain - resource
softgoalorder
softgoal-mode
defstatus - object