Instantly share code, notes, and snippets.

View UnityAsyncAwaitObservableTest.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
using UniRx.Async;
using UnityEngine.Networking;
using UniRx;
using System.Collections;
View main.go
package main
import "code.google.com/p/go-tour/pic"
func Pic(dx, dy int) [][]uint8 {
pic := make([][]uint8, dy)
for y := range pic {
pic[y] = make([]uint8, dx)
View GenerateRandomId.cs
void Main()
{
// conflict with following length. more than 7 is much stable.
// 5 = 50/100000
// 6 = 5/100000
// 7 = 0/100000
var rnd = new Random(Guid.NewGuid().GetHashCode());
var coupon = new string[100000];
var dup = 0;
for (var j = 0; j < 100; j++)
View Main.cs
void Main()
{
double input = 67000000000;
var result = Sqrt(input);
Console.WriteLine($"try: {result}");
Console.WriteLine($"math: {Math.Sqrt(input)}");
}
// input: 67000000000
// count: 24
View DeconstructValueTuple.cs
void Main()
{
var p = Pair(10).Dump();
// 直接はdeconstructされてないのでダメ
Add(p).Dump();
// 当然 valuetuple でウケルならいいけどそうじゃない
Add2(p).Dump();
Add2(Pair(10)).Dump();
View main.go
package main
import "fmt"
func pair(x int) (int, int) {
return x, x + 1
}
func add(x int, y int) int {
return x + y
View main.go
package main
import (
"fmt"
"math"
)
// Newton-Raphson method
func Sqrt(x float64) (result float64, count int) {
z := 1.0
View custom_share.tf
resource "azurerm_role_definition" "custom_share" {
name = "custom_share"
scope = "${data.azurerm_resource_group.current.id}"
description = "This is a custom role created via Terraform"
permissions {
actions = [
"*",
"*/read",
]
View main.yml
---
- name: modify sources list for azcli
become: yes
apt_repository:
repo: deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ {{ ansible_distribution_release }} main
state: present
filename: azure-cli.list
tags: azcli
View BuildMonoInVisualStudio.bat
git clone https://github.com/mono/mono.git
cd mono
git submodule update --init --recursive
set PATH=C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin;%PATH%
msbuild msvc/mono.sln /p:MONO_TARGET_GC=sgen
msbuild bcl.sln /p:Platform="net_4_x" /restore