This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Runtime.CompilerServices; | |
using System.Threading; | |
class Program | |
{ | |
static readonly EventWaitHandle wh = new ManualResetEvent(false); | |
static volatile bool beforeSet = false; | |
static volatile bool afterSleep = false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Threading; | |
class Program | |
{ | |
class Flag | |
{ | |
public bool done; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
using System.Threading; | |
using System.Threading.Tasks; | |
public static class StreamUtil | |
{ | |
public static async Task<byte[]> ReadAsync(this Stream stream, | |
int length, CancellationToken cancellationToken) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections.Generic; | |
using System.IO; | |
using System.IO.Compression; | |
public static class ZipUtil | |
{ | |
public static byte[] Compress(this Dictionary<string, byte[]> entries) | |
{ | |
using (var stream = new MemoryStream()) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Diagnostics; | |
using System.Text; | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var rnd = new Random(1); | |
for (var i = 0; i < 5000; i++) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// YTONotificationTest.m | |
// | |
// Created by Yuto Takei on 1/19/14. | |
// Copyright (c) 2014 Yuto Takei. All rights reserved. | |
// | |
#import <UIKit/UIKit.h> | |
@interface AppDelegate : UIResponder <UIApplicationDelegate> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// YTOMultilineTextbox.m | |
// MultilineTextbox | |
// | |
// Created by Yuto Takei on 1/18/14. | |
// Copyright (c) 2014 Yuto Takei. All rights reserved. | |
// | |
@interface YTOMultilineTextbox : UITextView |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
class Program | |
{ | |
static void Main() | |
{ | |
var funcs = new Func<double, double>[8]; | |
funcs[0] = x => Math.Exp(x); | |
funcs[1] = x => Math.Log(x); | |
funcs[2] = x => 1 + x + x * x; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
unsafe class Program | |
{ | |
const int size = 1000000000; | |
static bool[] sieve = null; | |
static void Main() | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
using System.Net; | |
using System.Text; | |
class Program | |
{ | |
static void Main() |