Skip to content

Instantly share code, notes, and snippets.

/**
* Clone value deeply, ignore custom classes, symbols and functions
* @param value
* @return cloneOfValue
*/
export function deepClone<T>(value: T): T {
if (typeof value !== 'object' || !value) {
return value;
}
@mypy-play
mypy-play / main.py
Created February 11, 2025 18:29
Shared via mypy Playground
from __future__ import annotations
from typing import TypeAlias
BaseTy = str | int | float | bool | None
GenericJsonTy: TypeAlias = dict[str, GenericJsonTy] | list[GenericJsonTy] | BaseTy
simple_value: GenericJsonTy = 123
complex_test: GenericJsonTy = {
@HugsLibRecordKeeper
HugsLibRecordKeeper / output_log.txt
Created February 11, 2025 18:28
Rimworld output log published using HugsLib
Log uploaded on Tuesday, February 11, 2025, 7:28:25 PM
Loaded mods:
Harmony(brrainz.harmony)[mv:2.3.1.0]: 0Harmony(2.3.3), HarmonyMod(2.3.1)
Core(Ludeon.RimWorld): (no assemblies)
Level Up!(Krafs.LevelUp): LevelUp(1.0.0)
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)
Damage Indicators [1.5](CaesarV6.DamageIndicators): DamageMotes(1.0.0)
CM Color Coded Mood Bar [1.1+](CrashM.ColorCodedMoodBar.11): 0Harmony(av:2.3.3,fv:2.1.1), 1SettingsHelper(av:1.3.0.36972,fv:1.3.0), CMColoredMoodBar(1.5.4062.1)
Camera+(brrainz.cameraplus)[mv:3.2.0.0]: CameraPlus(3.2.0), CrossPromotion(1.1.2)
Better Pawn Control(VouLT.BetterPawnControl)[ov:2.7.6]: BetterPawnControl(2.7.4)
@sunmeat
sunmeat / Program.cs
Created February 11, 2025 18:28
csv to sql server bulk insert example dapper plus
// dotnet add package Z.Dapper.Plus
// dotnet add package Microsoft.Data.SqlClient
// dotnet add package CsvHelper
using CsvHelper;
using Microsoft.Data.SqlClient;
using Z.Dapper.Plus;
using System.Globalization;
using System.Reflection;
using System.Reflection.Emit;
// Decompiled with JetBrains decompiler
// Type: CameraTech.ANPRInterface
// Assembly: CameraTech.net, Version=1.6.2.0, Culture=neutral, PublicKeyToken=null
// MVID: 0E43DE49-AB6C-4A45-B57B-72C341AA4463
// Assembly location: C:\Users\AG\Desktop\FIVEM Files\CameraTech\CameraTech.net.dll
using CitizenFX.Core;
using CitizenFX.Core.UI;
using System;
using System.Drawing;
@linux-riscv-bot
linux-riscv-bot / checkpatch-WARNING
Created February 11, 2025 18:26
pw932597-p13969349
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
#37:
new file mode 100644
CHECK: Lines should not end with a '('
#77: FILE: arch/riscv/kernel/usercfi.c:36:
+ asm goto(
CHECK: spaces preferred around that '%' (ctx:WxV)
#81: FILE: arch/riscv/kernel/usercfi.c:40:
@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