Skip to content

Instantly share code, notes, and snippets.

View fredriccliver's full-sized avatar
🧭
To the north

Fredric Cliver fredriccliver

🧭
To the north
View GitHub Profile
@fredriccliver
fredriccliver / dtw.py
Created February 29, 2024 10:02
calculate utterance similarity using DTW algorithm.
from scipy.spatial.distance import euclidean
from fastdtw import fastdtw
import numpy as np
def calculate_similarity_percentage(distance, max_distance):
similarity_percentage = (1 - distance / max_distance) * 100
return similarity_percentage
def main():
test_sets = [
// logger.ts
export function logError(message: string, ...optionalParams: any[]): void {
try {
// Get the caller function
const caller = logError.caller?.name || 'anonymous';
// Extract filename from the stack trace
const stack = new Error().stack || '';
const fileMatch = stack.split('\n')[2]?.match(/(?:http:\/\/|https:\/\/|file:\/\/\/).*?\/(.*?)(?:\?|:)/) || [];
/**
*
* Usage
*
* node getRemote.js [target url]
*
*/
// import { readSync } from "to-vfile";
// e.g.
// node index.js https://googe.com
import { readSync } from "to-vfile";
import { toString } from "nlcst-to-string";
import { retext } from "retext";
import retextPos from "retext-pos";
import retextKeywords from "retext-keywords";
import fetch from "node-fetch";
import UIKit
import FirebaseAuth
import Kingfisher
class NextVC: UIViewController {
@IBOutlet var profileImageView: UIImageView!
@IBOutlet var nameLabel: UILabel!
<html>
<head>
<link
href="https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css"
rel="stylesheet"
/>
</head>
<body>
<div class="">
<img
var weatherApiKey = "YOUR API KEY"
var destinationUrl = (cityName) => {
return `http://api.openweathermap.org/data/2.5/weather?q=${cityName}&appid=${weatherApiKey}`
}
fetch(destinationUrl(city))
.then((response) => response.json())
.then((data) => {
console.log(data)
<html>
<head>
<link
href="https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css"
rel="stylesheet"
/>
</head>
<body>
<div class="">
<img
guard let clientID = FirebaseApp.app()?.options.clientID else { return }
// Create Google Sign In configuration object.
let config = GIDConfiguration(clientID: clientID)
// Start the sign in flow!
GIDSignIn.sharedInstance.signIn(with: config, presenting: self) { [unowned self] user, error in
if let error = error {
print(error)
import Foundation
import Glibc
import extratypes // this library contains declarations of types from the task
public func solution(_ T : Tree?) -> Int {
var max = 0
guard let T = T else { return 0 }
T.l?.calculate(&max, 1)
T.r?.calculate(&max, 1)