Skip to content

Instantly share code, notes, and snippets.

@meganehouser
meganehouser / jackpy.py
Last active August 29, 2015 14:04
simple key value store (in memory) inspired by tristanwietsma/jack v0.1
"""
simple key value store (in memory)
inspired by tristanwietsma/jack v0.1
https://github.com/tristanwietsma/jack
"""
from argparse import ArgumentParser
from asyncio import (
Protocol,
coroutine,
get_event_loop,
@meganehouser
meganehouser / src_core.clj
Created July 7, 2014 09:44
Bowling Kata by Clojure
(defn spare? [t1 t2]
(= 10 (+ t1 t2)))
(defn spare-score [[next-pin]]
(+ 10 next-pin))
(defn strike? [t1]
(= 10 t1))
(defn strike-score [[first-pin second-pin]]
@meganehouser
meganehouser / kmeans.clj
Created April 9, 2014 14:21
ClojureでKMeans
(ns sample.kmeans
(:import [processing.core PVector])
(:use quil.core))
(def group-num 10)
(def point-num 300)
(def max-x 700)
(def max-y 700)
(def points (take point-num (repeatedly #(new PVector (rand-int max-x) (rand-int max-y)))))
@meganehouser
meganehouser / CopyZip.ps1
Created January 25, 2014 17:07
頼まれたやつ
### 使い方
### 1. PowerShellを起動する
### 2. PowerShell 実行権限の変更(最初の一回のみ実行)
### Set-ExecutionPolicy RemoteSigned
### 3. 7z をインストール(インストールしたフォルダ内に7z.exeがある)
### http://sevenzip.sourceforge.jp/download.html
### 4. このスクリプトをCopyZip.ps1というファイル名で実行
### 5. コピー元のフォルダパス、コピー先・ZIPファイル作成先のフォルダパス、7z.exeのパスを書き換える
### 6. PowerShellでカレントディレクトリをCopyZip.ps1を置いたディレクトリに移動
### 7. 以下のコマンドを実行
@meganehouser
meganehouser / ci.bat
Created October 29, 2013 07:58
WindowsでWatchDogを使って、.csファイルを監視。 C#プロジェクトの自動ビルド、ユニットテストを行う。
set nunit_dir=(NUnitのインストールフォルダ)
set msbuild_dir=c:\Windows\Microsoft.NET\Framework\v4.0.30319
set target=(csprojのパス)
set testdll=(テストプロジェクトのDLLのパス)
watchmedo shell-command --patterns="*.cs" --recursive --wait --command="%msbuild_dir%\MSBuild.exe %target% & %nunit_dir%\nunit-console.exe %testdll% /nologo"
@meganehouser
meganehouser / scopedregistry.py
Last active December 26, 2015 12:49
Pythonのレジストリパターン実装
class Registry(object):
instance = None
@classmethod
def initialize(cls):
cls.instance = Registry()
def __init__(self):
self.data = 'Hello World'
@meganehouser
meganehouser / gist:6397574
Last active December 7, 2018 00:48
談話室のGo言語導入資料的なあれ。
@meganehouser
meganehouser / EmptyGame.fs
Last active December 19, 2015 00:28
Delta Engine の Sample/EmptyGame を F# で無理やり mutable をなくして実装。
open DeltaEngine.Core
open DeltaEngine.Datatypes
open DeltaEngine.Platforms
type LerpColor = { Current: Color; Next: Color; Percentage:float32 }
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
module LerpColor =
let initialState = {Current=Color.Black; Next=Color.Black; Percentage=0.0f}
@meganehouser
meganehouser / EmptyGame.fs
Last active December 18, 2015 23:19
Delta Engine の Sample/Empty Game を F# に移植
open DeltaEngine.Core
open DeltaEngine.Datatypes
open DeltaEngine.Platforms
type EmptyGame() =
let mutable fadePercentage = 0.0f
let mutable currentColor = Color.Black
let mutable nextColor = Color.Black
let SwitchNextRandomColor() =
@meganehouser
meganehouser / post-commit.py
Created December 13, 2012 04:49
SubversionのコミットをIPメッセンジャーで通知する(Windows)
#!python 2
#! coding:utf-8
"""
リポジトリのhooksフォルダに置く。
hooksフォルダのpost-commit.batには以下のように記述。
cd C:\Repositorys\exampleProject\hooks
post-commit.py %1 %2
"""