Skip to content

Instantly share code, notes, and snippets.

View p-i-'s full-sized avatar

Pi p-i-

View GitHub Profile
@p-i-
p-i- / diff.diff
Created October 20, 2024 10:13
clither build on macos
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8ed9bc5..ce7842f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -14,7 +14,7 @@ project ("clither"
###############################################################################
include (CMakeDependentOption)
-option (CLITHER_BENCHMARKS "Compile benchmarks (requires C++)" ON)
+option (CLITHER_BENCHMARKS "Compile benchmarks (requires C++)" OFF)
@p-i-
p-i- / CMakeLists.txt
Created October 18, 2024 10:09
WebRTC VAD (c++)
cmake_minimum_required(VERSION 3.10)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED True)
# Set the project name and version
project(webrtcvad VERSION 2.0.14)
# Define the source files (excluding pywebrtcvad.c)
file(GLOB VAD_SOURCES
@p-i-
p-i- / aec.cpp
Created October 13, 2024 01:12
AEC on macOS
// clang++ -o x x.cpp -framework CoreAudio -framework AudioToolbox
#include <iostream>
#include <cmath>
#include <fstream>
#include <AudioToolbox/AudioToolbox.h>
constexpr float kSineFrequency = 440.0f; // 440Hz sinewave
constexpr float kSampleRate = 48000.0f; // Sample rate
@p-i-
p-i- / MainComponent.cpp
Created October 12, 2024 16:36
Broken: kAudioUnitSubType_VoiceProcessingIO / macOS
#include "MainComponent.h"
#include <AudioToolbox/AudioToolbox.h>
#include <CoreAudio/CoreAudio.h>
#include <AudioUnit/AudioUnit.h>
#include <cmath>
// SineWaveGenerator methods
SineWaveGenerator::SineWaveGenerator() : currentAngle(0.0), angleDelta(0.0) {}
void SineWaveGenerator::setFrequency(float frequency, double sampleRate)
(.venv)
pi@πlocal ~/code/2024/kit/kit/Gin master
> git diff
diff --git a/modules/gin_network/network/gin_asyncwebsocket.cpp b/modules/gin_network/network/gin_asyncwebsocket.cpp
index 15be54251e..f3a8f057ac 100644
--- a/modules/gin_network/network/gin_asyncwebsocket.cpp
+++ b/modules/gin_network/network/gin_asyncwebsocket.cpp
@@ -6,8 +6,8 @@
==============================================================================*/
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@p-i-
p-i- / x.ipynb
Created August 8, 2024 12:00
Getting imports from another folder to work in .ipynb in VSCode
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
from io import StringIO
from ruamel.yaml import YAML # pip install ruamel.yaml
def my_string_representer(dumper, data):
# '' generates `my_multiline: |-` and works perfectly
# '\n' generates `my_multiline: |` but load(save(J)) != J due to trailing
FIX = ''
is_multiline = '\n' in data
return dumper.represent_scalar(
'tag:yaml.org,2002:str',
@p-i-
p-i- / 006.yaml
Created July 12, 2024 22:00
ARC Challenge example
train:
- input: |-
🔵 🔴 🟢 ⚫️ ⚫️ ⚫️ ⚫️
🔴 🟢 ⚫️ ⚫️ ⚫️ ⚫️ ⚫️
🟢 ⚫️ ⚫️ ⚫️ ⚫️ ⚫️ ⚫️
⚫️ ⚫️ ⚫️ ⚫️ ⚫️ ⚫️ ⚫️
⚫️ ⚫️ ⚫️ ⚫️ ⚫️ ⚫️ ⚫️
⚫️ ⚫️ ⚫️ ⚫️ ⚫️ ⚫️ ⚫️
⚫️ ⚫️ ⚫️ ⚫️ ⚫️ ⚫️ ⚫️
output: |-