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 node:carbon | |
| WORKDIR /usr/src/app | |
| COPY package*.json ./ | |
| RUN npm install | |
| COPY . . | |
| EXPOSE 8080 | |
| CMD ["npm", "start"] |
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
| package main | |
| import ( | |
| "fmt" | |
| "sync" | |
| "time" | |
| ) | |
| func firstFunc(c1 chan string) { | |
| for { |
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
| package main | |
| import ( | |
| "fmt" | |
| "time" | |
| ) | |
| func main() { | |
| defer fmt.Println("I print 4th") | |
| defer fmt.Println("I print 3rd") |
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
| package main | |
| import ( | |
| "fmt" | |
| "sync" | |
| "time" | |
| ) | |
| func gobOne(wg *sync.WaitGroup) { | |
| time.Sleep(time.Second * 1) |
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
| package main | |
| import ( | |
| "fmt" | |
| "time" | |
| ) | |
| func gobOne() { | |
| fmt.Println("I never print") | |
| time.Sleep(time.Second * 2) |
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 ubuntu:latest | |
| RUN apt-get update | |
| RUN apt-get install -y python python-pip wget | |
| RUN pip install Flask | |
| ADD hello.py /home/hello.py | |
| WORKDIR /home |
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.storage = []; | |
| self.storage_limit = 100; | |
| def push(self, item): | |
| if len(self.storage) > self.storage_limit: | |
| raise Exception("Stack overflow") | |
| else: | |
| return self.storage.append(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
| class Queue: | |
| def __init__(self): | |
| self.storage = [1,2,3,4,5,6,7] | |
| def enqueue(self, item): | |
| return self.storage.insert(0, item) | |
| def dequeue(self): | |
| return self.storage.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
| def binary_search(search_list, val): | |
| low = 0 | |
| high = len(search_list) - 1 | |
| while low <= high: | |
| mid = int(low + ((high - low)/2)) | |
| if val == search_list[mid]: | |
| return mid | |
| if val < search_list[mid]: |
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
| def binary_search_recursion(sorted_list, key, low, high): | |
| if low > high: | |
| return -1 | |
| mid = int(low + ((high - low)/2)) | |
| if sorted_list[mid] == key: | |
| return mid | |
| elif (key < sorted_list[mid]): | |
| return binary_search_recursion(sorted_list, key, low, mid - 1) |
NewerOlder