Skip to content

Instantly share code, notes, and snippets.

View offby1's full-sized avatar

Eric Hanchrow offby1

View GitHub Profile
cats = input("How many cats do you have?")
dogs = input("How many dogs do you have?")
print("You have %r cats and %r dogs." % (cats, dogs))
print("You have %r pets in total." % (cats + dogs))
def number_to_name(number):
return _number_to_name[number]
def rpsls(player_choice):
# delete the following pass statement and fill in your code below
# print a blank line to separate consecutive games
print ""
# print out the message for the player's choice
import string
class Template(string.Formatter):
def format_field(self, value, spec):
if spec.endswith('h'):
value = str(value) # ultimately, this will call a funtion that will format the value and return as string
spec = spec[:-1] + 's'
return super(Template, self).format_field(value, spec)
f= Template()
(let (found)
(mapatoms (lambda (thing) (when (get thing 'thing-at-point) (setq found (cons (get thing 'thing-at-point) found)))))
found)
(thing-at-point-url-at-point number-at-point #[nil "\301\302!\211\205\303@A\")\207" [boundary-pair bounds-of-thing-at-point email buffer-substring-no-properties] 4])
[app:rackcontrol]
use = egg:RackControl
pyramid.reload_templates = false
pyramid.debug_authorization = false
pyramid.debug_notfound = false
pyramid.debug_routematch = false
pyramid.default_locale_name = en
pyramid.includes = pyramid_exclog
mako.directories = rackcontrol:templates
>>> f = subprocess.check_output(['/bin/bash', '-c', """ awk '{print $1, $2, $3}' < /proc/loadavg"""]).rstrip()
>>> f
'0.00 0.01 0.05'
>>>
batch = []
for line in sys.stdin:
if len(batch) == 100:
do_something_with_batch(batch)
batch = []
batch.append(line)
batch = []
for line in sys.stdin:
if len(batch) == 100:
do_something_with_batch(batch)
batch = []
batch.append(line)
@offby1
offby1 / batch.py
Created May 22, 2015 04:14
batch by 100
batch = []
for line in sys.stdin:
if len(batch) == 100:
do_something_with_batch(batch)
batch = []
batch.append(line)
batch = []
for line in sys.stdin:
if len(batch) == 100:
do_something_with_batch(batch)
batch = []
batch.append(line)