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 multiprocessing as mp | |
def do_run(i: int, q: mp.Queue): | |
while True: | |
item = q.get() | |
if item is None: # Sentinel. | |
return | |
print(i, item) | |
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
# Apache2 Licensed: https://www.apache.org/licenses/LICENSE-2.0 | |
import struct | |
float2int = lambda f: struct.unpack('i', struct.pack('f', f))[0] | |
float2hex = lambda f: hex(float2int(f)) | |
MASK_23B = (1 << 23) - 1 | |
assert float2hex(1.0) == '0x3f800000' |
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
# git log --format='%ad %H %s' --no-merges --date=short tensorflow/compiler/ | python2.7 ~/changeplot.py | |
import fileinput | |
import matplotlib.pyplot as plt | |
from datetime import date, timedelta | |
START_DATE = date(2017, 1, 1) | |
dates = [(START_DATE, START_DATE + timedelta(days=7))] |
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
struct Cake { | |
static Cake Fail; | |
bool burned(); | |
}; | |
Cake Cake::Fail; | |
struct Ingredients { bool spoiled(); }; | |
struct BatterAndWhatnot {}; |
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
diff --git a/Makefile.in b/Makefile.in | |
index 98c0e13..ed537a4 100644 | |
--- a/Makefile.in | |
+++ b/Makefile.in | |
@@ -151,6 +151,7 @@ dist_tmux_OBJECTS = arguments.$(OBJEXT) attributes.$(OBJEXT) \ | |
cmd-set-buffer.$(OBJEXT) cmd-set-environment.$(OBJEXT) \ | |
cmd-set-option.$(OBJEXT) cmd-show-environment.$(OBJEXT) \ | |
cmd-show-messages.$(OBJEXT) cmd-show-options.$(OBJEXT) \ | |
+ cmd-show-args.$(OBJEXT) \ | |
cmd-source-file.$(OBJEXT) cmd-split-window.$(OBJEXT) \ |
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
use core::task::task; | |
use core::comm::{stream, Port}; | |
enum MyDataType { | |
CoolVariant(int), | |
CoolerVariant(~str) | |
} | |
fn spewer(port: Port<MyDataType>) { | |
loop { |
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
"""Hacky polynomial long division implementation for testing fun. | |
Polynomials in GF(2) have the simple arithmetic properties: | |
all polynomial coefficients are 1 or 0 | |
addition is subtraction is XOR on the polynomial coefficients | |
polynomial powers add under multiplication | |
""" | |
import re |
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
let text_token = scan "1234" 0 in | |
match text_token with | |
| {pos_start=0; pos_end=4; token=Integer 1234} -> print_endline "Pass" | |
| _ -> print_endline "Fail" |
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
Function.prototype.bind = function(thisVal) { | |
var func = this.__orig__ || this; | |
var bound = function() { | |
return func.apply(thisVal, arguments); | |
}; | |
bound.__orig__ = func; | |
return bound; | |
}; |
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 types | |
from collections import namedtuple | |
class Oven: | |
def __init__(self): | |
self.pie = 'apple' | |
def easy_bake(self): |
NewerOlder