I hereby claim:
- I am psobot on github.
- I am psobot (https://keybase.io/psobot) on keybase.
- I have a public key whose fingerprint is B8C4 380D 42A7 C58C 9528 93AD 66BD 052C A0BF 6065
To claim this, I am signing this object:
// NSDate doesn't include overrides for standard comparison operators in Swift. | |
// This extension adds <, >, <=, >=, and ==, using NSDate's built-in `compare` method. | |
// MIT licensed. | |
func <=(lhs: NSDate, rhs: NSDate) -> Bool { | |
let res = lhs.compare(rhs) | |
return res == .OrderedAscending || res == .OrderedSame | |
} | |
func >=(lhs: NSDate, rhs: NSDate) -> Bool { | |
let res = lhs.compare(rhs) |
import os | |
import sys | |
import time | |
import atomac | |
import subprocess | |
if len(sys.argv) < 2: | |
print "Usage: bouncer.py <path_to_logic_project> (<path_to_logic_project>)" | |
os.exit(1) |
{ | |
"+1": [[63.004759, -99.392855], "Canada"], | |
"+1242": [[26.215829, -98.187851], "Bahamas"], | |
"+1246": [[13.186666, -59.55727], "Barbados"], | |
"+1264": [[18.217056, -63.050923], "Anguilla"], | |
"+1268": [[17.08682, -61.796431], "Antigua and Barbuda"], | |
"+1284": [[18.719042, -64.326495], "British Virgin Islands"], | |
"+1340": [[33.282206, -117.185162], "US Virgin Islands"], | |
"+1345": [[19.323764, -81.195721], "Cayman Islands"], | |
"+1441": [[32.301277, -64.77506], "Bermuda"], |
I hereby claim:
To claim this, I am signing this object:
.PHONY: run | |
run: test | |
./$< | |
test: test.o runtime.o | |
gcc -arch i386 $^ -o $@ | |
%.o: %.asm | |
nasm -f macho $< -o $@ |
import sys | |
import re | |
output = sys.stdin.readlines() | |
r = re.compile(r'write\(2, "(.+?)", \d+\)\s+= \d+') | |
print "".join([x.replace(r'\n', "\n").replace(r'\t', "\t") for x in sum([r.findall(o) for o in output], [])]) |
-- Let's say you've got a Redis list that's composed of JSON values: | |
-- -- {"a": 5.2, "b": "something blah blah"} | |
-- -- {"a": 4.3, "b": "something blah blah"} | |
-- -- {"a": 125.2, "b": "something blah blah"} | |
-- And let's say that you want to increment all of the "a" fields by n. | |
-- Call the below script with: | |
-- -- KEYS = [key_of_list_to_update] | |
-- -- ARGV = [json_key_to_incr, value_to_add] | |
local num = redis.call('llen', KEYS[1]) |
import atexit | |
import ctypes | |
import inspect | |
import threading | |
""" | |
Any instances of TerminatableThread that are running when the program exits | |
(due to normal interpreter shutdown, KeyboardInterrupt, SystemExit, etc.) | |
will have SystemExit raised within their next 100 Python bytecode executions, | |
allowing them to possibly catch the SystemExit and clean up as necessary. |
class MyClass(object): | |
def __init__(self): | |
self.foo = "I'm the correct variable!" | |
def do_something(self): | |
# Whoops, I forgot to write this as "self.foo". | |
print foo | |
if __name__ == "__main__": | |
foo = "Herp derp, I'm the wrong variable." |