Skip to content

Instantly share code, notes, and snippets.

Yuto Takei yutopio

  • Tokyo
Block or report user

Report or block yutopio

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@yutopio
yutopio / monitor.yaml
Created Nov 23, 2019
Swarm visualizer + cAdvisor + InfluxDB + Grafana stack
View monitor.yaml
# docker stack deploy -c monitor.yaml monitor
# docker exec `docker ps | grep -i influx | awk '{print $1}'` influx -execute 'CREATE DATABASE cadvisor'
version: '3.7'
services:
swarm-visualizer:
image: dockersamples/visualizer
ports:
- "9000:8080"
volumes:
@yutopio
yutopio / Calc.csproj
Created Mar 6, 2018
Simple math calculator
View Calc.csproj
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="packages\Antlr4.CodeGenerator.4.6.4\build\Antlr4.CodeGenerator.props" Condition="Exists('packages\Antlr4.CodeGenerator.4.6.4\build\Antlr4.CodeGenerator.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{EE3E54A6-D9F2-47D9-A017-0E3FCCB12700}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>Calc</RootNamespace>
@yutopio
yutopio / http.cs
Created Mar 3, 2018
Example of simple HTTP client / server by using Socket
View http.cs
using System;
using System.Net;
using System.Net.Sockets;
class Program
{
static void Main(string[] args)
{
var s = new Socket(
AddressFamily.InterNetwork,
@yutopio
yutopio / ProducerConsumer.cs
Created Mar 1, 2018
Producer-Consumer problem implementation
View ProducerConsumer.cs
using System;
using System.Threading;
class Program
{
static int prodIndex = 0;
static int consIndex = 0;
static Semaphore empty, filled;
static string[] buffer;
View rsa.cs
using System;
using System.Collections.Generic;
using System.Linq;
class Program
{
static readonly Random rnd = new Random();
static void Main(string[] args)
{
@yutopio
yutopio / cert.cs
Created Feb 20, 2017
Certificate generation with BouncyCastle C#
View cert.cs
using Org.BouncyCastle.Asn1.Pkcs;
using Org.BouncyCastle.Asn1.Sec;
using Org.BouncyCastle.Asn1.X509;
using Org.BouncyCastle.Asn1.X9;
using Org.BouncyCastle.Crypto;
using Org.BouncyCastle.Crypto.Generators;
using Org.BouncyCastle.Crypto.Operators;
using Org.BouncyCastle.Crypto.Parameters;
using Org.BouncyCastle.Math;
using Org.BouncyCastle.Security;
View string.cs
using System;
using System.Runtime.CompilerServices;
using static System.Console;
// No effect...
//[CompilationRelaxations(CompilationRelaxations.NoStringInterning)]
class Program
{
const string kHello = "HelloWorld";
View Cer.cs
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;
View Volatile.cs
using System;
using System.Threading;
class Program
{
class Flag
{
public bool done;
}
View StreamUtil.cs
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)
{
You can’t perform that action at this time.