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
I know rappers make hits rapping bits about bitches but the bitches they're riffing are never that specific | |
You could say I'm prolific | |
and even splitting the difference | |
Loose lips sunk ships all up and down the pacific | |
Remind me your name | |
cuz I musta missed it | |
Everyone is a mystic | |
Everyone is a misfit | |
All I see are you dipshits | |
Tryna get on my shit 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
def conditionalResponse[T]( | |
successStatusCode: StatusCodes.Success = StatusCodes.OK, | |
errorStatusCode: StatusCodes.ServerError = StatusCodes.InternalServerError, | |
condition: T => Boolean, | |
fut: => Future[T])(implicit m: ToEntityMarshaller[T]): Route = { | |
onSuccess(fut) { | |
case result if condition(result) => complete(successStatusCode -> result) | |
case result => complete(errorStatusCode -> result) | |
} | |
} |
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
Generate the following sequence: | |
[1, 11, 21, 1211, 111221, 312211, 13112221 ] | |
Starting with "1", generate a sequence of numbers that describe the previous member of the sequence. | |
In this example, "1" is followed by "11" because there's "one 1". Then, to describe "11", you use "21" because | |
there are "two 1's". The next, 1211, describes "21" because there's "1 2, and 1 1". The next is "1 1, 1 2, 2 2s, and 2 1s" | |
hence "111221", Which leads to "3 1, 2 2, 1 1". | |
def make_sequence(num_to_produce): | |
initial = "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
operators = ['+', '-', '*', '/'] | |
class Expression(): | |
def __init__(self, input_ss): | |
self.input_ss = input_ss | |
def eval(self): | |
for op in operators: | |
if op in ['+', '-']: | |
result = 0 |
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
__author__ = 'gregrice' | |
from functools import reduce | |
from itertools import zip_longest | |
import operator | |
OPS = {"+": operator.add, "-": operator.sub, "*": operator.mul, "/": operator.truediv} | |
def eval_string(calc_string): | |
parsed = calc_string.split(" ") |
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 itertools | |
def flatten(l): | |
if type(l) != list: | |
return l | |
else: | |
return list(itertools.chain(*map(flatten, l))) |
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
# Manage services using Supervisor. Start/stop uses /sbin/service and enable/disable uses chkconfig | |
Puppet::Type.type(:service).provide :supervisor, :parent => :base do | |
desc "Supervisor: A daemontools-like service monitor written in python | |
" | |
commands :supervisord => "/usr/bin/supervisord", | |
:supervisorctl => "/usr/bin/supervisorctl" |