Skip to content

Instantly share code, notes, and snippets.

#include <memory>
// Исключение этого типа должно генерироваться при обращении к "пустому" Optional в функции Value
struct BadOptionalAccess {
};
template <typename T>
class Optional {
private:
// alignas нужен для правильного выравнивания блока памяти
alignas(T) unsigned char data[sizeof(T)];
Optional(Optional&& other) : defined(other.defined) {
if (other.defined) {
new (data) T(std::move(other.Value()));
other.defined = false;
}
}
@minya
minya / 0_reuse_code.js
Created August 30, 2016 09:30
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@minya
minya / svm.py
Last active August 29, 2015 14:19 — forked from mblondel/svm.py
# Mathieu Blondel, September 2010
# License: BSD 3 clause
import numpy as np
from numpy import linalg
import cvxopt
import cvxopt.solvers
def linear_kernel(x1, x2):
return np.dot(x1, x2)
@minya
minya / asd
Created March 26, 2015 07:21
Лабораторная 2
{"nbformat_minor": 0, "metadata": {"language_info": {"file_extension": ".py", "mimetype": "text/x-python", "nbconvert_exporter": "python", "version": "3.4.1", "name": "python", "pygments_lexer": "ipython3", "codemirror_mode": {"name": "ipython", "version": 3}}, "kernelspec": {"language": "python", "name": "python3", "display_name": "Python 3"}}, "cells": [{"cell_type": "markdown", "metadata": {}, "source": "# \u041b\u0430\u0431\u043e\u0440\u0430\u0442\u043e\u0440\u043d\u0430\u044f 2\n# \u0411\u0440\u0435\u043b\u044c \u041c\u0438\u0445\u0430\u0438\u043b"}, {"cell_type": "markdown", "metadata": {}, "source": "# 1. \u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445"}, {"outputs": [{"metadata": {}, "data": {"text/plain": " word_freq_make word_freq_address word_freq_all word_freq_3d \\\n0 0.00 0.64 0.64 0 \n1 0.21 0.28 0.50 0 \n2 0.06 0.00 0.7
@minya
minya / gist:9663080
Created March 20, 2014 12:50
Contest Brel
{
"metadata": {
"name": "contest"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@minya
minya / Lab2.ipynb.json
Created March 13, 2014 12:39
Lab 2. Mikhail Brel.
{
"metadata": {
"name": "Lab2"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
@minya
minya / gist:9527669
Created March 13, 2014 12:39
Lab 2. Mikhail Brel.
{
"metadata": {
"name": "Lab2"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{