Skip to content

Instantly share code, notes, and snippets.

View shelomentsevd's full-sized avatar
🧶
<- my code

Dmitrii Shelomentsev shelomentsevd

🧶
<- my code
View GitHub Profile
#include<iostream>
#include<list>
#include<vector>
#include<random>
#include<chrono>
#include<algorithm>
using namespace std;
int main()
@shelomentsevd
shelomentsevd / noexcept.cpp
Created February 12, 2017 16:21
Пытаюсь разобраться что делает noexcept
// g++ main.cpp -o main -std=c++11
#include <iostream>
#include <vector>
#include <cstring>
#include <cstdlib>
#include <ctime>
const size_t cKeyLength = 100;
// expecting exceptions
@shelomentsevd
shelomentsevd / exceptions.cpp
Last active February 11, 2017 19:59
Short note about exceptions in C++
// C++ exceptions short-note
// Example
#include <exception>
class MyException: public std::exception
{
virtual const char * what() const throw()
{
return "Exception's description";
}
};
@shelomentsevd
shelomentsevd / sieve_of_eratosthenes.py
Created December 1, 2016 14:45
Python implementation of Sieve of Eratosthenes algorithm
# Python implementation of Sieve of Erathosthenes algorithm for prime number search
# Description here: https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes
N = 10000
p = 2
numbers = range(p, N + 1)
pIndex = 0
while p*p < N:
i = p
while i*p < N + 1:
n_i = i*p
var arr = [
{
'name': 'Paul',
'salary': '5 000$'
},
{
'name': 'Jessica',
'salary': '6 000$'
},
{