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 _1d20(): | |
return random.choice(range(1, 21)) | |
def roll_with_advantage(): | |
return max([_1d20(), _1d20()]) | |
if __name__ == "__main__": | |
score = collections.defaultdict(int) |
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
column -s' ' -n -t datafile.txt | less -S |
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
class Centipede(object): | |
def __init__(self): | |
self.legs = list() | |
self.stomach = list() | |
def __call__(self, val): | |
self.stomach.append(val) | |
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
class Centipede(object): | |
def __init__(self): | |
self.legs = list() | |
self.stomach = list() | |
def __call__(self, val): | |
self.stomach.append(val) | |
def __str__(self): |
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
vim: set expandtab ts=4 sw=4 filetype=python fileencoding=utf8: | |
import re | |
# Data from | |
# http://boe.cuyahogacounty.us/pdf_boe/en-US/ElectionResults2015/May2015/05052015UnoffialResultsbyPrecinctTotal.HTM | |
raw = """ | |
0022 CLEVELAND HEIGHTS -01-A 46 32 0 0 | |
0023 CLEVELAND HEIGHTS -01-B 60 28 0 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
$ netstat -rn | |
Kernel IP routing table | |
Destination Gateway Genmask Flags MSS Window irtt Iface | |
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 wlan0 | |
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 wlan0 | |
192.168.10.0 0.0.0.0 255.255.255.0 U 0 0 0 eth3 |
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
with current_config as | |
( | |
select * | |
from refractometer_config_history | |
where now()::timestamp without time zone <@ effective | |
) | |
select rmsh.sump_id, rr.refractometer_reading, current_config.* | |
from refractometer_readings rr |
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
self.pick_success = function (path_to_video) { | |
self.video_path(path_to_video); | |
}; | |
self.pick_error = function (msg) { | |
navigator.notification.alert(msg); | |
}; | |
self.pick_saved_video = function () { |
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
class A(object): | |
def __init__(self, f, mood): | |
self.f = f | |
self.mood = mood | |
def make_class(self): | |
class C(object): |
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
d1 = dict( | |
user_id=99, | |
display_name='Matt Wilson') | |
d2 = dict( | |
email_address='[email protected]', | |
**d1,) |
NewerOlder