Skip to content

Instantly share code, notes, and snippets.

@noqisofon
noqisofon / testraise.rb
Created November 24, 2010 06:51
raise テスト。
begin
raise "no input file."
rescue
puts "#{__FILE__}:#{$!.to_s}"
end
@noqisofon
noqisofon / mc2html.rb
Created November 24, 2010 06:57
mc ファイルのメッセージを html 形式の簡単なドキュメントに変換するスクリプト。
#!c:/bin/ruby
# -*- encoding: shift_jis -*-
# file: mc2html.rb
require 'optparse'
opt = OptionParser.new
OPTS = {}
@noqisofon
noqisofon / GainSecurityDescSample.cs
Created November 26, 2010 06:10
セキュリティ記述子のデモ。
using System;
using System.Security;
using System.Security.Permissions;
using System.Security.Principal;
using System.Security.AccessControl;
namespace demo.security.descriptors {
@noqisofon
noqisofon / RemoteObject.cs
Created November 26, 2010 06:53
へにょへにょな C# リモートテスト。
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.Remoting.Lifetime;
namespace halfmoon.transport.ipc {
/// <summary>
@noqisofon
noqisofon / Program.cs
Created November 26, 2010 07:02
CUI 用 C# テンプレ。
using System;
using System.Collections.Generic;
using System.Text;
namespace sample.any {
/// <summary>
///
@noqisofon
noqisofon / gist:716373
Created November 26, 2010 07:08
INI 用 map ユーティリティーな感じ。
/**
* マップコンテナ dictionary に keyname でアクセスした値が "yes" または "y" な
* ら真を返します。
* @since 2010-09-03
* @see map_about_yes_or_not_existsp
*/
inline bool map_about_yesp( std::map<tstring, tstring>& dictionary,
const tstring& keyname
)
{
@noqisofon
noqisofon / Logger.cs
Created November 26, 2010 07:52
ちょー簡単なろがークラス。
using System;
using System.IO;
using System.Text;
namespace halfmoon.util {
/// <summary>
///
@noqisofon
noqisofon / notesplit.rb
Created November 28, 2010 14:02
Opera の ADR 形式のファイルを split する Ruby スクリプト。
#!/bin/ruby
# -*- encoding: shift_jis -*-
# file: notesplit.rb
Encoding.default_external = Encoding::UTF_8
# ユーザー名。
USER_NAME = ENV["USERNAME"]
# ノートが入ってるファイルへのパス。
@noqisofon
noqisofon / asyncReceiverCallback.csnip
Created November 29, 2010 08:42
受信が終了したときに呼び出される感じ。
/// <summary>
/// 受信が終了したときに呼び出されます。
/// </summary>
/// <param name="ar"></param>
private void asyncReceiverCallback(IAsyncResult ar) {
UDPRecord record = (UDPRecord)ar.AsyncState;
byte[] received_bytes = record.client.EndReceive( ar, ref record.endpoint );
record.client.Close();
@noqisofon
noqisofon / gist:721178
Created November 30, 2010 04:58
テーブルが存在するか調べる sqlite 用 SQL クエリ。
select count(*)
from
sqlite_master
where
type = 'table' and
name = ?