This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- dfa.c.back 2013-08-05 16:53:47.824514544 +0400 | |
+++ dfa.c 2013-08-25 04:23:18.783885918 +0400 | |
@@ -1992,6 +1992,115 @@ | |
s->elems[i] = s->elems[i + 1]; | |
} | |
+/* merge implementation of sorted sets, then number of sets smore than 2 | |
+ priority queue aka 'heap' data structure used to select maximum of | |
+ many elements */ | |
+ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <fstream> | |
int main() { | |
std::ifstream empty("empty.txt"); | |
std::ifstream no_file("no_file.txt"); | |
std::cout << "bool: " << (empty?"e 1":"e 0") << ' ' << (no_file?"n 1":"n 0") << '\n'; | |
std::cout << "rdstate:" << (empty.rdstate()?"e 1":"e 0") << ' ' << (no_file.rdstate()?"n 1":"n 0") << '\n'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Python.h> | |
#include <stdlib.h> | |
#include <stdio.h> | |
#define UTF8_ACCEPT 0 | |
#define UTF8_REJECT 1 | |
#include <stdint.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$diff -u ~/tmp/grep-2.14/src/dfa.c.prev ~/tmp/grep-2.14/src/dfa.c | |
--- /home/dobrokot/tmp/grep-2.14/src/dfa.c.prev 2013-08-05 16:53:47.824514544 +0400 | |
+++ /home/dobrokot/tmp/grep-2.14/src/dfa.c 2013-08-05 16:50:41.435058597 +0400 | |
@@ -1978,6 +1978,52 @@ | |
m->elems[m->nelem++] = s2->elems[j++]; | |
} | |
+static void | |
+merge_inplace (position_set const *src, position_set *dst) | |
+{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# usage: | |
# LC_ALL=C grep "$(python fuzzy_search.py "HELLO")" input.file.utf8.txt | |
import sys | |
s = sys.argv[1] | |
su = s.decode('utf-8') | |
utf8_any = '[^\x80-\xbf][\x80-\xbf]*' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
print "hello, world" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ulam spiral, rotate 45 degree | |
# http://users.livejournal.com/_winnie/392996.html | |
import Image | |
def is_prime(n): | |
if n <= 2: | |
return 1 | |
k = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import pylab as pl | |
import numpy as np | |
import random | |
import sys | |
stat = {} |