Skip to content

Instantly share code, notes, and snippets.

View kekyo's full-sized avatar
📡
I'm looking for a job

Kouji Matsui kekyo

📡
I'm looking for a job
View GitHub Profile
@kekyo
kekyo / HowToCreationTwoDimensionalArrayInCSharpLINQ.cs
Last active May 20, 2018 00:28
How to creation two dimensional array in C#/LINQ.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
namespace ConsoleApplication21
{
static class Program
{
public static T[,] ToTwoDimensionalArray<T>(this IEnumerable<IEnumerable<T>> enumerable)
#include "stdafx.h"
#include <windows.h>
#include <mscoree.h>
#include <cor.h>
int _tmain(int argc, _TCHAR* argv[])
{
IMetaDataDispenser *pMetaDataDispenser;
IMetaDataAssemblyImport *pMetaDataAssemblyImport;
@kekyo
kekyo / fusionlog.reg
Created May 9, 2016 02:14
Enable .NET fusion logging
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Fusion]
"ForceLog"=dword:00000001
"LogFailures"=dword:00000001
"LogResourceBinds"=dword:00000001
"EnableLog"=dword:00000001
"LogPath"="C:\\FusionLog\\"
namespace Microsoft.BuildSettings
// [<assembly: System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.6.1", FrameworkDisplayName=".NET Framework 4.6.1")>]
// [<assembly: System.Diagnostics.Debuggable(System.Diagnostics.DebuggableAttribute.DebuggingModes.Default ||| System.Diagnostics.DebuggableAttribute.DebuggingModes.DisableOptimizations)>]
do ()
@kekyo
kekyo / Program.fs
Created May 22, 2016 13:48
How to extract generic parameter type from runtime class definition. (F#)
open System
open System.Collections.Generic
let iedt = typedefof<IEnumerable<int>>
let traverseInterfaceType (targetType: Type) =
targetType.GetInterfaces()
|> Seq.filter (fun t -> t.IsGenericType && (t.GetGenericTypeDefinition() = iedt))
|> Seq.map (fun t -> t.GetGenericArguments().[0])
[<EntryPoint>]
@kekyo
kekyo / Dump.fs
Last active June 1, 2016 06:40
Dump target instance recursivity in F# (partial code).
// TODO: Discriminated Unions
let (|Null|Primitive|String|Enumerable|Complex|) (target: obj) =
match target with
| null -> Null
| _ ->
let targetType = target.GetType()
match targetType.IsPrimitive || targetType.IsEnum with
| true -> Primitive(targetType)
| false ->
match targetType = typeof<System.String> with
@kekyo
kekyo / visitor.fs
Last active September 6, 2016 07:02
Visitor test (LINQPad)
type HogeArgs = { a:int; b:string }
and Visitor<'T>() =
member val PreHoge = fun (v:Visitor<'T>) (c:'T) (args:HogeArgs) -> v.Hoge v c args with get, set
member val Hoge = fun (v:Visitor<'T>) (c:'T) (args:HogeArgs) -> String.Format("{0},{1}", args.a, args.b) with get, set
let visitor = Visitor<char>()
visitor.Hoge <- fun v c args -> String.Format("{0}-{1}", args.a, args.b)
(visitor.PreHoge visitor 'a' { a=123; b="456" }).Dump()
@kekyo
kekyo / community code of conduct.md
Created November 30, 2016 15:27 — forked from atsushieno/community code of conduct.md
Community Code of Conduct日本語訳

これは https://communitycodeofconduct.com/ の日本語訳です。これ自体は各コミュニティでテンプレートとして使用することが期待されるものですが、特定のコミュニティを対象とする(つまり具体的な名宛人がいる)ものではありません。


コミュニティ行動規範

このコミュニティの全メンバーが、以下の行動規範に従う必要があります。このコミュニティの全メンバーが、いかなるイベントにおいても、オーガナイザーによる協力のもと、この行動規範を遵守することが求められています。私たちは、このコミュニティの全ての参加者が、誰にとっても安全な環境を保障するために、協力し合うことを期待しています。

助けが必要ですか?

@kekyo
kekyo / YM3012.v
Created February 14, 2017 01:53
YM3012 --> I2S converter by Verilog: Imported from http://www.geocities.jp/team_zero_three/YM2151/
/*---------------------------------------------------------------------------------------
[YM3012]
Implements a YM3012 --> uPD6376 data format converter.
2011/7/22 Ki
---------------------------------------------------------------------------------------*/
module YM3012(
i_CLOCK,
@kekyo
kekyo / option.fs
Created July 3, 2017 23:51
F# option computation expression
[<Struct>]
type OptionalBuilder =
member __.Bind(opt, binder) =
match opt with
| Some value -> binder value
| None -> None
member __.Return(value) =
Some value
let optional = OptionalBuilder()