Start by initializing the environment
$ docker-compose up broker ksql-cli
Connect to the KSQL CLI:
$ docker-compose exec ksql-cli ksql http://ksql-server:8088
package sort | |
import ( | |
"errors" | |
) | |
func TopologicalSort(g *Graph) ([]int, error) { | |
inDegree := make([]int, g.numOfVertices) | |
for _, l := range g.graph { |
package search | |
func BinarySearch(arr []int, target int) int { | |
start := 0 | |
end := len(arr) - 1 | |
for start <= end { | |
midPos := (start + end) / 2 | |
if target < arr[midPos] { | |
end = midPos - 1 | |
} else if target > arr[midPos] { |
''' | |
Numerical methods for ordinary differential equations are | |
methods used to find numerical approximations to the solutions | |
of ordinary differential equations (ODEs). Their use is also | |
known as "numerical integration", although this term is sometimes | |
taken to mean the computation of integrals. | |
The Runge–Kutta methods are a family of implicit and explicit | |
iterative methods used in temporal discretization for the approximate | |
solutions of ordinary differential equations. |
class Node: | |
def __init__(self, value=None): | |
self.value = value | |
self.next = None | |
def __repr__(self): | |
return "Node(value=%s,next=%s)" % (self.value, self.next) |
from tweepy import OAuthHandler, API | |
from nltk.corpus import stopwords | |
from textblob import TextBlob | |
import re | |
import json | |
class TwitterClient(object): | |
def __init__(self): |
#!/usr/bin/env python | |
class TreeNode: | |
def __init__(self): | |
self.value = None | |
self.left = None | |
self.right = None | |
self.size = 0 |
from random import randint | |
def quick_sort(arr, start, end): | |
if start >= end: | |
return arr | |
pivot_idx = partition(arr, start, end) | |
quick_sort(arr, start, pivot_idx - 1) | |
quick_sort(arr, pivot_idx + 1, end) |
#!/bin/sh | |
# Quick access to the Pod's log based on the name of the app. | |
# Please, note that this script assumes you have a selector | |
# called "app" on your pod. If you want to use a different | |
# selector simply update the script | |
if [[ -z "$1" || -z "$2" ]]; then | |
echo "Please, provide an app name and namespace." | |
echo "Example: ./kubelog.sh name-of-app dev" | |
exit 1 |
/** | |
It's a dummy example about how to synchronize the KafkaConsumer accross threads in scala. | |
"The Kafka consumer is NOT thread-safe. All network I/O happens in the thread of the | |
application making the call. It is the responsibility of the user to ensure that multi-threaded | |
access is properly synchronized. Un-synchronized access will result in ConcurrentModificationException." | |
- https://kafka.apache.org/0100/javadoc/org/apache/kafka/clients/consumer/KafkaConsumer.html#multithreaded | |
*/ |