Skip to content

Instantly share code, notes, and snippets.

View paralleltree's full-sized avatar
🐱
Meow

Ryo Namiki paralleltree

🐱
Meow
View GitHub Profile
@cocodrips
cocodrips / CODERUNNER_Cluster
Last active August 29, 2015 14:10
CodeRunner 予選Bの敵の属性をK-meansで分類したやつ
0 : ( 24 48 68 73 74 89 99 )
1 : ( 20 34 46 47 54 71 78 )
2 : ( 6 13 14 16 23 25 28 29 30 37 41 43 50 51 53 55 58 59 60 61 65 66 69 70 72 75 79 83 84 85 86 88 90 92 94 97 )
3 : ( 1 7 15 26 33 36 38 64 76 80 81 91 96 100 )
4 : ( 3 17 35 44 45 52 67 77 )
5 : ( 9 10 21 27 87 )
6 : ( 4 62 82 95 98 )
7 : ( 5 18 31 39 40 56 )
8 : ( 8 12 22 32 42 57 63 )
9 : ( 2 11 19 49 93 )
@tanakh
tanakh / Main.hs
Created November 2, 2014 14:33
CODE RUNNER 予選B
{-# LANGUAGE ViewPatterns #-}
import Control.Monad
import System.Process
import Control.Concurrent
import Network.HTTP.Conduit
import qualified Data.ByteString.Lazy.Char8 as L
import Data.List
import System.IO
import Control.Applicative
@chitoku-k
chitoku-k / LazyBitmapImage.cs
Last active August 29, 2015 14:02
LazyImageBehavior
using System;
using System.IO;
using System.Net;
using System.Net.Cache;
using System.Threading.Tasks;
using System.Windows.Media.Imaging;
public static class LazyBitmapImage
{
public static Task<BitmapImage> GetImage(Uri uri)
//2本接続
var observable = t.Streaming.StartObservableStream(StreamingType.User);
var disposable1 = observable.OfType<StatusMessage>().Subscribe(s => Console.WriteLine("status"));
var disposable2 = observable.OfType<EventMessage>().Subscribe(e => Console.WriteLine("event"));
//1本接続
var observable = t.Streaming.StartObservableStream(StreamingType.User).Publish();
observable.OfType<StatusMessage>().Subscribe(s => Console.WriteLine("status"));
observable.OfType<EventMessage>().Subscribe(e => Console.WriteLine("event"));
var disposable = observable.Connect();
@thomaslevesque
thomaslevesque / CustomDragCursor.cs
Created May 2, 2014 22:55
Drag and drop with custom cursor
void Main()
{
var pb = new PictureBox { Image = Image.FromFile(@"D:\tmp\dotnet.png") };
bool down = false;
Cursor dragCursor = null;
pb.MouseDown += (sender, e) => down = true;
pb.MouseUp += (sender, e) => { down = false; dragCursor = null; };
pb.MouseMove += (sender, e) =>
{
if (down)
@nanase
nanase / pi2.c
Created October 29, 2013 05:10
モンテカルロ法
char mes0[] = { 0xe8, 0xa8, 0x88, 0xe7, 0xae, 0x97, 0 , 0 , 0, 0 , 0 , 0 ,0}
, mes1 [ ] = { 0 , 0 , 0 , 0 , 0 , 0 , 0xe5 , 0x9b , 0x9e , 0xe6 , 0x95 , 0xb0
, 0xe3, 0x82, 0x92, 0xe5 , 0x85, 0xa5 , 0xe5 , 0x8a , 0x9b , 0x3a , 0x20 , 0 , 0 , 0
, 0 } , mes2 [ ] = { 0x25 , 0x6c , 0x6c , 0x64 , 0 } , mes3 [ ] = { 0 , 0 , 0 , 0
, 0 , 0 , 0xe4 , 0xb8 , 0xad , 0x2e , 0x2e , 0x2e , 0x28 , 0x25 , 0x36 , 0x2e , 0x32
, 0x66 , 0x25 , 0x25 , 0x29 , 0x20 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } , mes4 [ ] = { 0x50
, 0x49 , 0x20 , 0x3d , 0x20 , 0x25 , 0x2e , 0x36 , 0x66 , 0xa , 0 , 0 } , mes5 [ ] = { 0xa
, 0 , 0 , 0 , 0 , 0 ,0,0xe5, 0xae
, 0x8c , 0xe4,0xba ,0x86 , 0xa ,
@Akkiesoft
Akkiesoft / lcd.rb
Last active March 29, 2017 09:20
ストロベリー・リナックスのSB1602BWかスイッチサイエンスのI2C LCDを使って、Felica系カードの残高を表示するスクリプト。OSCのデモとかで使用中。
# coding: utf-8
# IC balance checker / 2013-2015 @Akkiesoft
# Licence:
# MIT License
# references:
# http://homepage3.nifty.com/slokar/pasori/libpafe-ruby.html
# http://iccard.jennychan.at-ninja.jp/format
require 'wiringpi'
@rtanote
rtanote / livet-savedlg.cs
Created June 5, 2013 01:01
Livetを使ったファイル保存ダイアログの実装例
/* xaml
<Button Content="export" IsEnabled="{Binding ExportCommand.CanExecute}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<l:SaveFileDialogInteractionMessageAction>
<l:DirectInteractionMessage CallbackCommand="{Binding ExportCommand}">
<l:SavingFileSelectionMessage Filter="{Binding ExportFilter}" />
</l:DirectInteractionMessage>
</l:SaveFileDialogInteractionMessageAction>
</i:EventTrigger>
@ishikura
ishikura / memomemo
Created February 28, 2013 01:16
LivetでView側からViewModel側の引数付きメソッドを実施する時(引数はとりあえずstringのみ確認した)のちょっとメモ。以下の2通りのやり方で引き渡せた。使い分けとか他にもっといい方法が…とかは今後。
<!--その1 MethodParameterに文字列を設定 -->
・View(XAML)側
<Button Content="AC" Name="buttonAC">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<l:LivetCallMethodAction MethodName="ClearButton" MethodTarget="{Binding}" MethodParameter="AC"/>
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
@repeatedly
repeatedly / msgpack_issue_121.md
Last active November 30, 2021 02:09
MessagePackが文字列とバイナリをわけないのは問題?

MessagePackが文字列とバイナリをわけないのは問題?

msgpack/msgpack#121

Objective Cの実装使ってるとある問題にぶちあたった.なので,文字列をちゃんとバイナリ(Raw)と分けるべき,という提案

(*) 俺は熟読したわけではないので,中身が気になる人はちゃんと本スレを読みましょう

そもそもMessagePackとは