Skip to content

Instantly share code, notes, and snippets.

View zactodd's full-sized avatar
🐢

Zac Todd zactodd

🐢
View GitHub Profile
@zactodd
zactodd / roation_3d.py
Last active March 30, 2021 01:51
3d rotaion numpy
import numpy as np
def rotation_matrix(axis, theta):
axis = np.asarray(axis)
axis = axis / np.sqrt(np.dot(axis, axis))
a = np.cos(theta / 2.0)
b, c, d = -axis * np.sin(theta / 2.0)
aa, bb, cc, dd = a * a, b * b, c * c, d * d
bc, ad, ac, ab, bd, cd = b * c, a * d, a * c, a * b, b * d, c * d
return np.array([[aa + bb - cc - dd, 2 * (bc + ad), 2 * (bd - ac)],
@zactodd
zactodd / enable.ps1
Created December 15, 2020 23:01
enable windows ssh
Get-WindowsCapability -Online | ? Name -like 'OpenSSH*'
# If OpenSSH client or server are not installed run the following
# Install the OpenSSH Client
Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0
# Install the OpenSSH Server
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
Start-Service sshd
@zactodd
zactodd / partitions_with_overlap.py
Created November 29, 2020 11:42
Function for partitioning image into sub images
import numpy as np
from itertools import accumulate, repeat, product
def partitions_with_overlap(image, partition_sizes, partitions_per_dim):
"""
Partition an image with overlap to list of images.
:param image: The image to partition.
:param partition_sizes: The sizes of the partition in each dimension.
:param partitions_per_dim: The number of partition per dimension.