Skip to content

Instantly share code, notes, and snippets.

using System;
using System.Collections.Generic;
using System.Xml;
namespace XMLSettingTest
{
class Program
{
static void Main(string[] args)
{
@threecourse
threecourse / Calc.g
Last active December 20, 2015 00:49
AddinDSL
grammar Calc;
options{
language=CSharp3;
output=AST;
ASTLabelType=CommonTree;
}
@header {
using System;
# 適切なカレントディレクトリを設定した上で、このスクリプトを実行下さい。
# .NET Frameworkのカレントディレクトリをセット
[IO.Directory]::SetCurrentDirectory((Get-Location).ProviderPath)
# ユーティリティ関数の読み込み
. .\textmanip.ps1
# テスト用フォルダの作成
TestFileCreate "test sample1\1.txt" 1000
@threecourse
threecourse / CSharpCompileRun.ps1
Created December 8, 2013 03:13
PowershellからC#コードをコンパイル・実行するサンプル
# ---------------------------------------------------------------------
# PowershellからC#コードをコンパイル・実行するサンプル
#
# (参考)
# http://codezine.jp/article/detail/5007
#
# (注意点)
# .NET Frameworkの制約上、Add-Typeによる型の追加を再実行するには、Powershellのセッションを切る必要がある。
# そのため、Powershellのプロセスを立ち上げ、その中でコンパイル・実行するようにしている。
# ---------------------------------------------------------------------
# 質問 -----------------------------------------------------------------------------------
#
# ・ Generalized Linear Models for Insurance Dataが無料公開されているとお聞きしたのですが、
# 有料のものしか見つけられませんでした。
# ⇒無くなったらしい。残念。
#
# ・ 関数Cでcontrast matrixというものを指定し、因子の基準を指定できるようなのですが、
#  どうも上手くいかないようで、テキストと異なる係数になりました。
# (Model_EとModel_E2 参照)
# ⇒チーム内メンバーで、Model_EとModel_E2が同じ係数となる人、違う係数となる人がいるようで、
# -*- coding: utf-8 -*-
import pandas
import statsmodels.api as sm
import patsy as patsy
import numpy as np
from os import path
import matplotlib.pyplot as plt
# read csv file ======================================================
workdir = path.dirname( path.abspath( __file__ ) )
@threecourse
threecourse / 00_glm.py
Created April 27, 2014 06:46
pythonGLM20140427
# -*- coding: utf-8 -*-
import pandas
import statsmodels.api as sm
import patsy as patsy
import numpy as np
from os import path
import matplotlib.pyplot as plt
# read csv file ======================================================
workdir = path.dirname( path.abspath( __file__ ) )
set DM2="SG - Domain Member2"
set CIDR="<ローカルPCのIPアドレス>"
:: ==============================================================================
:: Creates Security groups Prior to Adding Rules
:: ==============================================================================
call ec2addgrp %DM2% -d "Active Directory Domain Member2"
:: ==============================================================================
@threecourse
threecourse / Roslyn.cs
Created October 5, 2014 11:22
analyze codes with roslyn
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
namespace MyRoslyn.CSharp
@threecourse
threecourse / Clustering.cs
Created December 28, 2014 14:24
Clustering
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using C5; // http://www.itu.dk/research/c5/
/*
* クラスタリングを行うプログラム
* ロジックは以下記事内のRコードと同様