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
from collections import namedtuple | |
import numpy | |
Point = namedtuple('Point', ['x', 'y']) | |
class Point2: | |
def __init__(self, x, y): | |
self.x = x | |
self.y = y |
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 <stdio.h> | |
#include <stdlib.h> | |
// malloc some number of gigabytes, to test impact on system | |
// g++ -O3 alloc-mem-test.cpp && ./a.out | |
size_t WIDTH = 75; | |
int progress_bar(size_t i, size_t size) { | |
return i * WIDTH / size; | |
} |
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
set -eu | |
#скачиваю и распаковываю архивы из интернета | |
curl -sS http://llvm.org/releases/3.5.0/llvm-3.5.0.src.tar.xz | tar -xJf - & | |
curl -sS http://llvm.org/releases/3.5.0/cfe-3.5.0.src.tar.xz | tar -xJf - & | |
curl -sS http://llvm.org/releases/3.5.0/compiler-rt-3.5.0.src.tar.xz | tar -xJf - & | |
curl -sS http://llvm.org/releases/3.5.0/clang-tools-extra-3.5.0.src.tar.xz | tar -xJf - & | |
wait #жду, пока всё скачается | |
#mv в существующую папку создаёт лишний уровень иерархии, поэтому проверка на несуществование |
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
# -*- encoding: UTF-8 -*- | |
# http://avva.livejournal.com/2827068.html | |
# run as: | |
# ( echo шир. узк. ; python glass_water_avva.py | tac ) | column -t | |
# v1 - широкий стакан | |
# v2 - узкий стакан | |
from fractions import Fraction |
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
import os, re | |
fs = [] | |
for x in os.listdir('.'): | |
if x.endswith('.mp4'): | |
fs.append((os.path.getsize(x), x)) | |
fs2 = [] |
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 "uatraits/details/branch.hpp" | |
#include "uatraits/details/definition.hpp" | |
-#include "uatraits/details/hash_utils.hpp" | |
#include "uatraits/details/regex_definition.hpp" | |
#include "uatraits/details/static_definition.hpp" | |
#include "uatraits/details/string_definition.hpp" | |
@@ -181,7 +180,7 @@ | |
header = header.substr(0, header.length() - sizeof (to_strip) + 1); | |
} |
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
mkdir src_dir | |
mkdir exec_dir | |
python generate_variants.py | |
ls src_dir | xargs -P 100 -IF gcc src_dir/F -o exec_dir/F.x 2>/dev/null | |
find exec_dir/ | xargs -n 1 -P 1000 ./check_prog.sh |
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
( | |
find . -name '*.cpp' -or -name '*.h' | xargs grep -E '^ *[a-zA-Z0-9< >,:_]+ +[a-zA-Z0-9_]+;$' -o -h | grep '<' | grep '>' ; | |
find . -name '*.cpp' -or -name '*.h' | xargs grep -E '^ *[a-zA-Z0-9_]+ +[a-zA-Z0-9_]+;$' -o -h | |
) | awk '{print $2}' | sort -u | tr -d ';' > ../names.txt | |
find . -name '*.cpp' -or -name '*.h' | xargs fgrep --word-regexp -f ../names.txt -oh | sort | uniq -c | awk '$1 <= 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
//compile with g++ -std=c++11 select_print.cpp | |
#include <vector> | |
#include <iostream> | |
#include <string> | |
namespace detail { | |
struct FromAny { | |
template <class T> FromAny(const T&) {} |
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
LD 0 0 ; 00 | |
LD 0 1 ; 01 | |
LDF 5 ; 02 | |
LDC 0 ; 03 | |
TSEL 1824 1824 ; 04 | |
LDC 1 ; 05 | |
LDC 2 ; 06 | |
LDC 3 ; 07 | |
LDC 0 ; 08 | |
CONS ; 09 |