Skip to content

Instantly share code, notes, and snippets.

View VapidLinus's full-sized avatar

Linus Närkling VapidLinus

View GitHub Profile
package net.uniqraft.api;
public final class StringTools {
public static String replaceAll(String text, String replace, String replacement) {
if (replace == replacement)
return text;
String currentText = null;
String newText = text;
do {
using System;
using UnityEngine;
public abstract class BaseBehaviour : MonoBehaviour
{
public T RequireComponent<T>(Action<T> a) where T : Component
{
T component = gameObject.GetComponent<T>();
if (component == null)
{
using UnityEngine.UI;
[RequireComponent(typeof(RectTransform), typeof(LayoutElement))]
[ExecuteInEditMode]
public class LayoutElementFitParent : MonoBehaviour
{
[SerializeField] private float aspectRatio = 1;
[SerializeField] private bool updateMin = false;
[SerializeField] private bool updatePreferred = false;
@VapidLinus
VapidLinus / Welcome.md
Last active August 28, 2021 11:44
You have been logged in
@VapidLinus
VapidLinus / cozy-kagi-theme.css
Last active January 20, 2024 14:14 — forked from jamesjlyons/cozy-kagi-theme.css
A fix for jamesjlyons's cozy theme for Kagi Search. This version respects Kagi's dark mode setting. Be sure to set the default Kagi themes to "Calm Blue" and "Moon Dark" for the themes to apply properly.
:root {
--background-color: var(--sand2);
--color-primary: var(--sand12);
--search-result-title: var(--color-primary);
--search-result-title-hover: var(--color-primary);
--result-item-title-border_hover: var(--color-primary);
--domain-rank-icon-color-normal: var(--sand7);
--search-result-date-bg: var(--sand3);
--search-result-content-text: var(--sand11);
--inline-domain-tag-bg: var(--sand3);
@VapidLinus
VapidLinus / TransmitAudioData.cs
Last active January 28, 2024 11:08
Transcode single-channel PCM audio data to dual-channel and output it to D#+'s voice sink
private static async Task TransmitAudioData(byte[] audioData, VoiceTransmitSink sink)
{
var startInfo = new ProcessStartInfo("ffmpeg")
{
RedirectStandardInput = true,
RedirectStandardOutput = true,
RedirectStandardError = true,
UseShellExecute = false,
Arguments = string.Join(" ", [
"-loglevel panic",