View notable.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View binary_to_int.py
B = '1101' | |
I = 0 | |
while B != '': | |
I = I * 2 + (ord(B[0]) - ord('0')) | |
B = B[1:] |
View queue_ll.rb
require './node' | |
class QueueLinkedList | |
attr_reader :length | |
def initialize(item) | |
@q = Node.new item | |
@q.next = nil | |
@current = @q |
View stack_ll.rb
require './node' | |
class StackLinkedList | |
attr_reader :length | |
def initialize(item) | |
@first = Node.new(item) | |
@first.next = nil | |
@length = 1 |
View node.rb
class Node | |
attr_accessor :item, :next | |
def initialize(item) | |
@item = item | |
end | |
end |
View queue.rb
class Queue | |
attr_reader :queue, :tail, :head | |
def initialize | |
@head_pos = 0 | |
@tail_pos = 0 | |
@queue = Array.new(1) | |
end |
View stack.rb
class Stack | |
attr_reader :length, :stack | |
def initialize(size=1) | |
@stack = Array.new(size) | |
@length = 0 | |
end | |
def is_empty? |
View storm-kafka-pom.xml
<!-- | |
Bind the maven-assembly-plugin to the package phase | |
this will create a jar file without the storm dependencies | |
suitable for deployment to a cluster. | |
--> | |
<plugin> | |
<artifactId>maven-assembly-plugin</artifactId> | |
<configuration> | |
<descriptorRefs> | |
<descriptorRef>jar-with-dependencies</descriptorRef> |
View python_producer_kaka.py
from kafka import * | |
mykafka = KafkaClient("localhost:9092") | |
producer = SimpleProducer(mykafka) | |
producer.send_messages("test", "mymessage") | |
producer.send_messages("test", "mymessage 2") | |
producer.send_messages("test", "mymessage 3") | |
producer.send_messages("test", "mymessage 4") |
View binary_search.rb
def binary_search x, low = 0, high = -1 | |
#-- Assume that a is already sorted | |
a = [3, 5, 7, 8, 10, 11, 14, 15, 26, 33, 34, 36, 39, 40, 41, 44, 45, 48, 49] | |
high = a.length - 1 if high == -1 | |
midpoint = (high + low) / 2 | |
if low == midpoint |
NewerOlder