This file contains 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 defaultdict | |
data = [(1, 'parent item', 0, 'chris co.'), | |
(2, 'A. first child of main parent', 1, 'chris co.'), | |
(3, 'B. second child of main parent', 1, 'chris co.'), | |
(4, 'C. third child of main parent', 1, 'chris co.'), | |
(5, 'D. only child of node A', 2, 'chris co.'), | |
(6, 'E. first child of node B', 3, 'chris co.'), | |
(7, 'F. second child of node B', 3, 'chris co.'), | |
(8, 'G. only child of node C', 4, 'chris co.'), |
This file contains 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
cmake -D CMAKE_BUILD_TYPE=RELEASE \ | |
-D CMAKE_INSTALL_PREFIX=/usr/local \ | |
-D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules \ | |
-D PYTHON3_LIBRARY=`python -c 'import subprocess ; import sys ; s = subprocess.check_output("python-config --configdir", shell=True).decode("utf-8").strip() ; (M, m) = sys.version_info[:2] ; print("{}/libpython{}.{}.dylib".format(s, M, m))'` \ | |
-D PYTHON3_INCLUDE_DIR=`python -c 'import distutils.sysconfig as s; print(s.get_python_inc())'` \ | |
-D PYTHON3_EXECUTABLE=$VIRTUAL_ENV/bin/python \ | |
-D BUILD_opencv_python2=OFF \ | |
-D BUILD_opencv_python3=ON \ |
This file contains 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
{"lastUpload":"2019-10-23T15:41:35.293Z","extensionVersion":"v3.4.3"} |
This file contains 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 | |
class Node: | |
def __init__(self, value, lchild=None, rchild=None): | |
self.value = value | |
self.lchild = lchild | |
self.rchild = rchild | |
This file contains 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 binsearch_nr(l, v): | |
m = len(l) // 2 | |
mv = l[m] | |
start, end = 0, len(l) -1 | |
while start <= end: | |
print(f'{start} of {end}. m {m}, mv {mv}') | |
if mv == v: | |
print(f"mv ({mv}) == v ({v})") | |
return True |
This file contains 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
SELECT DP1.name AS DatabaseRoleName, | |
isnull (DP2.name, 'No members') AS DatabaseUserName | |
FROM sys.database_role_members AS DRM | |
RIGHT OUTER JOIN sys.database_principals AS DP1 | |
ON DRM.role_principal_id = DP1.principal_id | |
LEFT OUTER JOIN sys.database_principals AS DP2 | |
ON DRM.member_principal_id = DP2.principal_id | |
WHERE DP1.type = 'R' | |
ORDER BY DP1.name; |
This file contains 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 pyqueue import PyQueue | |
def char_at(s, i): | |
if len(s) - 1 < i: | |
return " " | |
return s[i] | |
class RadixSort: |
This file contains 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 random | |
def select(seq, start): | |
min_index = start | |
for j in range(start + 1, len(seq)): | |
if seq[min_index] > seq[j]: | |
min_index = j |
This file contains 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 random | |
import logging | |
from sys import argv | |
comparisons_done = 0 | |
logging.getLogger().setLevel(logging.DEBUG) | |
def binary_search(list, target): | |
logging.debug(f'list: {list}') |
This file contains 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
kubectl -n <ns> edit deployment <svc-name> |