Skip to content

Instantly share code, notes, and snippets.

View mntone's full-sized avatar
🏠

monotone mntone

🏠
View GitHub Profile
@mntone
mntone / test.py
Created August 21, 2015 23:13
これをforじゃなくてnumpyで書いたらどうなるかわかる人教えて
#!python
import copy
import numpy as np
image = cv2.imread('x.png', cv2.IMREAD_UNCHANGED)
height, width = image.shape[:2]
cimage = np.empty((height, width, 3), dtype = np.uint8)
for h in range(height):
for w in range(width):
@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
{
using System;
using System.Linq;
using System.Reactive.Linq;
using System.Reactive.Subjects;
using System.Threading.Tasks;
namespace RxTest
{
class Program
{
@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
{
// The MIT License (MIT)
// Copyright (c) 2015- mntone
using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Linq;
using System.Threading;

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 ),