Skip to content

Instantly share code, notes, and snippets.

View ankona's full-sized avatar
🏠
Working from home

Christopher McBride ankona

🏠
Working from home
View GitHub Profile
@ankona
ankona / morphing.py
Created February 19, 2021 04:37
updated version of morphing.py for cs6475
"""Morphing one image to another based on specified control points."""
import os
import datetime
import numpy as np
import cv2
# from matplotlib.tri.delaunay import delaunay # for triangulation
# from matplotlib.tri import Triangulation
from scipy.spatial import Delaunay
@ankona
ankona / Userscript.user.js
Last active February 6, 2021 04:38
tampermonkey - allow wider canvas video resize
// ==UserScript==
// @name Canvas Video Resize
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Allow the video to resize as large as browser resizes.
// @author You
// @match https://gatech.instructure.com/courses/*
// @grant none
// ==/UserScript==
@ankona
ankona / traverse_hierarchy_dfs.py
Created February 4, 2021 19:56
Build & traverse a parent-child relationship tree in dfs fashion
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.'),
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 \
@ankona
ankona / cloudSettings
Last active October 23, 2019 15:41
vs code settings sync extension
{"lastUpload":"2019-10-23T15:41:35.293Z","extensionVersion":"v3.4.3"}
@ankona
ankona / btree.py
Last active August 9, 2019 01:58
Binary Tree DFS & BFS
from collections import deque
class Node:
def __init__(self, value, lchild=None, rchild=None):
self.value = value
self.lchild = lchild
self.rchild = rchild
@ankona
ankona / binsearch_nr.py
Created July 20, 2019 03:39
non recursive binary search
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
@ankona
ankona / role_users.sql
Created July 9, 2019 17:09
Get the users granted specific roles from sql server.
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;
@ankona
ankona / radix.py
Last active December 19, 2018 16:55
radix sorter
from pyqueue import PyQueue
def char_at(s, i):
if len(s) - 1 < i:
return " "
return s[i]
class RadixSort:
@ankona
ankona / sort.py
Last active December 18, 2018 22:05
Basic sort comparison
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