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 inspect | |
| import threading | |
| # Some ANSI color codes | |
| COLORS = [ | |
| "\033[97m", # White | |
| "\033[91m", # Red | |
| "\033[92m", # Green | |
| "\033[93m", # Yellow | |
| "\033[94m", # Blue |
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
| # Define color codes | |
| colors = { | |
| 'red': '\033[91m', | |
| 'green': '\033[92m', | |
| 'yellow': '\033[93m', | |
| 'purple': '\033[95m', | |
| 'blue': '\033[34m', | |
| 'orange': '\033[33m', # Orange color | |
| 'reset': '\033[0m' # Reset color to default | |
| } |
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 time | |
| class bcolors: | |
| HEADER = '\033[95m' | |
| OKBLUE = '\033[94m' | |
| OKCYAN = '\033[96m' | |
| OKGREEN = '\033[92m' | |
| WARNING = '\033[93m' | |
| FAIL = '\033[91m' | |
| ENDC = '\033[0m' |
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
| When programming apps for Android, you usually want to test them on real Android devices. | |
| This little gist describes how to do so using Ubuntu 14. | |
| First, you need to download and install the Android development IDE (http://developer.android.com/sdk/index.html) and create an Android project which you want to debug. | |
| Next, you need to setup the debugging mode on your Android device. Starting in Android 4.2 you need to enable the developer options first: 1) Go to settings 2) Go to About Phone 3) Tap the build number 10 times (or more, not sure ;)) and you will get the notification that you enabled it. | |
| Then go to the developer settings and enable the debug mode for your phone. | |
| Now you think you can just plug it into your USB mode? - Nope. |
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
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Toggle Switch with Calibrators</title> | |
| <style> | |
| body { | |
| display: grid; |
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 has_cycle(graph): | |
| visited = set() | |
| recursion_stack = set() | |
| def dfs(node): | |
| visited.add(node) | |
| recursion_stack.add(node) | |
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 queue import Queue | |
| def shortest_path(graph, start_node, end_node): | |
| visited = set() | |
| q = Queue() | |
| # (current_node, path) | |
| q.put((start_node,[start_node])) | |
| while q.qsize(): | |
| curr_node, path = q.get() | |
| print(curr_node, path) |
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 collections import deque | |
| def count_islands(matrix): | |
| if not matrix: | |
| return 0 | |
| visited = set() | |
| islands = 0 | |
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
| int32_t binary_search(const uint8_t * array, const uint32_t length, uint8_t val) | |
| { | |
| uint8_t low = 0; | |
| uint8_t high = length; | |
| do | |
| { | |
| uint8_t index = floor((low + high)/2); | |
| if(val == array[index]) | |
| { |
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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <style> | |
| .eyeball { | |
| width: 80px; | |
| height: 80px; | |
| background-color: white; | |
| border-radius: 50%; | |
| display: flex; |
NewerOlder