Skip to content

Instantly share code, notes, and snippets.

View itn3000's full-sized avatar
๐Ÿค”
๐Ÿค”๐Ÿค”๐Ÿค”๐Ÿค”๐Ÿค”๐Ÿค”

Yusuke Ito itn3000

๐Ÿค”
๐Ÿค”๐Ÿค”๐Ÿค”๐Ÿค”๐Ÿค”๐Ÿค”
View GitHub Profile
@itn3000
itn3000 / copy_slice_test.rs
Created May 31, 2017 02:59
copy slice test(compilation failed on stable but successed on nightly)
fn main() {
let mut x = [0u8;16];
x[0..3].copy_from_slice(&x[4..8])
}
@itn3000
itn3000 / LiteDbAsyncWrapper.cs
Last active April 23, 2018 14:58
litedb async wrapper
using System;
namespace litedbtest
{
using LiteDB;
using BenchmarkDotNet;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
using System.IO;
using System.Threading;
@itn3000
itn3000 / waitmultipletask.rs
Last active June 15, 2017 08:28
rust future wait multiple task
extern crate tokio_core;
extern crate tokio_io;
extern crate futures;
extern crate futures_cpupool;
#[allow(dead_code)]
pub fn future_test() {
let pool = futures_cpupool::CpuPool::new_num_cpus();
let mut core = tokio_core::reactor::Core::new().unwrap();
// all future must be same type
@itn3000
itn3000 / parse_url.rs
Created June 16, 2017 00:02
url parser test
extern crate url;
extern crate hyper;
use std::str::FromStr;
use hyper::Uri as HyperUri;
#[allow(dead_code)]
fn hyper_test() {
let parsed = HyperUri::from_str("/abc/def?a=b").unwrap();
@itn3000
itn3000 / dicomparison.cs
Last active July 7, 2017 15:40
C# DI comparison(transient and singleton)
using System;
namespace dicomparison
{
using Unity;
using AfContainerBuilder = Autofac.ContainerBuilder;
using Autofac;
using BenchmarkDotNet;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
@itn3000
itn3000 / result.md
Last active July 4, 2017 08:02
System.Reactive vs Reactive4.NET micro benchmark
BenchmarkDotNet=v0.10.8, OS=Windows 8.1 (6.3.9600)
Processor=Intel Core i7-4770 CPU 3.40GHz (Haswell), ProcessorCount=8
Frequency=3312643 Hz, Resolution=301.8738 ns, Timer=TSC
dotnet cli version=2.0.0-preview2-006497
  [Host]     : .NET Core 4.6.00001.0, 64bit RyuJIT
  DefaultJob : .NET Core 4.6.00001.0, 64bit RyuJIT
using System;
namespace recyclablestreamtest
{
using Microsoft.IO;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
using System.IO;
public class RecyclableStreamBenchmark
{
@itn3000
itn3000 / pipelinetest.cs
Last active March 23, 2018 21:12
System.IO.Pipelines tests
using System;
using System.Collections;
using System.Collections.Generic;
struct TestEnumerator<T> : IEnumerator<T>
{
ArraySegment<T> m_Segment;
public TestEnumerator(ref ArraySegment<T> seg)
{
m_Segment = seg;
}
@itn3000
itn3000 / randomgen.ps1
Last active July 28, 2017 06:27
random data file generator for powershell
# Howto(powershell): & .\randomgen.ps1 -FilePath [็”Ÿๆˆใ—ใŸใ„ใƒ•ใ‚กใ‚คใƒซใธใฎใƒ‘ใ‚น] -FileSize [็”Ÿๆˆใ—ใŸใ„ใƒ•ใ‚กใ‚คใƒซใ‚ตใ‚คใ‚บ]
# Howto(cmd): powershell .\randomgen.ps1 -FilePath [็”Ÿๆˆใ—ใŸใ„ใƒ•ใ‚กใ‚คใƒซใธใฎใƒ‘ใ‚น] -FileSize [็”Ÿๆˆใ—ใŸใ„ใƒ•ใ‚กใ‚คใƒซใ‚ตใ‚คใ‚บ]
param (
[string]$FilePath,
[int]$FileSize
)
$rnd = [System.Security.Cryptography.RNGCryptoServiceProvider]::Create()
@itn3000
itn3000 / vectortest.cs
Last active August 2, 2017 05:15
compare byte array with System.Numerics.Vector<T>
using System;
namespace vectortest
{
using System.Numerics;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
using System.Collections.Generic;
using System.Linq;
static class Util