Skip to content

Instantly share code, notes, and snippets.

View takeshik's full-sized avatar

Takeshi KIRIYA takeshik

View GitHub Profile
Lazy<String> desc;
desc = new Lazy<String>(String.IsNullOrEmpty(xc.Element("desc").Value)
? ((Func<String>) (() => WebRequest.Create("http://www.takeshik.org/yacq/codes/" + id + ".desc")
.DownloadStringAsync()
.First()
))
: () => xc.Element("desc").Value
);
desc = String.IsNullOrEmpty(xc.Element("desc").Value)
? new Lazy<String>(() => WebRequest.Create("http://www.takeshik.org/yacq/codes/" + id + ".desc")
return this.Elements.ReduceAll(symbols)
// es = 配列の全要素 (評価済)
.Let(es => es
.Select(e => e.Type)
.Distinct()
// ts = 配列に含まれる全ての型
.Let(ts => ts
.SelectMany(t => t.GetConvertibleTypes())
// 配列の要素の型から導ける全ての基底型、実装インターフェイスの集合を取得し
.Distinct()
@takeshik
takeshik / make.conf
Created September 20, 2011 14:50
/etc/make.conf
# -*- mode: bash; -*-
CHOST="x86_64-pc-linux-gnu"
CFLAGS="-pipe -w -O3 -fomit-frame-pointer -funroll-loops -march=native"
#CFLAGS="-pipe -w -O2 -fomit-frame-pointer -march=native"
CXXFLAGS="${CFLAGS}"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j 4"
@takeshik
takeshik / gist:1145792
Created August 15, 2011 06:23
dmesg on Linux gentoo 3.0.0-gentoo #1 SMP Sat Jul 23 09:52:23 JST 2011 x86_64 AMD Processor model unknown AuthenticAMD GNU/Linux
[135417.474866] kworker/0:1: page allocation failure: order:3, mode:0x4020
[135417.474879] Pid: 0, comm: kworker/0:1 Not tainted 3.0.0-gentoo #1
[135417.474885] Call Trace:
[135417.474891] <IRQ> [<ffffffff810894e0>] ? 0xffffffff810894e0
[135417.474902] [<ffffffff8108ba58>] ? 0xffffffff8108ba58
[135417.474908] [<ffffffff8134227d>] ? 0xffffffff8134227d
[135417.474914] [<ffffffff812359cd>] ? 0xffffffff812359cd
[135417.474920] [<ffffffff8108bb22>] ? 0xffffffff8108bb22
[135417.474926] [<ffffffff812a4c29>] ? 0xffffffff812a4c29
[135417.474931] [<ffffffff812a5d86>] ? 0xffffffff812a5d86
System.InvalidOperationException: 設定システムはまだ初期化されていません。
at Inscribe.Configuration.Setting.get_Instance()
at Inscribe.Communication.ApiHelper.ExecApi[T](Func`1 operate)
at Inscribe.Storage.ListStorage.Receive(String screenName, String listName)
@takeshik
takeshik / dmesg.log
Created July 29, 2011 09:49
dmesg on Linux gentoo 3.0.0-gentoo #1 SMP Sat Jul 23 09:52:23 JST 2011 x86_64 AMD Processor model unknown AuthenticAMD GNU/Linux
[215353.049157] BUG: Bad page state in process smbd pfn:739b7
[215353.049170] page:ffffea000194a008 count:29425818 mapcount:0 mapping: (null) index:0x0
[215353.049176] page flags: 0x9a0000(mappedtodisk|swapbacked|unevictable|0x800000)
[215353.049194] Pid: 23170, comm: smbd Not tainted 3.0.0-gentoo #1
[215353.049199] Call Trace:
[215353.049206] [<ffffffff81089d5a>] ? 0xffffffff81089d5a
[215353.049212] [<ffffffff8108a8b1>] ? 0xffffffff8108a8b1
[215353.049218] [<ffffffff8108ac26>] ? 0xffffffff8108ac26
[215353.049224] [<ffffffff810bd26a>] ? 0xffffffff810bd26a
[215353.049229] [<ffffffff810bd26a>] ? 0xffffffff810bd26a
@takeshik
takeshik / decompiler-battle.cs
Created July 16, 2011 09:54
.NET Reflector vs. ILSpy vs. dotPeek
// Original
public static Expression DispatchMethod(
Expression instance,
IEnumerable<MethodBase> methods,
IList<Type> typeArguments,
IList<Expression> arguments
)
{
return methods
.Select(m => m is MethodInfo && ((MethodInfo) m).IsExtensionMethod()
Yacq クエリ言語の簡単な説明
使用方法
using XSpect.Yacq;
Yacq.Parse("'write code here!'");
// コードを表す何らかの Expression が返る
Yacq.ParseLambda<Func<int, int>>(@"(\ [x:Int32] (+ x 10))");
// Expression<Func<int, int>> が返る
Expression.Lambda(Yacq.Parse("...")); // LambdaExpression
<Extension> _
Public Class Dispatcher
' Methods
Public Shared Function DispatchMethod(ByVal instance As Expression, ByVal methods As IEnumerable(Of MethodInfo), ByVal typeArguments As IList(Of Type), ByVal arguments As IList(Of Expression)) As MethodCallExpression
Return (From t In (From m In methods Select New Candidate(instance, m, Nothing, arguments)).If(Of IEnumerable(Of Candidate))(_ => ((Not typeArguments Is Nothing) AndAlso typeArguments.Any(Of Type)()), DirectCast(s => (From _ In s
Where (_.Method.IsGenericMethodDefinition AndAlso (_.Method.GetGenericArguments.Length = typeArguments.Count))
Select _.Method.MakeGenericMethod(typeArguments.ToArray(Of Type)()).Let(Of MethodInfo, Candidate)(m => New Candidate(_.Instance, m, m.GetGenericParameterMap(), arguments))), Func(Of IEnumerable(Of Candidate), IEnumerable(Of Candidate)))).Where(Of Candidate)(Function (ByVal t As Candidate)
Dim CS$<>8__locals27 As <>c__DisplayClass26 = DirectCast(Me, <>c__DisplayCl
using System;
using System.Linq;
using System.Linq.Expressions;
using XSpect.Yacq.LanguageServices;
namespace yacqrun
{
class Program
{
static void Main(string[] args)