Skip to content

Instantly share code, notes, and snippets.

\documentclass[10pt,a4paper]{moderncv}
\usepackage{hyperref}
% XeTeX
\usepackage[MnSymbol]{mathspec}
\usepackage{xecyr}
% Локализация
\usepackage{polyglossia}
@borman
borman / tsc.cpp
Created January 19, 2014 21:56
Code snippet for ad-hoc profiling with RDTSC/RDTSCP.
struct tsc {
uint32_t cycles_low, cycles_high;
uint64_t cycles;
tsc() : cycles(0) {}
void begin() {
asm volatile (
"CPUID\n\t"/*serialize*/
"RDTSC\n\t"/*read the clock*/
@borman
borman / juick_backup.py
Last active August 29, 2015 13:55
Backup your public juick blog
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import codecs
import getpass
import glob
import json
import logging
import lxml.etree
@borman
borman / filter_map.cpp
Last active August 29, 2015 14:04
c++ filter_map
#include <iostream>
#include <vector>
#include <type_traits>
#include <boost/optional.hpp>
#include <boost/range/adaptor/transformed.hpp>
#include <boost/range/adaptor/filtered.hpp>
template<typename MapperT>
class filter_mapped_adaptor;
#include <cmath>
#include <cstdint>
#include <random>
#include <iostream>
template<typename Float, int N>
class log_sum {
static_assert(N > 0, "N must be positive");
def unary(symbol, priority):
# XXX: BRAIN DAMAGE HAZARD AHEAD
# Consider prioritize's argument: what's it for?
# Isn't it expected to be a number?
# How dare it work and work correctly?
# Turns out, Python mixed-type comparison semantics are exploited in an
# awkward way. Python specifies that when no other rules apply, e.g. no
# overridden comparison magic-methods on any side, it falls back to
# comparing both sides' type names.
# One could grep CPython sources for `default_3way_compare' function that
import asyncio
import aiohttp
import hunter
async def fetch(session, url):
async with session.get(url) as response:
return await response.text()