Skip to content

Instantly share code, notes, and snippets.

View offby1's full-sized avatar

Eric Hanchrow offby1

View GitHub Profile
-*- mode: compilation; default-directory: "~/git-repositories/work/ine-rackcontrol/rackcontrol/" -*-
Compilation started at Tue Jul 21 15:36:15
./clear_line.py --rack-name=c3rack25 --track=c3
[2015-07-21T15:36:15-0700.989 95733]: INFO [root][clear_line] (erichanchrow) I was invoked as './clear_line.py' '--rack-name=c3rack25' '--track=c3'
[2015-07-21T15:36:15-0700.989 95733]: INFO [root][clear_line] my parent's PID is 42607 (?? [Errno 2] No such file or directory: '/proc/42607/cmdline' ??)
[2015-07-21T15:36:15-0700.989 95733]: INFO [__main__][clear_line] You passed access_server_ip_address
[2015-07-21T15:36:15-0700.989 95733]: INFO [__main__][clear_line] Hello from clear_all_lines_on_rack c3rack25 c3
[2015-07-21T15:36:15-0700.989 95733]: INFO [__main__][clear_line] Track 'c3' is not 'dc', so doing bulk_clear_lines instead of _clear_via_telnet_gateway
[2015-07-21T15:36:16-0700.031 95733]: INFO [__main__][clear_line] <itertools._grouper object at 0x105671990> => (None, u'10.4.204.91'); no alt_ip => I hit
@offby1
offby1 / wat.py
Last active August 29, 2015 14:25
import os
import requests
def POST_in_background(data):
child = os.fork()
if child:
return
requests.post(data)
exit(0)
>>> (False and False) or True
True
>>> False and (False or True)
False
>>> False and False or True
True
>>>
class Cat(object):
def __init__(self):
self.tummy = []
def eat(self, thing):
self.tummy.append(thing)
def hairball(self):
print("I puked up a {}".format(self.tummy.pop()))
import json
l = []
l.append(1)
l.append("cat")
l.append("OK, enough for now")
with open("list.json", 'w') as outf:
json.dump(l, outf)
def returns_a_list():
return [1, 2, 3]
l = returns_a_list()
print(l)
# python wat.py
# [1, 2, 3]
last_status = object()
for index, item in enumerate(sequence_with_three_things):
if index == 2 and last_status == whatever:
continue
last_status = do_some_work()
last_status = object()
for index, item in enumerate(sequence_with_three_things):
if index == 2 and last_status == whatever:
continue
last_status = do_some_work()
(let ((thelist '(test 2)))
(flet ((test (x) (+ x x)))
(eval thelist)))
4
@offby1
offby1 / wat.py
Last active August 29, 2015 14:24
Python 2.7.9 (default, Apr 1 2015, 18:18:03)
[GCC 4.8.2 20140120 (Red Hat 4.8.2-16)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import timeit
>>> timeit.timeit("print(1 + 2)", number=1)
3
1.2159347534179688e-05
>>>