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 typing import Generic, TypeVar, Union, Optional, Dict, Type, Any | |
from enum import Enum | |
from pydantic import BaseModel | |
from fastapi import APIRouter, FastAPI | |
T = TypeVar('T') | |
class ConfigType(str, Enum): | |
app = "ac" |
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 os | |
from typing import Tuple, Dict | |
class TypeConverter(object): | |
def as_boolean(self, value: str) -> object: | |
bool_strings = ['true', 'on', 'yes', 'false', 'off', 'no'] | |
if value.lower() in bool_strings[:len(bool_strings)//2]: | |
return True | |
if value.lower() in bool_strings[len(bool_strings)//2:]: |
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 typing import List | |
from collections.abc import Iterable | |
def generate_fib(start=None, stop=None) -> List[int]: | |
last, value = 0, 1 | |
while True: | |
if stop and value > stop: | |
break | |
if not start or value > start: |
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 is_valid(s: str) -> bool: | |
""" | |
Determine if the special characters in the incoming string are valid parenthetical expressions | |
:param s: | |
:return: | |
""" | |
# ( [ ( ) ] | |
brackets_q = [] | |
spec_lhs, spec_rhs = ['(', '{', '['], [')', '}', ']'] |
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 n_queens_attacks(board_state: str) -> int: | |
max_attack_num = 28 | |
attacks = 0 | |
# count horizontal attacks | |
c = Counter(board_state) | |
overlap = {k: v for k, v in c.items() if v > 1} | |
for k, v in overlap.items(): | |
v_prime = v - 1 |
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
const tokenUrl = 'https://signin.XXX.com/connect/token'; | |
const clientId = '<client-id>'; | |
const clientSecret = '<client-pw>'; | |
const username = 'domain\\<your-uid-here>'; // insert | |
const pw = pm.globals.get("mypw"); | |
const grant_type = 'password'; | |
const scopes = 'openid email profile exprofile roles xxx-api'; | |
const getTokenRequest = { |
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
# Execute using: conda env create -f CS7280.yml | |
name: CS7280 | |
dependencies: | |
- python=3.9.5 | |
- matplotlib=3.3.4 | |
- numpy=1.20.2 | |
- scipy=1.6.2 | |
- networkx=2.5.1 | |
- seaborn=0.11.1 | |
- conda-forge::nb_conda |
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
-- Thanks to: https://blobeater.blog/2019/11/20/execution-plans-in-azure-sql-database/ | |
SELECT top 10 (total_logical_reads/execution_count) as ReadsPerExec, | |
(total_logical_writes/execution_count) as WritesPerExec, | |
(total_physical_reads/execution_count) PhyReadsPerExec, | |
Execution_count, sql_handle, plan_handle, total_worker_time | |
FROM sys.dm_exec_query_stats | |
ORDER BY (total_logical_reads + total_logical_writes) Desc | |
SELECT * FROM sys.dm_exec_query_plan (0x060028007491E823E0C7342EC101000001000000000000000000000000000000000000000000000000000000) |
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
"""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 |
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
// ==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== |