Skip to content

Instantly share code, notes, and snippets.

View vralex's full-sized avatar

Vladimir A. Del vralex

View GitHub Profile
#include <iostream>
struct Widget {
template <typename T, typename U>
void operator()(const T& a, const U& b)
{
std::cout << a << " " << b << std::endl;
}
};
#include <iterator>
template <typename T>
void rotate(T begin, T end, int k)
{
typedef typename std::iterator_traits<T>::value_type TValue;
// ...
}
__author__ = 'VladimirDel'
import sys
import os
import csv
CLASSES_DIR = "/Users/VladimirDel/Projects/java/diploma/dist/data/network/kddcup/classes/"
OUTPUT_DIR = "/Users/VladimirDel/Projects/java/diploma/dist/data/network/kddcup/output/"
TEST_DATASET = "kddcup.tst"
@vralex
vralex / roman_test.py
Created August 15, 2013 16:16
Dive into python 3 example. Unit testing.
__author__ = 'VladimirDel'
import roman
import unittest
class KnownValues(unittest.TestCase):
known_values = ( (1, 'I'),
(2, 'II'),
(3, 'III'),
@vralex
vralex / roman.py
Created August 15, 2013 16:15
Dive into python example. Roman converting.
import re
__author__ = 'VladimirDel'
class OutOfRangeError(ValueError):
pass
class NotIntegerError(ValueError):
pass
@vralex
vralex / loader
Last active December 20, 2015 12:29
Скрипт для проверки страницы на наличие изменений
# -*- coding: utf8 -*-
__author__ = 'VladimirDel'
import urllib.request
import time
page_url = "http://ma.hse.ru"
prev_text = urllib.request.urlopen(page_url).read()
cur_text = prev_text
@vralex
vralex / gist:6045864
Created July 20, 2013 17:53
Скрипт для сортировки строк в файле по последнему значению.
res = []
File.open('/Users/VladimirDel/Projects/Ruby/results.txt').each_line do |line|
words = line.split(' ')
res << [line, words[-1].to_i]
end
res.sort_by! { |elem| elem[1]}.reverse!
current = 1
res.each do |elem|
@vralex
vralex / simple.rb
Created May 29, 2013 07:43
Decision tree example using.
#!/usr/bin/ruby
require 'rubygems'
require 'decisiontree'
attributes = ['Temperature']
training = [
[36.6, 'healthy'],
[37, 'sick'],
[38, 'sick'],