Skip to content

Instantly share code, notes, and snippets.

@MayamaTakeshi
MayamaTakeshi / gist:f2e467780f2dce7dfde2
Created September 10, 2014 02:20
lua-resty-http behavior on redirection
# nginx.conf snippet:
location /test_redirection {
content_by_lua '
local http = require "http";
function get_req(httpc, base_uri, path)
local uri = base_uri .. path
ngx.log(ngx.DEBUG, "Requesting ", uri)
local res, err = httpc:request_uri(uri, {method = "GET", ssl_verify=false})
if not res then
error("Failed to request ", uri, " err: ", err)
@MayamaTakeshi
MayamaTakeshi / gist:7fe94e95a0e7d8d5d465
Created September 22, 2014 00:39
Confirmation of correction of http.lua
root@LAB002143-BASIX-FE:tmp# node my_http_server_with_close.js
New connection[object Object]
Server(80) request arrived for /one
Server(80) request arrived for /two
Server(80) request arrived for /three
Server(80) request arrived for /four
New connection[object Object]
Server(8080) request arrived for /FOUR
Server(8080) request arrived for /five
Server(8080) request arrived for /six
@MayamaTakeshi
MayamaTakeshi / gist:a62a2d402b1f8d0089df
Created September 22, 2014 00:40
Confirmation of correction of http.lua keepalive issue
$ node my_http_server_with_close.js
New connection[object Object]
Server(80) request arrived for /one
Server(80) request arrived for /two
Server(80) request arrived for /three
Server(80) request arrived for /four
New connection[object Object]
Server(8080) request arrived for /FOUR
Server(8080) request arrived for /five
Server(8080) request arrived for /six
@MayamaTakeshi
MayamaTakeshi / main.cpp
Created August 11, 2017 06:36
Minimal sample using Chord-Detector-and-Chromagram
// Compile with:
// g++ -DUSE_FFTW src/Chromagram.cpp src/ChordDetector.cpp main.cpp -I src/ -l fftw3
#include "Chromagram.h"
#include "ChordDetector.h"
#include <iostream>
#include <fstream>
@MayamaTakeshi
MayamaTakeshi / total_hours_by_version.py
Last active October 15, 2019 09:55
Get total hours in redmine project version
#!/usr/bin/python
import sys
from redminelib import Redmine
def usage():
app = sys.argv[0]
print """
%s project_name project_version
%s myproj 1.0.0
#!/usr/bin/python
redmine_url = 'YOUR_REDMINE_URL'
redmine_key = 'YOUR_REDMINE_KEY'
import sys
from redminelib import Redmine
from datetime import datetime, timedelta
def usage():
@MayamaTakeshi
MayamaTakeshi / gist:2aeaa8cbd1455e04637aea9bc03c6fae
Last active February 25, 2020 11:00
Plot audio data from wav file
/*
$ sox -V -r 16000 -n -b 32 -c 1 -e float test.wav synth 30 sin 440 vol -10dB
sox: SoX v14.4.2
Input File : '' (null)
Channels : 1
Sample Rate : 16000
Precision : 32-bit
@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.

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 / 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