Skip to content

Instantly share code, notes, and snippets.

View mntone's full-sized avatar
🏠

monotone mntone

🏠
View GitHub Profile
@mntone
mntone / Matrix.h
Created August 17, 2012 23:26
class 3x3 Matrix for Visual C++ 2012
#pragma once
#include <iostream>
namespace Mntone
{
// 3 次正方行列を扱うクラス
template<typename T>
class Matrix sealed
{
@mntone
mntone / OAuthFilter.cs
Last active December 20, 2015 01:19
AsyncOAuth を無理やり Windows.Net.Http 空間でも使えるように変換をかけて使うもの。Windows 8.1 Preview で UserStream を正常稼働させるのに必要。 なお、以下のコードを実行すればよい: private static HttpClient CreateClient( Account a ) { var baseFilter = new HttpBaseProtocolFilter(); baseFilter.AutomaticDecompression = true; baseFilter.IgnorableServerCertificateErrors.Add( ChainValidationResult.Untrusted );…
using AsyncOAuth;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.Foundation;
using Windows.Web.Http;
using Windows.Web.Http.Headers;
using Windows.Web.Http.Filters;
@mntone
mntone / AnimatedImage.cs
Last active December 20, 2015 14:48
- GIF animation custom control for WPF: When BitmapImage load from Uri, this UI control can animate, however, when from Stream, this UI control "cannot" animate (BitmapImage load only 1 frame). - WPF のための GIF アニメーションカスタムコントロール: BitmapImage で、Uri から読み込んだとき、UI コントロールはアニメーションできます。しかし、Stream から読み込んだとき、アニメーションできません (何故ならば、BitmapImage は 1 フレームしか読み込まない…
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
@mntone
mntone / CheckingPatternTest.cs
Last active December 20, 2015 14:48
型比較からのキャストして情報を扱う速度。 (1) o.GetType() == typeof( Obj ) + var obj = ( Obj )o (2) o is Obj + var obj = ( Obj )o (3) var obj = o as Obj + obj != null ※ .NET Framework 4.5.1 (Windows 8.1, Core i7-2620M, RAM 8 GB (+ 4 GB on SSD)) で実行。(1)<(2)<(3) と時間がかかる。
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
namespace CheckingPatternTest
{
class Program
{

Markdown test

OK pattern

test test2
abc hogehoge
test test2
@mntone
mntone / adts_header.cpp
Last active December 26, 2015 02:19
ADTS header structure (for VC++)
enum aac_id: unsigned
{
ai_mpeg4 = 0,
ai_mpeg2 = 1,
};
enum aac_protection_absent: unsigned
{
apa_protection = 0,
apa_unprotection = 1,
@mntone
mntone / wave_header.cpp
Created October 27, 2013 04:24
wave header
_declspec( align( 1 ) )
class wave_header
{
public:
wave_header( void ):
format_size( 16 ),
format_id( 1 ),
channel( 1 ),
sample_rate( 44100 ),
bits_per_samples( 16 ),
@mntone
mntone / flv_header.cpp
Created October 27, 2013 04:47
flv header
_declspec( align( 1 ) )
class flv_header
{
public:
flv_header( void ):
version( 1 )
{
memcpy( signature, "FLV", 3 );
}
@mntone
mntone / Main.as
Last active December 27, 2015 02:09
Program for checking amf0/amf3 raw byte array.
package
{
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.text.engine.*;
import flash.utils.*;
/**
* ...
@mntone
mntone / amf0_manual.md
Last active January 11, 2019 14:14
Amf0 の日本語マニュアル (簡易版)

Action Message Format ― Amf0

1 序章

1.3 基本ルール

  • U8 = 符号なし8ビットデータ
  • U16 = 符号なし16ビットデータ、ネットワークバイトオーダー (ビッグエンディアン)
  • U32 = 符号なし32ビットデータ、ネットワークバイトオーダー (ビッグエンディアン)
  • DOUBLE = IEEE754 8バイト浮動小数点、ネットワークバイトオーダー (ビッグエンディアン)
  • KB = キロバイト