Skip to content

Instantly share code, notes, and snippets.

View ttsuki's full-sized avatar
🫖
418 I'm a teapot

ttsuki ttsuki

🫖
418 I'm a teapot
View GitHub Profile
@ttsuki
ttsuki / mkv2cue.xslt
Created July 3, 2017 21:19
mkvextract chapters "hogefugapiyo.mkv" | xsltproc mkv2cue.xslt -
<?xml version="1.0" encoding="Shift_JIS"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="text" encoding="Shift_JIS"/>
<xsl:template match="/">
<xsl:text>FILE "alltrack.wav" WAVE&#xA;</xsl:text>
<xsl:apply-templates select="//ChapterAtom" />
</xsl:template>
<xsl:template match="ChapterAtom">
@ttsuki
ttsuki / multilib.sh
Last active August 21, 2023 01:42
Alternative x265/build/msys/multilib.sh (link statically libstdc++)
#!/bin/bash
set -eu
PREFIX=$HOME/x265
MAKEFLAGS=-j16
rm -rf build
mkdir -p build/{10bit,12bit}
cd build
# build 10bit static library.
Function XGXcl1(Int Address, Int _val) { SysEx = $F0, $43,$10,$4C, (Address / 65536 & $7F), (Address / 256 & $7F), (Address & $7F), (_val & $7F), $F7; }
Function XGXclV(Int Address, Int _val) { SysEx = $F0, $43,$10,$4C, (Address / 65536 & $7F), (Address / 256 & $7F), (Address & $7F), (_val / 128 & $7F), (_val & $7F), $F7; }
XGXcl1($00007E, 0); // XG SYSTEM ON
r8
r%1 XGXclV($020100, $0081); // Effect[Reverb] EffectType = HALL 2
r%1 XGXcl1($02010C, $40); // Effect[Reverb] Return = 64
Function XGXcl1(Int Address, Int _val) { SysEx = $F0, $43,$10,$4C, (Address / 65536 & $7F), (Address / 256 & $7F), (Address & $7F), (_val & $7F), $F7; }
Function XGXclV(Int Address, Int _val) { SysEx = $F0, $43,$10,$4C, (Address / 65536 & $7F), (Address / 256 & $7F), (Address & $7F), (_val / 128 & $7F), (_val & $7F), $F7; }
XGXcl1($00007E, 0); // XG SYSTEM ON
r8
Function XGXcl1(Int Address, Int _val) { SysEx = $F0, $43,$10,$4C, (Address / 65536 & $7F), (Address / 256 & $7F), (Address & $7F), (_val & $7F), $F7; }
Function XGXclV(Int Address, Int _val) { SysEx = $F0, $43,$10,$4C, (Address / 65536 & $7F), (Address / 256 & $7F), (Address & $7F), (_val / 128 & $7F), (_val & $7F), $F7; }
r%1 XGXclV($020100, $0081); // Effect[Reverb] EffectType = HALL 2
r%1 XGXcl1($02010C, $20); // Effect[Reverb] Return = 32
@ttsuki
ttsuki / BiQuadIIR.cpp
Last active July 19, 2016 15:29
BiQuadIIRによるLPF
#define _USE_MATH_DEFINES
#include <math.h>
class BiQuadIIR
{
double b0, b1, b2, a1, a2;
double x1, x2, y1, y2;
public:
BiQuadIIR(double b0, double b1, double b2, double a0, double a1, double a2)
: b0(b0 / a0), b1(b1 / a0), b2(b2 / a0), a1(a1 / a0), a2(a2 / a0), x1(0), x2(0), y1(0), y2(0)
@ttsuki
ttsuki / DSakuraMMLCompiler.cs
Last active August 29, 2015 14:27
dSakura.dll http://oto.chu.jp/ を使って MML文字列を→MIDIファイルにコンパイル
using System;
using System.IO;
using System.Runtime.InteropServices;
using System.Text;
using System.Text.RegularExpressions;
namespace DSakura
{
// example code
class Program
@ttsuki
ttsuki / fontname.cpp
Last active January 13, 2021 02:00
.ttf/.otf/.ttc から、PostScript名とフォント名を調べる (Get PostScript name from .ttf;.otf;.ttc file.)
// .ttf/.otf/.ttc から、PostScript名と日本語フォント名を調べる
// Get PostScript name from .ttf;.otf;.ttc file.
// http://www.microsoft.com/typography/otspec/otff.htm
typedef unsigned char u8;
typedef unsigned short u16;
typedef unsigned int u32;
#include <cstdio>
#include <errno.h>
// テキスト音楽「サクラ」 http://oto.chu.jp/ // dSakura.dll Version.2.374
//------------------------------------------------------------------------------
//_楽曲情報
//------------------------------------------------------------------------------
TrackName = {"Another Wing - Deep White - (MU2000EX+PLG150PF)"}
Copyright = {"つーさ http://tu3.jp/"}
MetaText = {"一つずつ積み上げ、昇っていく。高く高く。ただ一つの目的を果たすため。"}
// 高みに至るため自らを奮い立たせる、自己との問答と戦いの歌。
// #105 Wing の姉妹曲として、ある程度音源設定を共有しつつ制作。
@ttsuki
ttsuki / intrusive_tree_base.cpp
Last active August 29, 2015 14:06
CC0 1.0 Universal
// intrusive_tree_base.cpp : Defines the entry point for the console application.
//
#include <stdio.h>
#include <tchar.h>
#include <cassert>
#include "intrusive_tree_base.hpp"
//以下テスト用コード。木構造にしたいノード。
@ttsuki
ttsuki / JpegEncoder.cpp
Last active August 29, 2015 14:05
GdiPlus::JpegEncoder
////////////////////////////////////////////////////////////////
// GdiPlus.dll を使ってJPEG圧縮を行う
// 使用にあたっては、OSにGdiPlus.dll が存在することを確認すること。
// 作成: 2014.08.31
////////////////////////////////////////////////////////////////
#include <Windows.h>
#include <cstdio> // printf
#include <gdiplus.h>
#pragma comment(lib, "gdiplus.lib")