Skip to content

Instantly share code, notes, and snippets.

View unarist's full-sized avatar

unarist unarist

View GitHub Profile
@unarist
unarist / gist:3990787
Created November 1, 2012 00:13
Waku2Rpc for C# を実装した夢を見たんです
class Program : IClientMethods
{
void Main()
{
IWaku2Rpc<IServerMethods> client = Waku2Rpc.Create<IServerMethods>(this);
client.Chat(new Msg { name="", msg="", dummy=0 });
}
public void ChatNotify(int id, string name, string msg)
{
@unarist
unarist / gist:6282074
Created August 20, 2013 14:26
アイカツカード.hs。試しに書いてみたけどreadやshowを手書きしたくないわこれ・・・
data GameVersion = Vol1 | Vol2 | Vol3 | Vol4 | Vol5 | Vol6 | Promotion
deriving Eq
data AppearType = Cute | Cool | Sexy | Pop
deriving Eq
data CardCategory = Tops | Bottoms | Onepiece | Shoes | Accessory
deriving Eq
data CardBrand = AngelySugar | FuturingGirl | SpicyAgeha | HappyRainbow
@unarist
unarist / gist:6342758
Created August 26, 2013 15:32
クリップボードを監視してテキストボックスに追加していく感じの。
using System;
using System.Runtime.InteropServices;
using System.Windows.Forms;
internal class MainForm : Form
{
[DllImport("user32.dll", SetLastError = true)]
private extern static void AddClipboardFormatListener(IntPtr hwnd);
[DllImport("user32.dll", SetLastError = true)]
@unarist
unarist / gist:6576907
Last active December 23, 2015 03:59 — forked from anonymous/gist:6576895
Cookie Clickerで一つの建造物を買えるだけ買い続けたらどうなるかシミュレートするコード群。
-- Main> simulation State {...} 適当な秒数
module Main where
data State = State {
baseCost:: Integer, -- 初期コスト。これを元にコストが計算される。
baseCpS:: Integer, -- 一基あたりのCpS。baseって名づけたけどこっちは変動なし。
buildingCount:: Int, -- 所有数。
totalCpS:: Integer, -- 全体のCpS。baseCpSを足していくだけなので、最初から値を入れておけばずらせる。
totalCookies:: Integer -- クッキーおいしい。
@unarist
unarist / file0.sql
Created December 18, 2013 16:06
PostgreSQLでシーケンスを今の最大値にリセットする ref: http://qiita.com/unarist@github/items/1ef370933d5745d9c336
select
'select setval(''' || sequence || ''', (select max(' || column_name || ') from ' || table_name || '));' as setval
from
(
select
table_name
, column_name
, substr(column_default, 10, length(column_default) - 21) as sequence
from
information_schema.columns
@unarist
unarist / git-branch-stats.sh
Last active September 11, 2018 11:53
git-branch-stats.sh
#!/bin/bash
# git-branch-stats.sh (c)2014 unarist
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@unarist
unarist / gist:d86f108d67ee77f15fe4
Created August 22, 2014 03:24
同時押しのキー数を数える
/*
同時押しのキー数を数える by unarist
押して離したタイミングでカウント。
*/
var form = new Form();
var view = new Label{Dock=DockStyle.Fill};
form.Controls.Add(view);
var keys = new HashSet<Keys>();
var log = new int[16];
[core]
autocrlf = False
[fetch]
prune = true
[push]
default = current
[pull]
ff = only
[alias]
sd = diff --color-words
@unarist
unarist / gist:21ecd989a43a4006b404
Last active August 29, 2015 14:12
pso2swiki コメ数カウンタ
// ==UserScript==
// @name PSO2Wiki コメントページ詳細
// @namespace https://github.com/unarist/
// @version 0.2
// @description enter something useful
// @author You
// @match http://pso2.swiki.jp/index.php?Comments%2F*
// @grant none
// ==/UserScript==
@unarist
unarist / transifex-copyall.user.js
Last active December 15, 2016 02:50
Transifexで原文と訳文をまとめてコピーするやつ
// ==UserScript==
// @name Transifexで原文と訳文をまとめてコピーするやつ
// @namespace https://github.com/unarist/
// @downloadURL https://gist.githubusercontent.com/unarist/e58f7a051c285d614a89/raw/transifex-copyall.user.js
// @version 0.6
// @description enter something useful
// @author unarist
// @match https://www.transifex.com/*/translate/
// @require https://cdnjs.cloudflare.com/ajax/libs/mustache.js/0.8.1/mustache.min.js
// @grant none