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
/** | |
* Feel free to take a few minutes to read About Roman Numerals if you're not familiar: | |
* https://en.wikipedia.org/wiki/Roman_numerals | |
*/ | |
public class RomanNumeralConverter { | |
public static int toArabic(String roman) { | |
//TODO : Your implementation here | |
return 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
"""`counters` module - Utility model objects for results tracking.""" | |
from typing import Any | |
from typing import Iterator | |
class Tally: | |
"""`Tally` class: a simple results counter: allows accumulation and addition of results. | |
>>> results = Tally(hits=1, misses=1) | |
>>> print(results) |
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
ls -l | awk '/^-/ && $1=$1' OFS="," >list.csv |
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 argparse | |
from textblob import TextBlob | |
def deboilerplatify(blob): | |
"""PG boilerplates off""" | |
end_of_top_boilerplate = "Produced by Anonymous Volunteers" | |
pos = blob.find(end_of_top_boilerplate) | |
if pos: | |
blob = blob[pos + len(end_of_top_boilerplate):].strip() |
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 keyword | |
>>> keyword.kwlist | |
['False', 'None', 'True', 'and', 'as', 'assert', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'nonlocal', 'not', 'or', 'pass', 'raise', 'return', 'try', 'while', 'with', 'yield'] | |
>>> import builtins | |
>>> dir(builtins) | |
['ArithmeticError', 'AssertionError', 'AttributeError', 'BaseException', 'BlockingIOError', 'BrokenPipeError', 'BufferError', 'BytesWarning', 'ChildProcessError', 'ConnectionAbortedError', 'ConnectionError', 'ConnectionRefusedError', 'ConnectionResetError', 'DeprecationWarning', 'EOFError', 'Ellipsis', 'EnvironmentError', 'Exception', 'False', 'FileExistsError', 'FileNotFoundError', 'FloatingPointError', 'FutureWarning', 'GeneratorExit', 'IOError', 'ImportError', 'ImportWarning', 'IndentationError', 'IndexError', 'InterruptedError', 'IsADirectoryError', 'KeyError', 'KeyboardInterrupt', 'LookupError', 'MemoryError', 'NameError', 'None', 'NotADirectoryError', 'Not |
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
# rotate text in a file, such as banner text | |
# surprised this isn't a library function, for silly text operations | |
import sys | |
import re | |
def create_matrix(height): | |
matr = list() | |
for i in range(0, height): | |
matr.append(list()) |
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
# Add to .bash_profile | |
function gittitle() { | |
echo -n -e "\033]0;`git status | awk 'NR==1 {print $3}'`\007" | |
} | |
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\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
# Some notes on this gist: | |
# all abstract and base class stuff has been moved to the top of the file so that import resolution | |
# and IDEs won't complain unnecessarily. | |
# _get_model_path is default method | |
# tokenize has been promoted to be a default method, and signatures downstream were made consistent with this; | |
# -- whether this is a great idea is open to debate | |
# The default list argument, a subtle bug, has been corrected, e.g. see https://docs.python-guide.org/writing/gotchas/ | |
# the self : object annotation has been removed as it is implied and it confuses IDE. | |
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
spondaic 'at si staret' ait 'caelebs sine palmite truncus, | |
spondaic Aeneae genetrix, vidit quoque triste parari | |
spondaic Has ubi verborum poenas mentisque profanae | |
spondaic Hunc ubi laudatos iactantem in sanguine vultus | |
spondaic Maenala transieram latebris horrenda ferarum | |
spondaic adiectoque cavae supplentur corpore rugae, | |
spondaic admotumque fretum remis tellusque repulsa est, | |
spondaic aversata gemit; certa est exquirere nutrix | |
spondaic bella instructa gerunt, multumque ab utraque cruoris | |
spondaic bellaque non transfert, et sunt, qui parcere Troiae |
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
%matplotlib inline | |
import matplotlib.pyplot as plt | |
import numpy as np | |
dates_infections = {'3/1': 89, | |
'3/2': 105, | |
'3/3': 125, | |
'3/4': 159, | |
'3/5': 227, | |
'3/6': 331, | |
'3/7': 444, |
OlderNewer