Skip to content

Instantly share code, notes, and snippets.

View lantos1618's full-sized avatar
🐙
yeet

Lantos lantos1618

🐙
yeet
View GitHub Profile
use criterion::{criterion_group, criterion_main, Criterion};
use kanal::bounded;
use ringbuf::traits::{Consumer, Producer, Split};
use ringbuf::{SharedRb, storage::Heap};
use std::sync::Arc;
use std::thread;
use std::time::Instant;
use parking_lot::Mutex as ParkingMutex;
const NUM_MESSAGES: usize = 1_000_000;
@lantos1618
lantos1618 / test_cpal_audio.rs
Created November 13, 2024 08:15
ringbuff vs kanal
extern crate anyhow;
extern crate cpal;
extern crate ringbuf;
use cpal::traits::{DeviceTrait, HostTrait, StreamTrait};
use ringbuf::{
traits::{Consumer, Producer, Split},
HeapRb,
};
@lantos1618
lantos1618 / test.swift
Created October 24, 2024 13:09
this is not swift
// 2nd proposal
User = {
name: Some<String>,
age: Int = 0 // default value
}
// can be called with User { }
User() User {
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Mortgage Repayment Visualization</title>
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
<script src="https://cdn.tailwindcss.com"></script>
</head>
@lantos1618
lantos1618 / macos_window.c
Created October 3, 2024 15:35
GPT, Claude said it was impossible and should use Obj-C but I found the dynlibs and HEY LOOK YOU CAN DO IT IN C!
#include <stdio.h>
#include <stdlib.h>
#include <dlfcn.h>
#include <objc/runtime.h>
#include <objc/message.h>
// gcc -framework AppKit -framework Foundation window.c -o window
// Define CGFloat
#ifdef __LP64__
LinkedList<T>: {
allocator: Allocator,
Node: {
value: T,
next: Option<Node>,
},
#include <stdio.h>
#include <stdlib.h>
// #include <opus/opus.h>
#include </opt/homebrew/Cellar/opus/1.5.2/include/opus/opus.h> // cbf build path
// brew install opus
// gcc -O3 -o miniaudio_opus_example miniaudio_opus_example.c -I/opt/homebrew/Cellar/opus/1.5.2/include -L/opt/homebrew/Cellar/opus/1.5.2/lib -lm -lpthread -lopus && ./miniaudio_opus_example
#define MINIAUDIO_IMPLEMENTATION
#include "miniaudio.h"
import AVFoundation
import Opus
import SwiftUI
import Starscream
import CoreAudio
import CoreAudioTypes
import AVFoundation
import AudioToolbox
import Foundation
use std::future::Future;
use std::thread::sleep;
use std::time::Duration;
use anyhow::{anyhow, Result};
use opus::{Application, Decoder, Encoder};
use rodio::buffer;
use rodio::cpal;
use rodio::cpal::traits::HostTrait;
use rodio::cpal::traits::StreamTrait;
@lantos1618
lantos1618 / index.html
Created May 7, 2024 08:39
http2_duplexing typescript nodejs
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script>