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
- Entity is an alias to, at the moment, a size_t. | |
- Signature is an alias to an STL bitset. |
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
# The image you will detect faces in must be named 'test.jpg' and | |
# must reside in the same directory where you placed this script. | |
# | |
# Resulting image, where the detected faces are drawn a white rectangle | |
# over, is saved in the same directory where you placed this script and | |
# has the file name, 'result.jpeg'. | |
from PIL import Image, ImageDraw | |
import face_recognition | |
import time |
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 | |
def main(): | |
roman_numerals = { | |
0: '', 1: 'I', 2: 'II', 3: 'III', 4: 'IV', 5: 'V', | |
6: 'VI', 7: 'VII', 8: 'VIII', 9: 'IX', | |
10: 'X', 20: 'XX', 30: 'XXX', 40: 'XL', 50: 'L', | |
60: 'LX', 70: 'LXX', 80: 'LXXX', 90: 'XC', | |
100: 'C', 200: 'CC', 300: 'CCC', 400: 'CD', 500: 'D', |
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
if (some condition) | |
var x <- Reachable so I should create a binding to this variable x. | |
else <- Assume relatively unreachable. | |
var y <- Unreachable. But I can't be sure if it's reachable (prolly related to Halting Problem?). | |
So, I must create a binding so that the expressions that operate on y will run without an error and | |
to take into account cases that this branch is actually reached. | |
This seems like a waste of memory especially in large codebases. | |
var z <- Same as above with var y. |
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 math | |
def obtain_pq(n): | |
p = 0.1 | |
k = math.ceil(math.sqrt(n)) | |
while not p.is_integer(): | |
p = k - math.sqrt((k ** 2) - n) | |
k += 1 |
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 pair_balance(parentheses): | |
missing_pairs = 0 | |
for parenthesis in parentheses: | |
if parenthesis == '(': | |
missing_pairs += 1 | |
elif parenthesis == ')': | |
if missing_pairs == 0: | |
return False | |
missing_pairs -= 1 |
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 | |
def horizontal_pyramid(current_value, limit): | |
if current_value == limit: | |
return str(current_value) | |
return str(current_value) + horizontal_pyramid(current_value + 1, limit) + str(current_value) | |
print(horizontal_pyramid(1, int(sys.argv[1]))) |
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
+++++ +++++ initialize counter (cell #0) to 10 | |
[ use loop to set cell #1 to 60 | |
> +++++ + add 6 to cell #1 (Capital letters) | |
> +++++ ++++ add 9 to cell #2 (Lowercase letters) | |
> +++ add 2 to cell #3 to represent space | |
> + add 1 to cell #4 to represent a new line | |
<<<< - decrement counter (cell #0) | |
] | |
>>>> . go to cell #4 and print a new line |
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 main(): | |
numberOfBottles = 99 | |
while numberOfBottles != 0: | |
firstVerseLine = getFirstOrLastLine(numberOfBottles) | |
print(firstVerseLine) | |
print(firstVerseLine + ", take one down pass it around.") | |
numberOfBottles = numberOfBottles - 1 |