Skip to content

Instantly share code, notes, and snippets.


Block or report user

Report or block dobrokot

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
dobrokot /
Last active Dec 20, 2015
fuzzy search regexp generator
# usage:
# LC_ALL=C grep "$(python "HELLO")" input.file.utf8.txt
import sys
s = sys.argv[1]
su = s.decode('utf-8')
utf8_any = '[^\x80-\xbf][\x80-\xbf]*'
View exceptions.cpp
#include <iostream>
#include <string>
#include <stdexcept>
#include <stdlib.h>
void g(int i) {
if (i % 4 == 0 && i % 6 == 0)
throw std::logic_error("FATALITY");
if (i % 3 == 0)
dobrokot /
Created Jun 21, 2013
# ulam spiral, rotate 45 degree
# ulam spiral, rotate 45 degree
import Image
def is_prime(n):
if n <= 2:
return 1
k = 2
View gist:bad948b020e8708fc987
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
import telegram
from time import sleep
from urllib.error import URLError
except ImportError:
dobrokot / iospeed.cpp
Created Mar 13, 2013
Testing speed of ofstream and FILE*
View iospeed.cpp
#include <iostream>
#include <fstream>
#include <stdio.h>
const int N = 1000*1000*10;
void f1() {
std::ofstream out("out.txt", std::ios::binary);
for (int i = 0; i < N; ++i) {
View cum-sum-spped-test.cpp
* Fast computations of cumulative sums.
* D. Lemire, July 2012
* Best results with:
$ g++-4.7 -funroll-loops -O3 -o cumulsum cumulsum.cpp
$ ./unrolldeltas
#!/usr/bin/env python
import pylab as pl
import numpy as np
import random
import sys
stat = {}
View .vimrc
set autoindent
set smartindent
set tabstop=4
set shiftwidth=4
set expandtab
set softtabstop=4
set showmatch
dobrokot / haskell_like_lazy_lists.cpp
Last active Nov 4, 2015
View haskell_like_lazy_lists.cpp
#include <memory>
#include <functional>
#include <iostream>
#include <assert.h>
struct ListNode {
typedef std::function<std::shared_ptr<ListNode>()> NextGetterFunc;
NextGetterFunc next_getter;
std::shared_ptr<ListNode> cached_next;
You can’t perform that action at this time.