Commit Type Emoji Initial Commit 🎉 Party Popper Version Tag 🔖 Bookmark New Feature ✨ Sparkles Bugfix 🐛 Bug Security Fix 🔒 Lock Metadata 📇 Card Index Refactoring ♻️ Black Universal Recycling Symbol Documentation 📚 Books Internationalization 🌐 Globe With Meridians
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 TreeNode: | |
def __init__(self, value, left=None, right=None): | |
self.value = value | |
self.left = left | |
self.right = right | |
def build_a_tree(): | |
root = TreeNode(10) | |
a = TreeNode(20) |
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 TreeNode: | |
def __init__(self, value, left=None, right=None): | |
self.value = value | |
self.left = left | |
self.right = right | |
def build_a_tree(): | |
root = TreeNode(10) | |
a = TreeNode(20) |
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 LNode: | |
"""defining a linked list node""" | |
def __init__(self, value,next=None, random=None): | |
self.value = value | |
self.random = random | |
self.next = next | |
def __str__(self): | |
return "(%s)"%(self.value) |
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 typing import Tuple, List | |
from math import log | |
rates = [ | |
[1, 0.23, 0.25, 16.43, 18.21, 4.94], | |
[4.34, 1, 1.11, 71.40, 79.09, 21.44], | |
[3.93, 0.90, 1, 64.52, 71.48, 19.37], | |
[0.061, 0.014, 0.015, 1, 1.11, 0.30], | |
[0.055, 0.013, 0.014, 0.90, 1, 0.27], |
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 typing import Tuple, List | |
from math import log | |
rates = [ | |
[1, 0.23, 0.26, 17.41], | |
[4.31, 1, 1.14, 75.01], | |
[3.79, 0.88, 1, 65.93], | |
[0.057, 0.013, 0.015, 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
python3 setup.py sdist upload -r pypi |
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 min_hacks(d, p): | |
p_list = list(p) | |
can_swap = True | |
curr_damage, num_of_hacks = (0,)*2 | |
while can_swap: | |
curr_damage, shoot_damage = 0, 1 | |
for c in p_list: | |
if c == 'S': | |
curr_damage += shoot_damage |
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 ldap3 | |
class Ldap: | |
"""Class for LDAP related connections/operations.""" | |
def __init__(self, server_uri, ldap_user, ldap_pass): | |
self.server = ldap3.Server(server_uri, get_info=ldap3.ALL) | |
self.conn = ldap3.Connection(self.server, user=ldap_user, password=ldap_pass, auto_bind=True) | |
def who_am_i(self): |
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 jaydebeapi | |
username = '' | |
password = '' | |
conn = jaydebeapi.connect('com.qubole.jdbc.jdbc41.core.QDriver', | |
'jdbc:qubole://hive/default/db_name?endpoint=https://us.qubole.com', | |
['', password]) | |
if conn: |