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 Data.Function | |
import Data.List | |
import System.Environment | |
data Urinal = Free | Taken deriving (Show, Eq) | |
empty n = take n $ repeat Free | |
place urinals | |
| all (== Free) urinals = Taken : tail urinals |
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
body { | |
background: #fff; | |
color: #000; | |
} | |
#pulls { | |
text-shadow: unset; | |
color: #000; | |
} |
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
#!/usr/bin/env python | |
from datetime import date, timedelta | |
def fridays_12th(): | |
d = date.today() | |
while True: | |
if d.weekday() == 4 and d.day == 12: | |
yield d | |
d += timedelta(days=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
for git_path in $(find `pwd` -name .git); do cd `dirname $git_path`; git config user.email [email protected]; done |
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
:?^$?+1,/^$/-1sort |
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 group_by(source, key_func): | |
acc = {} | |
for item in source: | |
acc.setdefault(key_func(item), []).append(item) | |
return acc | |
if __name__ == '__main__': | |
print group_by([(1, 2), (1, 3), (2, 3), (2, 4)], lambda x: x[0]) | |
print group_by([(1, 2), (1, 3), (2, 3), (2, 4)], lambda x: x[1]) |