Skip to content

Instantly share code, notes, and snippets.

View dunky11's full-sized avatar
🚀

Tim von Känel dunky11

🚀
View GitHub Profile
@mbsariyildiz
mbsariyildiz / .py
Last active March 8, 2024 20:44
Pairwise Euclidean distance computation of elements in 2 tensors, in TensorFlow.
def pairwise_dist (A, B):
"""
Computes pairwise distances between each elements of A and each elements of B.
Args:
A, [m,d] matrix
B, [n,d] matrix
Returns:
D, [m,n] matrix of pairwise distances
@lxr
lxr / hirschberg.c
Last active January 13, 2023 00:53
Hirschberg's algorithm for global string alignment
/*
* hirschberg.c implements Hirschberg's algorithm for global string
* alignment in C. To test it, compile it with
* `c99 -o hirschberg hirschberg.c` and then run
* `./hirschberg <string1> <string2>`. (hirschberg.c uses
* variable-length arrays, so the 99 standard is necessary.)
*
* Copyright (c) 2015 Lari Rasku. This code is released to the public
* domain, or under CC0 if not applicable.
*/
@mstevenson
mstevenson / ConfigurableJointExtensions.cs
Last active April 30, 2024 08:05
Unity extension methods for computing a ConfigurableJoint.TargetRotation value from a given local or world rotation.
using UnityEngine;
public static class ConfigurableJointExtensions {
/// <summary>
/// Sets a joint's targetRotation to match a given local rotation.
/// The joint transform's local rotation must be cached on Start and passed into this method.
/// </summary>
public static void SetTargetRotationLocal (this ConfigurableJoint joint, Quaternion targetLocalRotation, Quaternion startLocalRotation)
{
if (joint.configuredInWorldSpace) {