Skip to content

Instantly share code, notes, and snippets.

@ehurheap
ehurheap / gist:1e22021f15fdc312cfb8052c4ff51c8d
Created February 11, 2025 18:26
Onsite coding, part 2 (Go)
/*
Now that the initial version is done, it’s time to start extending it.
Product has determined that that our customers want to be able to bucket events together by time.
After filtering the events, we would like you to aggregate events that occur in the same timespan.
For the purposes of this interview our timestamps will be at day granularity and we will always bucket by day.
Types:
type Alert struct {
alertType string
date string
totalValue int64
@rileyhilliard
rileyhilliard / prompt.py
Created February 11, 2025 18:26
Example WebAI LLM Chatbot interaction via python in the terminal
# This module demonstrates that it's possible to leverage WebAI to host an LLM chatbot,
# interacting with it via APIs. The code sends a prompt to the LLM and streams back its response.
# In theory, this approach can be extended to programmatically interact with the LLM,
# while using WebAI to orchestrate running the LLM across a cluster of local hardware.
# Demo: https://i.ibb.co/jkNF488Z/Feb-11-2025-12-17-22.gif
import json
import requests
import time
def get_endpoints():
@Evert87
Evert87 / Kotlin coroutine Timed suspendCoroutineUninterceptedOrReturn
Last active February 11, 2025 18:52
Kotlin coroutine Timed suspendCoroutineUninterceptedOrReturn
import io.micrometer.core.instrument.MeterRegistry
import io.micrometer.core.instrument.Timer
import org.aspectj.lang.ProceedingJoinPoint
import org.aspectj.lang.annotation.Around
import org.aspectj.lang.annotation.Aspect
import org.springframework.stereotype.Component
import kotlin.coroutines.Continuation
import kotlin.coroutines.intrinsics.startCoroutineUninterceptedOrReturn
import kotlin.coroutines.intrinsics.suspendCoroutineUninterceptedOrReturn
@Julians42
Julians42 / confidence_interval_minimum_length.jl
Created February 11, 2025 18:25
Julia minimium length confidence interval for single-peaked univariate distribution with normal and beta examples
using Random
using CairoMakie
using QuadGK
using Distributions
function CI(x, p, ci_size)
"""Computes the minimum length confidence interval for a single-peaked posterior distribution"""
dx = x[2] - x[1]
median_loc = argmax(p)
median = x[median_loc] # compute the mode of the distribution - this point will be in the confidence interval
{
"url": "https://google.com",
"name": "ReferrToEarn",
"iconUrl": "https://files.softicons.com/download/animal-icons/cat-force-icons-by-iconka/ico/cat_upsidedown.ico"
}
@CelsoTJr
CelsoTJr / app.js
Created February 11, 2025 18:25
leitura de tela
if ('speechSynthesis' in window) {
let utterance = new SpeechSynthesisUtterance(texto);
utterance.lang = 'pt-BR';
utterance.rate = 1.2;
window.speechSynthesis.speak(utterance);
} else {
console.log("Web Speech API não suportada neste navegador.");
}
@HugsLibRecordKeeper
HugsLibRecordKeeper / output_log.txt
Created February 11, 2025 18:25
Rimworld output log published using HugsLib
Log uploaded on Wednesday, February 12, 2025, 2:25:09 AM
Loaded mods:
Harmony(brrainz.harmony)[mv:2.3.1.0]: 0Harmony(2.3.3), HarmonyMod(2.3.1)
Core(Ludeon.RimWorld): (no assemblies)
Royalty(Ludeon.RimWorld.Royalty): (no assemblies)
Ideology(Ludeon.RimWorld.Ideology): (no assemblies)
Biotech(Ludeon.RimWorld.Biotech): (no assemblies)
Anomaly(Ludeon.RimWorld.Anomaly): (no assemblies)
HugsLib(UnlimitedHugs.HugsLib)[ov:11.0.4]: 0Harmony(av:2.3.3,fv:1.2.0.1), HugsLib(av:1.0.0,fv:11.0.4)
AAAA(Allowed Area Automatic Adapter)(seekiworksmod.no17): AAAA(3.1.0)
pts1 = np.float32([[56,65],[368,52],[28,387],[389,390]])
pts2 = np.float32([[0,0],[300,0],[0,300],[300,300]])
M = cv2.getPerspectiveTransform(pts1, pts2)
perspective_transformed = cv2.warpPerspective(image, M, (300, 300))
@AlfaBlok
AlfaBlok / liq.md
Created February 11, 2025 18:24
test1

‎‎​

import logging
import time
from contextlib import contextmanager
from collections import defaultdict
import numpy as np
import torch
import matplotlib.pyplot as plt
# --- External libraries ---