Skip to content

Instantly share code, notes, and snippets.

View itn3000's full-sized avatar
🤔
🤔🤔🤔🤔🤔🤔

Yusuke Ito itn3000

🤔
🤔🤔🤔🤔🤔🤔
View GitHub Profile
@itn3000
itn3000 / getsdkdir.proj
Created October 28, 2015 04:37
get windows sdk directory from registry in msbuild test
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Choose>
<!-- I could not find key of v8.1 in HKCU -->
<!-- if you want to support another SDK version,add When directive(Entry at the top will be priority) -->
<!-- for windows sdk 8.1A-->
<When Condition="'$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v8.1A@InstallationFolder)' != ''">
<PropertyGroup>
<MyWindowsSdkDir>$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v8.1A@InstallationFolder)</MyWindowsSdkDir>
</PropertyGroup>
@itn3000
itn3000 / StreamToEnumerableExtension.cs
Created November 18, 2015 02:03
Extension for converting System.IO.Stream to IEnumerable<byte>
using System.IO;
using System.Collections.Generic;
static class StreamToEnumerableExtension
{
public static IEnumerable<byte> AsEnumerable(this Stream stm, int bufferSize = 1024*50, CancellationToken ctoken = default(CancellationToken))
{
var buf = new byte[bufferSize];
do
{
ctoken.ThrowIfCancellationRequested();
@itn3000
itn3000 / AzureFunctionSample.cs
Created April 6, 2016 01:17
extension method in Azure Functions
using System.Net;
using System.Threading.Tasks;
static string MyExtension(this int num)
{
return "my extension";
}
public static async Task<HttpResponseMessage> Run(HttpRequestMessage req, TraceWriter log)
{
@itn3000
itn3000 / NpgsqlBulkInsertTest.cs
Last active April 14, 2016 07:19
Npgsql bulk insert with binary format and typemap
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Npgsql;
using System.Linq.Expressions;
using System.Reflection;
namespace LambdaTest
{
@itn3000
itn3000 / dd_DotNetCoreTools__20160628125951.log
Created June 28, 2016 04:08
Microsoft .NET Core 1.0.0 VS 2015 Tooling Preview 2 error
[1B68:1E84][2016-06-28T12:59:51]i001: Burn v3.10.2.2516, Windows v6.3 (Build 9600: Service Pack 0), path: C:\Users\ito\AppData\Local\Temp\{79E1B3B5-BAC0-46B5-A959-C63F453190AA}\.cr\DotNetCore.1.0.0-VS2015Tools.Preview2.exe
[1B68:1E84][2016-06-28T12:59:51]i000: Initializing numeric variable 'CHECK_SETUP_BLOCKED' to value '1'
[1B68:1E84][2016-06-28T12:59:51]i000: Initializing numeric variable 'SKIP_VSU_CHECK' to value '0'
[1B68:1E84][2016-06-28T12:59:51]i000: Initializing numeric variable 'SKIP_PREPARATION' to value '0'
[1B68:1E84][2016-06-28T12:59:51]i000: Initializing string variable 'BundleNameShort' to value 'Microsoft .NET Core 1.0.0'
[1B68:1E84][2016-06-28T12:59:51]i000: Initializing string variable 'BundleNameSub' to value 'VS 2015 Tooling Preview 2'
[1B68:1E84][2016-06-28T12:59:51]i009: Command Line: '-burn.clean.room=C:\Users\ito\Downloads\DotNetCore.1.0.0-VS2015Tools.Preview2.exe'
[1B68:1E84][2016-06-28T12:59:51]i000: Setting string variable 'WixBundleOriginalSource' to value 'C:\Users\ito\Downloads\D
@itn3000
itn3000 / CsCodeFormatWithRoslyn.cs
Last active July 15, 2016 04:27
cs file code formatting in program
using System;
namespace ConsoleApp4
{
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Text;
using Microsoft.CodeAnalysis.Formatting;
public class Program
{
public static void Main(string[] args)
@itn3000
itn3000 / DictionaryDataReader.cs
Created July 28, 2016 11:48
DataReader for Dictionary<string,object> array
using System;
using System.Collections.Generic;
using System.Linq;
using System.Data;
namespace DataReaderUtilities
{
public class DictionaryDataReader : IDataReader
{
IEnumerable<IDictionary<string, object>> m_Dictionary;
@itn3000
itn3000 / AspNetMvcCore.txt
Last active July 29, 2016 07:14
rough benchmark results of LigtNode. programs are https://github.com/itn3000/LightNode.Benchmark
This is ApacheBench, Version 2.3 <$Revision: 1528965 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Server Software: Kestrel
Server Hostname: localhost
Server Port: 10004
Document Path: /Hello/Echo?name=hoge
Document Length: 12 bytes
Concurrency Level: 10
@itn3000
itn3000 / getfileinfo.ps1
Last active October 5, 2016 07:36
get fileinfo in the current directory recursively using powershell
param([string]$location=$(Get-Location).Path)
$parentDir = Split-Path $location -Parent
ls -recurse $location `
|where-object {$_.DirectoryName -ne "" -and $_.DirectoryName -ne $null} `
|foreach-object{new-object PSObject -prop @{DirectoryName=[regex]::Replace($_.DirectoryName,"$($parentDir.Replace("\","\\"))[\\]*","");FileName=$_.Name;Version=$_.VersionInfo.ProductVersion;FileLength=$_.Length;LastUpdate=$_.LastWriteTime}} `
|select-object DirectoryName,FileName,FileLength,Version,LastUpdate `
|ConvertTo-Csv -notypeinformation
@itn3000
itn3000 / get-winhttpproxy.ps1
Last active January 3, 2021 20:34
get winhttp proxy setting by powershell(using p/invoke)
# based on http://stackoverflow.com/questions/4265427/programmatically-set-proxy-address-port-username-password
$MethodDefinition = @'
using System.Runtime.InteropServices;
public enum AccessType
{
DefaultProxy = 0,
NamedProxy = 3,
NoProxy = 1
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]