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 math import atan2, sin, cos | |
def normalise_angle(angle: float): | |
""" | |
Summary | |
------- | |
normalise an angle to the range [-pi, pi] | |
Parameters |
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 numpy import float64, inner | |
from numpy.linalg import norm | |
from numpy.typing import NDArray | |
def calculate_1d_cosine_similarity(a: NDArray[float64], b: NDArray[float64]) -> float: | |
""" | |
Summary | |
------- | |
calculate the cosine similarity of two 1D vectors |
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 numpy import ediff1d, concatenate, arctan2, ndarray | |
from numpy.typing import ArrayLike | |
def solve_1st_derivative(x: ArrayLike, y: ArrayLike) -> tuple[ndarray, ndarray]: | |
""" | |
:param x: (ArrayLike) x-coordinates of the 2D line [m] | |
:param y: (ArrayLike) y-coordinates of the 2D line [m] |
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 numpy import arange, array, concatenate, cumsum, ediff1d, float64, hypot | |
from numpy.typing import NDArray | |
from scipy.interpolate import interp1d | |
def linear_interpolation( | |
x: NDArray[float64], | |
y: NDArray[float64], | |
linear_displacement: float | |
) -> tuple[NDArray[float64], NDArray[float64]]: |
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 cv2 as cv | |
from numpy import asarray, ndarray | |
from pyscreeze import screenshot | |
IntVector2 = tuple[int, int] | |
class NoRegionSelected(Exception): | |
"""Raised when the user ends the selection without selecting a region.""" |
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 math import cos, sin | |
from typing import NamedTuple | |
import numpy as np | |
from numpy.typing import NDArray | |
class Vertices(NamedTuple): | |
""" | |
Summary |
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 tweepy | |
from traceback import print_exc | |
from re import sub | |
def oauth_login(consumer_key, consumer_secret): | |
auth = tweepy.OAuthHandler(consumer_key, consumer_secret) | |
auth_url = auth.get_authorization_url() |
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
Windows Registry Editor Version 5.00 | |
[HKEY_CLASSES_ROOT\*\shell\Neovim] | |
@="Edit with Neovim" | |
"Icon"="C:\\tools\\neovim\\Neovim\\bin\\nvim-qt.exe" | |
[HKEY_CLASSES_ROOT\*\shell\Neovim\command] | |
@="wt new-tab PowerShell nvim (Get-Item -LiteralPath %1).FullName" |
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
using System; | |
using System.IO; | |
using System.Linq; | |
using System.Collections.Generic; | |
using UnityEngine; | |
using UnityEngine.InputSystem; | |
// Only supports up to 18,446,744,073,709,551,615 screenshots | |
public class ScreenshotManager : MonoBehaviour { | |
const string DirectoryName = "Screenshots"; |
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
using System; | |
using UnityEngine; | |
// Fades a canvas in when the camera is near. | |
// Fades a canvas out when the camera is too far. | |
[RequireComponent(typeof(CanvasGroup))] | |
public class SoftClipping : MonoBehaviour { | |
const float maxAlpha = 1.0f; | |
const float maxViewDistance = 4.0f; | |
const float fadeInDistance = 2.0f; |
OlderNewer