Skip to content

Instantly share code, notes, and snippets.

View tomilov's full-sized avatar

Anatoliy V Tomilov tomilov

  • Yandex
  • Yekaterinburg
View GitHub Profile
@tomilov
tomilov / get and build latest boost on ubuntu.lua
Last active November 24, 2015 05:33
Lua script to clone latest revision of boost repository and to clone latest revisions of all the submodules. Also containing hints of how to build and install boost complitely. The download traffic is minimal possible: only single branch, only latest revision of the branch.
-- mkdir boost ; cd boost ; lua ../git-submodules-clone-HEAD.lua https://github.com/boostorg/boost.git .
local module_url = arg[1] or 'https://github.com/boostorg/boost.git'
local module = arg[2] or module_url:match('.+/([_%d%a]+)%.git')
local branch = arg[3] or 'master'
function execute(command)
print('# ' .. command)
return os.execute(command)
end
-- execute('rm -rf ' .. module)
if not execute('git clone --single-branch --branch ' .. branch .. ' --depth=1 ' .. module_url .. ' ' .. module) then
#include <iostream>
#include <iomanip>
#include <cstdint>
#include <cstdlib>
int
main()
{
@tomilov
tomilov / phash.cpp
Created October 6, 2015 06:02
crc32 hash
#include <iostream>
#include <cstdlib>
#include <cstddef>
#include <cstdint>
#include <x86intrin.h>
struct phash
{
@tomilov
tomilov / global_functor_on_demand.cpp
Created October 6, 2015 05:53
call qualified operator () of stateless global functor constructed on demand
#include <iostream>
#include <type_traits>
#include <utility>
#include <cstdlib>
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wglobal-constructors"
template< typename F >
F callee = {};
@tomilov
tomilov / lambda_enable_if.cpp
Created October 6, 2015 05:51
using enable_if as return type of lambda function
#include <type_traits>
#include <utility>
#include <iostream>
#include <cassert>
#include <cstdlib>
namespace details
{
@tomilov
tomilov / allocator.cpp
Last active October 7, 2015 06:34
Howard Hinnant's short_allocator implementation
#include <iostream>
#include <ostream>
#include <utility>
#include <type_traits>
#include <functional>
#include <memory>
#include <vector>
#include <cstdlib>
#include <cassert>
#!/usr/bin/env bash -vex
find ~ -maxdepth 2 -mindepth 2 -name ".git" -type d -print -execdir git pull \;