Skip to content

Instantly share code, notes, and snippets.

View takeshik's full-sized avatar

Takeshi KIRIYA takeshik

View GitHub Profile
class Program {
static void Main() {
System.Reflection.Assembly.Load(System.Convert.FromBase64String("TVqQAAMAAAAEAAAA//8AALgAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAA4fug4AtAnNIbgBTM0hVGhpcyBwcm9ncmFtIGNhbm5vdCBiZSBydW4gaW4gRE9TIG1vZGUuDQ0KJAAAAAAAAABQRQAATAEDALWKjksAAAAAAAAAAOAAAgELAQgAAA4AAAAIAAAAAAAADi0AAAAgAAAAQAAAAABAAAAgAAAAAgAABAAAAAAAAAAEAAAAAAAAAACAAAAAAgAAAAAAAAMAQIUAABAAABAAAAAAEAAAEAAAAAAAABAAAAAAAAAAAAAAAMAsAABLAAAAAEAAANgFAAAAAAAAAAAAAAAAAAAAAAAAAGAAAAwAAAAwLAAAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAACAAAAAAAAAAAAAAACCAAAEgAAAAAAAAAAAAAAC50ZXh0AAAAFA0AAAAgAAAADgAAAAIAAAAAAAAAAAAAAAAAACAAAGAucnNyYwAAANgFAAAAQAAAAAYAAAAQAAAAAAAAAAAAAAAAAABAAABALnJlbG9jAAAMAAAAAGAAAAACAAAAFgAAAAAAAAAAAAAAAAAAQAAAQgAAAAAAAAAAAAAAAAAAAADwLAAAAAAAAEgAAAACAAUARCEAAOwKAAABAAAAAQAABgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMwBQBEAAAAAAAAAHIBAABwAnIVAABwKBEAAApvEgAACm8TAAAKAnInAABwKBEAAApvFAAACm8VAAAKci8AAHByMwAAcG8WAAAKKBcAAAoqEzAGAJAAAAABAA
using System;
using System.Linq;
using System.Text;
using System.Diagnostics;
using System.Xml.Linq;
class Program
{
static void Main(string[] args)
{
this.Client.Connectors.Let(
cs => cs.ItemsAdded += (csender, ce) =>
ce.NewElements
.ForEach(ct => this.serversTreeView.Nodes.Insert(ct.Index, ct.Key)
.Let(nc =>
this.Client.Connectors[nc.FullPath].Views.Let(
vs => vs.ItemsAdded += (vsender, ve) => ve.NewElements
.ForEach(vt => this.serversTreeView.Nodes.Insert(vt.Index, vt.Key)
.Let(nf =>
nf.FullPath.Split('\\')
public IEnumerable<Activity> ExecuteQuery(String query)
{
return query.Split(Environment.NewLine.ToCharArray())
.Select(s => "(?<method>where|select|orderby|take|skip): *(?<body>.+?)(?: params: *(?<params>.+))?$".RegexMatch(s))
.Select(m => new
{
Method = m.Groups["method"].Value.ToLower(),
Body = m.Groups["body"].Value,
Parameters = m.Groups["params"].Value.Split(',').Select(s => s.Trim(' ')).ToArray()
})
class FizzBuzz
{
static void Main()
{
#pragma warning disable 184
if (System.Console.WriteLine(
System.String.Join(" ", System.Array.ConvertAll(System.Linq.Enumerable.ToArray(System.Linq.Enumerable.Range(1, 100)),
i => i % 15 == 0
? "Fizz Buzz"
: i % 3 == 0
// License: MIT License
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;
using System.Runtime.Serialization.Formatters;
public static void Swap<T>(Expression<Func<T>> left, Expression<Func<T>> right)
{
var lexpr = (MemberExpression) left.Body;
var rexpr = (MemberExpression) right.Body;
var lvalue = left.Compile()();
Set(lexpr.Member, lexpr.Expression != null ? Expression.Lambda(lexpr.Expression).Compile().DynamicInvoke() : null, right.Compile()());
Set(rexpr.Member, rexpr.Expression != null ? Expression.Lambda(rexpr.Expression).Compile().DynamicInvoke() : null, lvalue);
}
private static void Set(MemberInfo member, Object self, Object value)
public static void Swap<T>(Expression<Func<T>> left, Expression<Func<T>> right)
{
var lvalue = left.Compile()();
Expression.Lambda<Func<T>>(Expression.Assign(left.Body, Expression.Constant(right.Compile()()))).Compile()();
Expression.Lambda<Func<T>>(Expression.Assign(right.Body, Expression.Constant(lvalue))).Compile()();
}
public class Test
{
public int X { get; set; }
var domain = AppDomain.CreateDomain("Tween", null, new AppDomainSetup()
{
ApplicationBase = @"C:\",
PrivateBinPath = Environment.CurrentDirectory + ";" + @"C:\Program Files\Tween\",
});
domain.DoCallBack(() => Assembly.LoadFrom(@"C:\Program Files\Tween\Tween.exe"));
domain.DoCallBack(() => Console.WriteLine(Tween.SettingTabs.GetSettingFilePath("Tabs")));
// -> C:\Program Files\Tween\SettingTabsTabs.xml
AppDomain.Unload(domain);
' Tween - Client of Twitter
' Copyright (c) 2007-2010 kiri_feather (@kiri_feather) <kiri_feather@gmail.com>
' (c) 2008-2010 Moz (@syo68k) <http://iddy.jp/profile/moz/>
' (c) 2008-2010 takeshik (@takeshik) <http://www.takeshik.org/>
' All rights reserved.
'
' This file is part of Tween.
'
' This program is free software; you can redistribute it and/or modify it
' under the terms of the GNU General Public License as published by the Free