Skip to content

Instantly share code, notes, and snippets.

@MayamaTakeshi
MayamaTakeshi / gist:18ae4403d914af13b8aa9a07bc780591
Created February 21, 2024 00:14
Building micro-config-drive on Debian 8 (Jessie)
apt install libglib2.0-dev
apt install git
apt install autogen
apt install build-essential
apt install autoconf
apt install libyaml-dev
apt install libjson-glib-1.0
apt install libjson-glib-dev
apt install libparted-dev
apt install check
@MayamaTakeshi
MayamaTakeshi / clipboard_speak.py
Created November 26, 2023 07:08
Speak japanese text copied to clipboard
import time
import pyperclip
import pyopenjtalk
import numpy as np
import sounddevice as sd
# Get initial clipboard content
previous_content = ""
@MayamaTakeshi
MayamaTakeshi / run_scheduled_jobs.sh
Created February 17, 2023 23:27
A bash script to run scheduled jobs
#!/bin/bash
#set -o errexit # must be disabled
set -o nounset
#set -o pipefail # must be disabled
usage() {
cat <<EOF
This script permits to execute jobs specified in a text file. Each line should contain a complete command to be executed.
@MayamaTakeshi
MayamaTakeshi / gist:6da8557da56650787c631294e26df5ff
Created December 25, 2022 03:06
Javascript module to detect DTMF using streams (written by ChatGPT)
const { Transform } = require('stream');
const LOW_FREQUENCIES = [697, 770, 852, 941, 1209, 1336, 1477, 1633];
const HIGH_FREQUENCIES = [1209, 1336, 1477, 1633, 1633, 1633, 1633, 1633];
const TONES = ['1', '2', '3', 'A', '4', '5', '6', 'B', '7', '8', '9', 'C', '*', '0', '#', 'D'];
class DtmfDetector extends Transform {
constructor() {
super({ objectMode: true });
this.samples = [];
@MayamaTakeshi
MayamaTakeshi / gist:282d7fefed0dcab5b3938bf0f3f3b079
Created December 25, 2022 02:19
Gstreamer DTMF detection plugin in vala written by ChatGPT
using Gst;
using GLib;
public class DtmfDetector : Element {
private static const int SAMPLE_RATE = 8000;
private static const int CHUNK_SIZE = 256;
private static const int LOW_FREQUENCIES = [697, 770, 852, 941];
private static const int HIGH_FREQUENCIES = [1209, 1336, 1477, 1633];
private Gst.Pad sinkpad;
@MayamaTakeshi
MayamaTakeshi / mc.js
Created March 20, 2022 23:17
sip.js memory issue
var sip = require('sip');
var util = require('util');
var os = require('os');
const uuid = require('uuid')
if(process.argv < 3 || !sip.parseUri(process.argv[2])) {
console.error('usage node make_call.js _uri_');
process.exit(1);
}
@MayamaTakeshi
MayamaTakeshi / gist:68e44eb169dd961a48b84cd817939208
Created January 14, 2022 07:06
Element insertion with conditional auto scroll
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script>
window.onload = function() {
console.log('onload')
var parent = document.getElementById("parent")
var bottom = true
@MayamaTakeshi
MayamaTakeshi / gist:64c2893dfbddb8729fcbe70b9a0b2e74
Created December 5, 2021 06:32
Building and installing yate on ubuntu 20.04
sudo apt install build-essential
sudo add-apt-repository ppa:rock-core/qt4
sudo apt update
sudo apt install qt4-dev-tools
mkdir yate
cd yate
svn checkout http://voip.null.ro/svn/yate/trunk
cd trunk
const Speaker = require('speaker')
var Mic = require('node-microphone')
speaker = new Speaker({
audioFormat: 1,
endianness: 'LE',
channels: 1,
sampleRate: 8000,
blockAlign: 2,
bitDepth: 16,
@MayamaTakeshi
MayamaTakeshi / spec.md
Created February 6, 2021 05:20 — forked from ePirat/spec.md
Icecast Protocol specification

Icecast protocol specification

What is the Icecast protocol?

When speaking of the Icecast protocol here, actually it's just the HTTP protocol, and this document will explain further how source clients need to send data to Icecast.

HTTP PUT based protocol

Since Icecast version 2.4.0 there is support for the standard HTTP PUT method. The mountpoint to which to send the data is specified by the URL path.