Skip to content

Instantly share code, notes, and snippets.

View mzp's full-sized avatar

Hiro Mizuno mzp

View GitHub Profile
@mzp
mzp / annot.patch
Created May 6, 2012 22:47
SMLSharp spotter
diff --git a/depend.mk b/depend.mk
index dec0a30..9f29e21 100644
--- a/depend.mk
+++ b/depend.mk
@@ -5440,11 +5440,11 @@ src/compiler/main/main/RunLoop.o: src/compiler/main/main/RunLoop.sml \
src/compiler/toplevel2/main/TOP.sig \
src/compiler/toplevel2/main/TopData.ppg.smi \
src/compiler/toplevel2/main/NameEvalEnvUtils.smi \
- src/compiler/toplevel2/main/Top.smi src/ffi/main/DynamicLink.smi \
- src/ffi/main/Pointer.smi src/ffi.smi src/sql/main/PGSQL.smi \
@mzp
mzp / hello.annot
Created May 6, 2012 09:08
smlspotter
("(BuiltinContext.smi)" (43 11) (43 14) "exn")
("(BuiltinContext.smi)" (44 11) (44 15) "exn")
("(BuiltinContext.smi)" (45 11) (45 19) "exn")
("(BuiltinContext.smi)" (46 11) (46 14) "exn")
("(BuiltinContext.smi)" (47 11) (47 18) "exn")
("(BuiltinContext.smi)" (48 11) (48 13) "exn")
("(BuiltinContext.smi)" (49 11) (49 16) "exn")
("(BuiltinContext.smi)" (50 11) (50 24) "string -> exn")
("(BuiltinContext.smi)" (52 11) (52 13) "exn")
("(BuiltinContext.smi)" (53 11) (53 14) "exn")
@mzp
mzp / gist:1131618
Created August 8, 2011 11:40
git-master
#!/bin/sh
MASTER=${1:-"master"}
WORKING_BRANCH=`git branch -l | grep "*" | cut -d " " -f 2`
git rebase $MASTER && git checkout $MASTER && git reset --hard $WORKING_BRANCH && git branch -D $WORKING_BRANCH
@mzp
mzp / git-now
Created August 5, 2011 07:47
git-now
#!/bin/sh
PREFIX="from now"
MESSAGE="[${PREFIX}] `date +\"%Y/%m/%d %T\"`"
get_amend() {
if [ -z `git log --pretty=oneline -1 | cut -d " " -f 2- | grep "^\[${PREFIX}]"` ]
then
return 1
fi
@mzp
mzp / gist:1048386
Created June 27, 2011 06:18
unfiltered-scalatest.diff
diff --git a/scalatest/src/main/scala/jetty/Served.scala b/scalatest/src/main/scala/jetty/Served.scala
index 551f5e5..a54ad7c 100755
--- a/scalatest/src/main/scala/jetty/Served.scala
+++ b/scalatest/src/main/scala/jetty/Served.scala
@@ -1,21 +1,21 @@
package unfiltered.scalatest.jetty
import _root_.unfiltered.scalatest.Hosted
-import org.scalatest.FeatureSpec
+import org.scalatest.{FeatureSpec, BeforeAndAfterAll}
// ShimbashiShelfで管理するファイル
class FileObject
case class File(
// 各ファイルに振られる一意なID(GUID?)
id : String,
// ファイル名
name : String,
// ファイルのパス
path : String,
// タグ
@mzp
mzp / danbo.c
Created May 15, 2011 13:15
ダンボー
#define LEFT 10
#define RIGHT 7
#define BLUE 0x04
#define RED 0x02
#define GREEN 0x01
void setup() {
Serial.begin(9600);
}
@mzp
mzp / min.c
Created April 30, 2011 06:19
frama-cexample
typedef enum _bool { false = 0, true = 1 } bool ;
typedef void* T;
/*@
axiomatic Order{
predicate LE(T x, T y);
axiom refl: \forall T x; LE(x,x);
axiom trans: \forall T x, T y, T z; LE(x,y) && LE(y,z) ==> LE(x,z);
}
@mzp
mzp / SendMoreMoney.scala
Created December 22, 2010 22:19
SendMoreMoney.scala
object SendMoreMoney {
def int(xs : Int*) : Int =
xs.foldLeft(0)( _ * 10 + _)
def solve : Seq[(Int, Int,Int)] = {
val digits = 0 to 9
for {
s <- digits
e <- digits diff List(s)
n <- digits diff List(s, e)
@mzp
mzp / echo.html
Created December 11, 2010 01:30
websocket.py
<html>
<head>
<style type="text/css">
.log {
color: red;
}
</style>
<script>
ws = new WebSocket("ws://localhost:8080");
ws.onopen = function (e) {