This file contains hidden or 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 sys | |
| import numpy as np | |
| from PIL import Image | |
| binarized_text = sys.argv[1] if len(sys.argv) == 2 else 'text.png' | |
| # Binarized (1-bit image) | |
| data = np.array(Image.open(binarized_text)) | |
| Image.fromarray(np.uint8(data * 255)).show() |
This file contains hidden or 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
| def revtree(self, sha=None): | |
| # We need to first traverse the tree and construct a state that | |
| # we can render to the end-user. This tree will be stored as a | |
| # JSON object on the commit message | |
| tree = {} | |
| seen = set() | |
| sha = sha or self.repo.head() | |
| for walker in self.repo.get_walker(include=[sha]): | |
| # Walk the commit and convert it into something usable |
This file contains hidden or 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
| var {{ namespace }} = {}; | |
| {{ namespace }}.urls = {{ urls }}; | |
| {{ namespace }}.resolve = function (name, kwargs) { | |
| var path = {{ namespace }}.urls[name]; | |
| if (!path) { | |
| throw('URL not found for view: ' + name); | |
| } |
This file contains hidden or 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> | |
| #include <sys/types.h> | |
| #include <sys/uio.h> | |
| #include <unistd.h> | |
| #define ascii_chars 128 | |
| struct Counter { | |
| char k; |
This file contains hidden or 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 <vector> | |
| #include <iostream> | |
| int main() | |
| { | |
| std::vector<std::pair<int, char>> tally(128); | |
| for (int i = 0; i < 128; i++) { | |
| tally[i].second = i; | |
| } |
This file contains hidden or 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 sys | |
| preamble = '#include <stdio.h>\nmain(){char a[5000]={0};char *p=a;%s;return 0;}' | |
| cmds = {'>': '++p;', '<': '--p;', '+': '++*p;', '-': '--*p;', | |
| '.': 'putchar(*p);', ',': '*p=getchar();', '[': 'while(*p){', ']': '}'} | |
| print(preamble%(''.join(cmds.get(i, '') for i in sys.stdin.read()))) |
This file contains hidden or 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 <vector> | |
| #include <cstdint> | |
| #include <iostream> | |
| #include <llvm/IR/LLVMContext.h> | |
| #include <llvm/IR/IRBuilder.h> | |
| #include <llvm/IR/Module.h> | |
| #include <llvm/ExecutionEngine/GenericValue.h> | |
| #include <llvm/ExecutionEngine/Interpreter.h> | |
| #include <llvm/ExecutionEngine/JIT.h> |
This file contains hidden or 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
| /** | |
| * Copyright 2013 Justin Bruce Van Horne <[email protected]> | |
| * | |
| * Licensed under the Apache License, Version 2.0 (the "License"); | |
| * you may not use this file except in compliance with the License. | |
| * You may obtain a copy of the License at | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.0 | |
| * | |
| * Unless required by applicable law or agreed to in writing, software |
This file contains hidden or 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 <string> | |
| #include <vector> | |
| #include <sstream> | |
| #include <exception> | |
| namespace std { | |
| std::string to_string(const char* value) | |
| { | |
| return std::string(value); | |
| } |
This file contains hidden or 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
| template <class OutputIter, class = void> | |
| class Foo; | |
| template <class OutputIter> | |
| class Foo<OutputIter, is_output_iterator<OutputIter>> { | |
| /* some class with an output iterator */ | |
| }; |