Skip to content

Instantly share code, notes, and snippets.

View GOROman's full-sized avatar
👽
Damn I'm looking good.

GOROman GOROman

👽
Damn I'm looking good.
View GitHub Profile
@GOROman
GOROman / main.cpp
Last active February 9, 2025 11:19
M5Cardputer のI2Sで サイン波を鳴らすだけのコード(要電源ON)
// M5 Cardputer モノラルで I2S 再生
#include <Arduino.h>
#include <driver/i2s.h>
#include <math.h>
#define SAMPLE_RATE 44100 // サンプリングレート
#define I2S_PORT I2S_NUM_0
#define TABLE_SIZE 256 // サイン波のルックアップテーブルサイズ
#define I2S_BCK 41 // BCLK ピン
#define I2S_DATA 42 // DATA ピン
@GOROman
GOROman / ModuleLLM-Wifi-Test.cpp
Last active January 18, 2025 07:20
M5 Module LLM で、Wifiに繋いでネットワーク経由で指示を与える例
/*
* SPDX-FileCopyrightText: 2024 M5Stack Technology CO LTD
*
* SPDX-License-Identifier: MIT
*/
#include <Arduino.h>
#include <M5Unified.h>
#include <M5ModuleLLM.h>
#include <WiFi.h>
@GOROman
GOROman / dekamoji.sh
Created January 16, 2025 11:52
iTerm2にデカイ文字を画像で出してみるウル技(テク) 【小結級】
#!/bin/zsh
# フォントとか色々設定
font="/System/Library/Fonts/ヒラギノ角ゴシック W3.ttc"
output_path="/tmp"
pointsize=100
image_size="1024x150"
background_color="black"
fill_color="white"
@GOROman
GOROman / mlx_vlm_test.py
Last active September 10, 2025 06:30
MLX + MLX_VLM + Qwen2-VL-2B-Instruct-4bit で画像をVLMで解説してもらう
# /// script
# requires-python = "==3.12"
# dependencies = ["mlx==0.21.0", "mlx_vlm"]
# ///
import mlx.core as mx
import numpy as np
from mlx_vlm import load, generate
from mlx_vlm.prompt_utils import apply_chat_template
from mlx_vlm.utils import load_config
@GOROman
GOROman / kuso-code.h
Created January 5, 2025 14:01
ESP-IDF で MQTT を使って Adafruit IOとやりとりするクソコード
#pragma once
#include <stdio.h>
#include "esp_system.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "mqtt_client.h"
#define BROKER_HOST "io.adafruit.com"
@GOROman
GOROman / whisper-test.js
Created January 5, 2025 06:43
OpenAI Whisper で WAVファイルから文字起こし
import fs from 'fs';
import OpenAI from 'openai'; // 最新版ではこの形式を使用します
import dotenv from 'dotenv';
// 環境変数を読み込む
dotenv.config();
const openai = new OpenAI({
apiKey: process.env.OPENAI_API_KEY, // API キーを環境変数から取得
});
@GOROman
GOROman / test.js
Created January 5, 2025 05:06
OpenAI Realtime API - node.js で音声のストリーム再生とWAV保存
import { RealtimeClient } from '@openai/realtime-api-beta';
import fs from 'fs';
import wav from 'wav';
import Speaker from 'speaker';
import { PassThrough } from 'stream';
const client = new RealtimeClient({
apiKey: process.env.OPENAI_API_KEY,
model: 'gpt-4o-mini-realtime-preview-2024-12-17', // モデルを指定
@GOROman
GOROman / webrtc.cpp
Last active January 7, 2025 14:50
Using DataChannel in the OpenAI Realtime API Embedded SDK
#ifndef LINUX_BUILD
#include <driver/i2s.h>
#include <opus.h>
#endif
#include <esp_event.h>
#include <esp_log.h>
#include <string.h>
#include "main.h"
@GOROman
GOROman / esp32s3-psram64-qpi-test.cpp
Last active January 2, 2025 03:49
ESP32S3 + esp-idf + ESP PSRAM64H (QPI接続) で読み書きしよう!
// ESP-IDF v5.5.0
// ESP32S3
// SPI PSRAM (ESP-PSRAM64H) is used.
#include <stdio.h>
#include "driver/spi_master.h"
#include "driver/gpio.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_log.h"
@GOROman
GOROman / esp32_psram64h_spi.cpp
Last active January 1, 2025 10:24
ESP32 Arduino で外付けPSRAM(ESP-PSRAM64H)をSPI経由で読み書きする(Arduino)
#include <Arduino.h>
#include <SPI.h>
// ESP-PSRAM64H
// 1:CS Input Chip select signal(Active low)
// 2:SO/SIO[1] I/O Serial output
// 3:--/SIO[2]
// 4:VSS Ground
// 5:SI/SIO[0] I/O Serial input
// 6:CLK Input Clock signa