Skip to content

Instantly share code, notes, and snippets.

View 0V's full-sized avatar
🛌
Always sleeping

G2 0V

🛌
Always sleeping
View GitHub Profile
@0V
0V / EnumTest.cs
Last active August 29, 2015 14:12
enum の挙動ちょっと怖い
using System;
public class Test
{
enum T{
A,
B,
C = A,
D,
E,
}
namespace Util
{
public class FileUtility
{
/// <summary>
/// ファイル名として使用可能な形にする。
/// </summary>
/// <param name="name">元のファイル名</param>
public static string ValidFileName(string name)
{
@0V
0V / app.config
Last active August 29, 2015 14:11
Log4net.Async 用設定ファイル例
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="log4net" type=" log4net.Config.Log4NetConfigurationSectionHandler,log4net" />
</configSections>
<log4net>
<!-- <appender name="rollingLogFileAppender" type="log4net.Appender.RollingFileAppender"> -->
<appender name="rollingLogFileAppender" type="Log4Net.Async.AsyncRollingFileAppender,Log4Net.Async">
@0V
0V / wallis_formula.rb
Last active August 29, 2015 14:11
Wallis' Formula by Ruby
module MathUtil
#
# Wallis の公式によって円周率を求めます。
#
# [count]
# 計算回数を指定します。
#
# 使用例
# print(MathUtil.wallis_formula(10000000))
# >> 3.1415925750808533
@echo off
set /P waittime="Log off: Input wait time [sec]> %waittime%"
set /A mintime=waittime/60
echo Log off : %mintime% [min] (%waittime% [sec])
timeout /t %waittime%
shutdown /l
@0V
0V / run_length_encode.cpp
Created September 30, 2014 14:43
再帰呼び出しの練習:RLE
#include<iostream>
using namespace std;
const int LENGTH = 200;
int char_count[LENGTH];
void set_str(char *dst, int n){
if (n == LENGTH){
return;
}
@0V
0V / ChitokuChin.cs
Last active August 29, 2015 14:06
ちとくちんち~~~~ん
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
namespace Util
{
public class ChitokuChin
{
@0V
0V / wallis_formula.m
Last active August 29, 2015 14:06
Wallis' Formula by Matlab
# count = 計算回数
# precision = 精度
function y = wallis_formula(count,precision)
output_precision(precision)
i = 1
a = 1
while(i<=count)
num = 4*(i^2)
a = a * num/(num-1)
i++
@0V
0V / WallisFormula.cs
Last active August 29, 2015 14:06
Wallis' Formula by C#
namespace MathUtil
{
/// <summary>
/// Wallis の公式
/// </summary>
public class WallisFormula
{
/// <summary>
/// 計算を実行する
/// </summary>
using MySql.Data.MySqlClient;
using System;
using System.Data;
namespace ConnectMysqlSample
{
class Program
{
static void Main(string[] args)
{