This file contains hidden or 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
| #!/bin/bash | |
| git clone https://github.com/wurstmeister/kafka-docker.git | |
| cd kafka-docker | |
| # Update KAFKA_ADVERTISED_HOST_NAME inside 'docker-compose.yml', | |
| # For example, set it to 172.17.0.1 | |
| vim docker-compose.yml | |
| docker-compose up -d |
This file contains hidden or 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
| # Basic Syntax | |
| x = 1 | |
| y = "Hello" | |
| BEGIN { | |
| puts "Start the thing" | |
| } | |
| END { | |
| puts "End the thing" |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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 bisect | |
| from heapq import * | |
| class Lists(): | |
| def __init__(self, elem): | |
| self.elem = elem | |
| def append(self, x): |
This file contains hidden or 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
| class Queue(): | |
| def __init__(self): | |
| self.queue = [] | |
| def enqueueCharacter(self, char): | |
| self.queue.insert(0, char) | |
| def dequeueCharacter(self): | |
| return self.queue.pop() |
This file contains hidden or 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
| class Stack(): | |
| def __init__(self): | |
| self.stack = [] | |
| def pushCharacter(self, char): | |
| self.stack.append(char) | |
| def popCharacter(self): | |
| return self.stack.pop() |
This file contains hidden or 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
| from heapq import * | |
| class Heap(): | |
| def __init__(self): | |
| self.heap = [] | |
| def heappush(self, item): | |
| """Push the value item onto the heap, maintaining the heap invariant.""" | |
| heappush(self.heap, item) |
This file contains hidden or 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
| """ | |
| A tuple is similar to a list. The difference between the two is that we cannot change the elements of a tuple once | |
| it is assigned whereas in a list, elements can be changed. | |
| - We generally use tuple for heterogeneous (different) datatypes and list for homogeneous (similar) datatypes. | |
| - Since tuple are immutable, iterating through tuple is faster than with list. So there is a slight performance boost. | |
| - Tuples that contain immutable elements can be used as key for a dictionary. With list, this is not possible. | |
| - If you have data that doesn't change, implementing it as tuple will guarantee that it remains write-protected. | |
| https://www.programiz.com/python-programming/tuple |
This file contains hidden or 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
| class Dicts(): | |
| def __init__(self, elem): | |
| self.elem = elem | |
| def len(self): | |
| return len(self.elem) | |
| def keys(self): | |
| return self.elem.keys() |
This file contains hidden or 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
| """ | |
| Strings are immutable sequence of characters | |
| http://thomas-cokelaer.info/tutorials/python/strings.html | |
| https://docs.python.org/3/library/stdtypes.html#string-methods | |
| """ | |
| class Strings(): | |
| def __init__(self, elem): | |
| self.elem = elem |