Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am bruckhaus on github.
  • I am tilmann (https://keybase.io/tilmann) on keybase.
  • I have a public key whose fingerprint is C8B8 0FB3 FFE3 798D 1E3F 6C5A F531 1B01 A8BB 0331

To claim this, I am signing this object:

@bruckhaus
bruckhaus / Word Count in Flink Scala
Created July 5, 2015 16:12
Word Count in Flink Scala
val userData = sc.sequenceFile[UserID, UserInfo]("HDFS://...")
.partitionedBy(new HashPartitioner(100))
.persist()
def processNewLogs(logFileName: String) {
val events = sc.sequenceFile[UserID, LinkInfo](logFileName)
val joined = userData.join(events)
}
val userData = sc.sequenceFile[UserID, UserInfo]("hdfs://...").persist()
val events = sc.squenceFile[UserID, LinkInfo](logFileName)
val joined = userData.join(events)
class Pandigital:
def __init__(self, digits):
self.p = digits
self.N = len(self.p)
def find(self, n):
for i in range(n - 1):
self.step()
return self.get()
//Create App
rhc app create a myappname -t python-2.6
//Add MongoDB NoSQL Database
rhc app cartridge add -a myappname -c add-mongodb-2.0
//Add Upstream Repo
cd myappname
git remote add upstream -m master git://github.com/openshift/openshift-twt-mongo-demo.git
git pull -s recursive -X theirs upstream master
def in_words(i):
d = NumberLetterCounts.NUMBER_WORDS
words = ''
if i >= 1000:
thousands = i / 1000
i %= 1000
words = d[thousands] + " thousand"
if i > 0:
words += " "
if i >= 100:
[project_euler] time python p025_thousand_digit_fibonacci_number.py 9:08:32 ☁ master ☀
The first term in the Fibonacci sequence to contain 1000 digits is 4782
python p025_thousand_digit_fibonacci_number.py 0.06s user 0.02s system 68% cpu 0.118 total
[project_euler] 9:08:46 ☁ master ☀
__author__ = 'tbruckhaus'
class ThousandDigitFibonacciNumber:
"""
1000-digit Fibonacci number
Problem 25
The Fibonacci sequence is defined by the recurrence relation:
val t1 = new Time(1, 23)
val t2 = new Time(1, 55)
val t3 = new Time(1, 55)
val t4 = new Time(1, 56)
val t5 = new Time(2, 4)
for (pair <- List(t1, t2, t3, t4, t5).combinations(2)) {
pair(0).check(pair(1))
pair(1).check(pair(0))
}