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
\begin{tikzpicture} | |
\draw% | |
(6, 0) coordinate (dividerlength) | |
(0, -1.5) coordinate (dividerbracegap) | |
(0, -1.3) coordinate (braceLCRgap); | |
\draw% | |
(0, -0.6) |
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
totally_a_database = { | |
"in 1": "out 1", | |
"in 2": "out 2", | |
"in 3": "out 3" | |
} | |
class MyClass: | |
def __init__(self): | |
self.dbitems = DatabaseView(totally_a_database) |
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
### [A] Only code | |
Although the code is appreciated, it should always have an accompanying explanation. This doesn't have to be long but it is expected. | |
### [A] Only code (moderation queue) | |
Although the code is appreciated, it should always have an accompanying explanation. This doesn't have to be long but it is expected. I've arrived here from a moderation queue because this was automatically flagged. Keeping answers to high quality will help prevent that. | |
### [Q] Truncated error | |
When showing errors, please *copy the whole error*. All of the information that you have is useful, so if you want better help you should tell us everything you see. | |
### [Q] Not on topic; not answerable |
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 random | |
import sys | |
from itertools import count | |
def read_map(map_path): | |
""" | |
Read map from the file given by map_path. | |
returns: iterable of (name, {neighbor: direction, ...}) | |
name: string of current city |
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
""" | |
Aliquot Chainz | |
Badly tested, but eh. | |
usage: | |
aliquot_chainz <n> | |
""" | |
import docopt |
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 numpy | |
from collections import defaultdict | |
from numpy import newaxis | |
def rotate_packed(packed): | |
""" | |
Return a rotated version of a 55-length | |
array packed into 55 bits. Eg. |
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 random | |
import sys | |
from functools import partial | |
from timeit import Timer | |
def values_in_sentinel(keys, dict): | |
sentinel = object() | |
items = (dict.get(k, sentinel) for k in keys) |
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 __future__ import nested_scopes, print_function | |
import bisect | |
import numpy | |
from collections import namedtuple | |
from itertools import combinations | |
Num = namedtuple("Num", ["value", "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
import sys | |
from math import ceil, sqrt | |
import cv2 | |
import mahotas | |
import numpy | |
from scipy.spatial import distance | |
def preprocess(image, diameter, d=8, sigma=15, k=0): | |
raw = image = cv2.resize(image, (diameter, diameter)) |
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
let square x = x * x;; | |
let rec accumulate combiner start n term = | |
if n = 0 then | |
start | |
else | |
let start = combiner (term n) start | |
in accumulate combiner start (n-1) term;; | |
let summation_using_accumulate n term = |