Skip to content

Instantly share code, notes, and snippets.

import cProfile
import random
import cupy
from cupy import cudnn
libcudnn = cudnn.cudnn
N_LAYER = 10
N_TESTCASE = 1000
@bonprosoft
bonprosoft / convert_image.sh
Last active February 26, 2017 09:55
utility script for image converting (wmf/emf to pdf, ImageMagick is required)
#!/bin/bash
# CONFIGURATION
IN_DIR="fig_raw"
OUT_DIR="fig"
TARGET=("wmf" "emf") # NOTE: emf is only available under windows.
BASEDIR=`dirname $0`
BASEDIR=`(cd "${BASEDIR}"; pwd)`
@bonprosoft
bonprosoft / AggressiveInlining.cs
Created January 16, 2017 18:03
AggressiveInliningしたい
using System;
using System.Diagnostics;
using System.Runtime.CompilerServices;
namespace InlineConstant
{
public class BaseClass
{
protected virtual int GetConstValue()
{

Keybase proof

I hereby claim:

  • I am bonprosoft on github.
  • I am bonprosoft (https://keybase.io/bonprosoft) on keybase.
  • I have a public key ASBbRLjzVR5Me9usSUt_2llTR4F3thx66jk3ujFK_v1jKAo

To claim this, I am signing this object:

@bonprosoft
bonprosoft / sample.cs
Created September 20, 2015 13:56
ArraySegment<T>
class Program
{
static void Main(string[] args)
{
var foo = new[] { 0, 1, 2, 3, 4 }.ToArray();
var bar = new ArraySegment<int>(foo, 0, 2);
foo[0] = -1;
Console.WriteLine(ReferenceEquals(foo, bar.Array)); // True
Console.WriteLine(bar.ElementAt(0)); // -1
@bonprosoft
bonprosoft / cspractice.cs
Created September 15, 2015 14:06
Genericsの制約
class Program
{
static void Main(string[] args)
{
var foo = SingletonClass<List<string>>.GetInstance();
foo.Add("bbb");
foo.Add("aaa");
var anotherFoo = SingletonClass<List<string>>.GetInstance();
@bonprosoft
bonprosoft / upload.py
Created August 24, 2015 15:48
特定ディレクトリ以下のファイルをblobにアップロードするスクリプト
from azure.storage import BlobService
import os
import sys
BLOB_ACCOUNT = '[Input account name here]'
BLOB_ACCOUNTKEY = '[Input account key here]'
CONTAINER_NAME = '[Input container name here]'
TARGET_DIR = '[Input local data directory here]'
@bonprosoft
bonprosoft / README.md
Last active October 9, 2017 17:25
TypeScript向けBuild/Watchタスクの定義 (VSCode用 tasks.json )

tasks.json

build

  • -p .でカレントディレクトリ内のtsconfig.jsonを参照し、その情報を元にコンパイル
    • "args": ["file1.ts","file2.ts"] のように指定することで、指定されたファイルのみをコンパイル

watch

  • -wでファイルを監視
  • VSCodeなら[Tasks: Terminate Runnning Tasks]で終了できます

tsconfig.json

@bonprosoft
bonprosoft / fizzbuzzvbcpp.vb
Created December 1, 2012 14:35
FizzBuzz Sample on VBCPP AST
Imports VBCPP
Imports VBCPPPlugin
Imports VBCPPPlugin.Exceptions
Imports VBCPPPlugin.Tables
Imports VBCPPPlugin.AST
Imports VBCPPPlugin.AST.AST_Class
Imports VBCPPPlugin.AST.AST_Enum
Module FizzBuzz
Sub Main()
@bonprosoft
bonprosoft / helloworld2.vb
Created November 27, 2012 15:23
HelloWorld on VBCPP AST(Another)
' ポイントはNewを殆ど使わず、メソッドチェーンで内容を付与していく点です。
' この式では、なるべくカッコは使いたくなかったので、リストなどを作る際、子を作り終わったらDefineで親に戻ります。
' LINQに触れてみて、感動したので、それに影響されたところがあります。
'★長所: (他の式に比べて)なかなか書きやすい!★
'★短所: Defineをしないうちは、別の中間生成物として表される必要が有るため、クラスが結構増える
Dim tree As New VBCPP_Program
tree.AddMethod( _
VBCPP_Method.CreateNew("SampleMethod",System.Reflection.MethodAttributes.Static Or Reflection.MethodAttributes.Public,LangName,Line,FileName) _
.SetBody _