Skip to content

Instantly share code, notes, and snippets.

View tomilov's full-sized avatar

Anatoliy V Tomilov tomilov

  • Yandex
  • Yekaterinburg
View GitHub Profile
#include <utility>
template< typename F, std::size_t ...indices >
struct enumerator
{
static constexpr const std::size_t size_ = sizeof...(indices);
static constexpr const std::size_t count_ = (indices * ...);
template< typename I >
struct decomposer;
// http://wiki.musl-libc.org/wiki/BuildingLLVM
// build libunwind and all other libraries in -m32 and -m64 versions
// export CFLAGS="-march=native -mavx"
// export CXXFLAGS="-march=native -mavx"
// CMAKE_C_FLAGS and CMAKE_CXX_FLAGS += -fPIC for libs
// build last cmake version from https://cmake.org/files/
wget https://cmake.org/files/v3.6/cmake-3.6.1.zip
open-vm-tools open-vm-tools-desktop htop vim
doxygen doxygen-gui graphviz gnuplot
git subversion mercurial
openssh-server openssl openvpn sshfs libssl-dev
g++-5 gcc-5 gdb
cmake cmake-qt-gui
lzma lzma-dev liblzma-dev liblzma5 zlib1g zlib1g-dev libcurl4-openssl-dev libbz2-dev libbz2-1.0
m4 libtool autoconf automake make dh-autoreconf
swig3.0 libxml2 libxml2-dev libxml2-utils libncurses libncurses-dev libedit-dev
python2.7 python2.7-dev python3 lua5.3 perl python-dev
#include <utility>
template< std::size_t I, typename F >
struct wrapper { F f; };
template< std::size_t I, typename F >
constexpr
F &
get(wrapper< I, F > * sg) noexcept
{
@tomilov
tomilov / ratio.cpp
Last active October 25, 2016 08:13
#include <numeric>
#include <cassert>
class ratio
{
std::size_t n, d; // numerator, denominator
void
@tomilov
tomilov / gcc.cpp
Created November 12, 2016 22:09
array to template arguments
#include <type_traits>
#include <utility>
#include <iterator>
#include <typeinfo>
#include <memory>
#include <mutex>
#include <string>
#include <cxxabi.h>
#include <type_traits>
#include <utility>
template< std::size_t index, typename type >
struct ref { type & value; };
template< std::size_t index, typename type >
type && get(ref< index, type > const & r)
{
return std::forward< type >(r.value);
#include <type_traits>
#include <utility>
#include <tuple>
struct filler { template< typename type > operator type (); };
template< typename aggregate,
typename index_sequence = std::index_sequence<>,
typename = void >
struct aggregate_arity
#include <boost/preprocessor/seq/for_each_i.hpp>
#include <boost/preprocessor/repetition/enum.hpp>
#include <utility>
#include <cstddef>
namespace details
{
@tomilov
tomilov / stream.js
Created April 23, 2017 18:27 — forked from padenot/stream.js
How to serve media on node.js
var http = require('http');
var path = require('path');
var fs = require('fs');
var AUDIOFILE = "./audio.ogg";
function serveWithRanges(request, response, content) {
var range = request.headers.range;
var total = content.length;
var parts = range.replace(/bytes=/, "").split("-");