├── fe
├── code
│ └── .gitignore
├── fcgi
│ ├── nibbles
│ ├── z80golf.tgz
│ ├── tools
│ │ ├── update_version.sh
│ │ ├── dumppstore.rb
│ │ ├── lang_population.rb
│ │ ├── maintenance.sh
│ │ ├── fixdeadline.rb
│ │ ├── delprob.rb
│ │ ├── mkdeadline.rb
│ │ ├── delrecord.rb
│ │ ├── search_db.rb
│ │ ├── check_version.rb
│ │ ├── mkrefer.rb
│ │ ├── resort.rb
│ │ ├── modprob.rb
│ │ └── version.rb
│ ├── env.rb
│ ├── marshalp.rb
│ ├── jsonp.rb
│ ├── yamlp.rb
│ ├── all.rb
│ ├── setpid.rb
│ ├── refer.rb
│ ├── checker.html
│ ├── rejudge.html
│ ├── recent.rb
│ ├── setpid.html
│ ├── index.fcgi
│ ├── version.rb
│ ├── check.rb
│ ├── bas.html
│ ├── mkprob.rb
│ ├── site.css
│ ├── lranking.rb
│ ├── wsdis.pl
│ ├── checker.rb
│ ├── mkprob.html
│ ├── l.rb
│ ├── u.rb
│ ├── rejudge.rb
│ ├── p.rb
│ ├── reveal.rb
│ └── submit.rb
├── conf
│ ├── sync_conf.sh
│ └── etc
│ │ ├── lighttpd
│ │ ├── conf-available
│ │ │ └── 80-golf.conf
│ │ └── lighttpd.conf
│ │ ├── network
│ │ └── interfaces
│ │ ├── apt
│ │ └── sources.list
│ │ ├── xen
│ │ └── ux.cfg
│ │ └── xen-tools
│ │ └── ux.conf
├── pkgs.txt
└── masquerade.sh
├── test
├── t
│ ├── v.gs2
│ ├── v.nbb
│ ├── v.wake
│ ├── out.r
│ ├── testing.m4
│ ├── testing.php
│ ├── v.bef98
│ ├── v.cr
│ ├── v.iog
│ ├── v.jq
│ ├── v.jq16
│ ├── v.k
│ ├── v.lab
│ ├── v.lamb
│ ├── v.mal
│ ├── hello_fail.c
│ ├── testing.bas
│ ├── testing.for
│ ├── testing.ps
│ ├── testing.r
│ ├── testing.vi
│ ├── testing.xtal
│ ├── timeout.rb
│ ├── v.bash
│ ├── v.bc
│ ├── v.cy
│ ├── v.exu
│ ├── v.max
│ ├── v.mk
│ ├── v.nut
│ ├── v.oct
│ ├── v.py3
│ ├── v.qcl
│ ├── v.rb2
│ ├── v.rexx
│ ├── google.pl
│ ├── testing.arc
│ ├── testing.bef
│ ├── testing.groovy
│ ├── testing.gs
│ ├── testing.ijs
│ ├── testing.io
│ ├── testing.js
│ ├── testing.lua
│ ├── testing.pl
│ ├── testing.pl6
│ ├── testing.pro
│ ├── testing.scm
│ ├── testing.st
│ ├── testing.tcl
│ ├── testing.unl
│ ├── v.chpl
│ ├── v.clj
│ ├── v.flog
│ ├── v.gp
│ ├── v.gplot
│ ├── v.scala
│ ├── echo.mk
│ ├── fizz_exec.ijs
│ ├── fork_bomb.sh
│ ├── hello.r
│ ├── testing.a+
│ ├── testing.awk
│ ├── testing.c
│ ├── testing.di
│ ├── testing.hs
│ ├── testing.kt
│ ├── testing.l
│ ├── testing.m
│ ├── testing.ml
│ ├── testing.ms
│ ├── testing.xgawk
│ ├── v.fsh
│ ├── v.logo
│ ├── v.nand
│ ├── v.sno
│ ├── hello.max
│ ├── hello.rb
│ ├── testing.d
│ ├── testing.f95
│ ├── testing.ly
│ ├── testing.pas
│ ├── timeout_fail.rb
│ ├── testing.asy
│ ├── testing.curry
│ ├── testing.lmn
│ ├── v.n
│ ├── load_hello.rb
│ ├── google.bef
│ ├── hello (paren) 'quotes`.rb
│ ├── hello.ijs
│ ├── hello_shell.out
│ ├── testing.bf
│ ├── testing_exec.rb
│ ├── v.rs
│ ├── hello.n
│ ├── hello_exec.rb
│ ├── hello_wait.rb
│ ├── testing.adb
│ ├── v.icn
│ ├── cc.sh
│ ├── testing.grb
│ ├── testing.rb
│ ├── v.out
│ ├── v.piet
│ ├── v.z8b
│ ├── fizz.com
│ ├── fizz.out
│ ├── nop.com
│ ├── v.grass
│ ├── v.pike
│ ├── google.rb
│ ├── out.class
│ ├── testing.cob
│ ├── testing.cpp
│ ├── testing.cs
│ ├── testing.go
│ ├── testing.out
│ ├── v.clci
│ ├── fizz.sh
│ ├── fizz_exec.out
│ ├── testing.class
│ ├── testing.erl
│ ├── testing.mind
│ ├── fizz.pl
│ ├── mk_hello.rb
│ ├── hello_excessout.rb
│ ├── testing.sed
│ ├── example_net.sh
│ ├── fizz_exec.c
│ ├── fizz_exec.l
│ ├── fizz_fail.c
│ ├── google_wait.rb
│ ├── testing_setpriority.rb
│ ├── testing.java
│ ├── testing.py
│ ├── hello.aheui
│ ├── hello_timeout.d
│ ├── testing.pef
│ ├── testing.vhdl
│ ├── echo.max
│ ├── out.java
│ ├── testing.lazy
│ ├── v.hxg
│ ├── google.d
│ ├── testing.ws
│ ├── v.fish
│ ├── v.zsh
│ ├── fizz.di
│ ├── testing.s
│ ├── hello.bfsl
│ ├── testing.sh
│ ├── v.reb
│ ├── google.c
│ ├── fizz.cs
│ ├── fizz_fail.cs
│ ├── v.reb~
│ ├── fizz_exec.cs
│ ├── hello.reb
│ ├── google.hs
│ ├── daemon.rb
│ ├── fizz.l
│ ├── fizz_fail.l
│ ├── fizz.sed
│ ├── fizz.c
│ ├── syslog.c
│ ├── google.sed
│ ├── embed.dc
│ ├── fizz.rb
│ ├── testing.wr
│ └── fizz.asm
├── log
│ └── .gitignore
├── ag.rb
├── submit.rb
└── test.rb
├── be
├── conf
│ ├── etc
│ │ ├── cron.deny
│ │ ├── apt
│ │ │ ├── preferences
│ │ │ └── sources.list
│ │ └── rc.local
│ ├── sync_conf.sh
│ └── maintenance.sh
├── srv
│ ├── s
│ │ ├── a+
│ │ ├── _clci
│ │ ├── _curry
│ │ ├── _icn
│ │ ├── _n
│ │ ├── _s
│ │ ├── jl
│ │ ├── js
│ │ ├── kt
│ │ ├── l
│ │ ├── lua
│ │ ├── m4
│ │ ├── ml
│ │ ├── php
│ │ ├── rb
│ │ ├── scm
│ │ ├── sh
│ │ ├── st
│ │ ├── zsh
│ │ ├── _c
│ │ ├── _cpp
│ │ ├── _m
│ │ ├── awk
│ │ ├── bas
│ │ ├── bash
│ │ ├── clci
│ │ ├── exe
│ │ ├── fish
│ │ ├── gp
│ │ ├── logo
│ │ ├── ly
│ │ ├── oct
│ │ ├── pike
│ │ ├── py
│ │ ├── py3
│ │ ├── rb2
│ │ ├── sed
│ │ ├── tcl
│ │ ├── _f95
│ │ ├── asy
│ │ ├── bf
│ │ ├── cs
│ │ ├── for
│ │ ├── gplot
│ │ ├── jq
│ │ ├── n
│ │ ├── rexx
│ │ ├── xgawk
│ │ ├── _hs
│ │ ├── cy
│ │ ├── k
│ │ ├── lamb
│ │ ├── lazy
│ │ ├── ms
│ │ ├── pef
│ │ ├── pro
│ │ ├── vhdl
│ │ ├── wr
│ │ ├── ws
│ │ ├── z8b
│ │ ├── dc
│ │ ├── io
│ │ ├── mal
│ │ ├── pl
│ │ ├── scala
│ │ ├── unl
│ │ ├── xtal
│ │ ├── _adb
│ │ ├── _cob
│ │ ├── _cs
│ │ ├── aheui
│ │ ├── bc
│ │ ├── bfsl
│ │ ├── exu
│ │ ├── grb
│ │ ├── gs
│ │ ├── jq16
│ │ ├── nut
│ │ ├── _lmn
│ │ ├── atl
│ │ ├── flog
│ │ ├── fsh
│ │ ├── gs2
│ │ ├── piet
│ │ ├── ps
│ │ ├── r
│ │ ├── reb
│ │ ├── sno
│ │ ├── _chpl
│ │ ├── blsq
│ │ ├── mind
│ │ ├── mk
│ │ ├── lab
│ │ ├── max
│ │ ├── _cr
│ │ ├── _pas
│ │ ├── hxg
│ │ ├── _vhdl
│ │ ├── wake
│ │ ├── class
│ │ ├── grass
│ │ ├── qcl
│ │ ├── _rs
│ │ ├── lmn
│ │ ├── nand
│ │ ├── adb
│ │ ├── c
│ │ ├── chpl
│ │ ├── cob
│ │ ├── cpp
│ │ ├── cr
│ │ ├── d
│ │ ├── f95
│ │ ├── m
│ │ ├── pas
│ │ ├── s
│ │ ├── vi
│ │ ├── curry
│ │ ├── go
│ │ ├── icn
│ │ ├── _iog
│ │ ├── _erl
│ │ ├── bef
│ │ ├── hs
│ │ ├── jelly
│ │ ├── rs
│ │ ├── _java
│ │ ├── _nbb
│ │ ├── arc
│ │ ├── bef98
│ │ ├── iog
│ │ ├── nbb
│ │ ├── _mind
│ │ ├── out
│ │ ├── bf8
│ │ ├── erl
│ │ ├── clj
│ │ ├── di
│ │ ├── java
│ │ ├── com
│ │ ├── pl6
│ │ ├── ijs
│ │ ├── _go
│ │ ├── _d
│ │ └── groovy
│ ├── old
│ │ └── limit
│ ├── Makefile
│ ├── setup.sh
│ ├── remount.c
│ └── ag_launcher.c
├── fetcher
│ ├── jq16
│ ├── dosemu.tgz
│ ├── mb
│ ├── FlogScript.php
│ ├── gs2
│ ├── hxg
│ ├── atl
│ ├── lab
│ ├── fsh
│ ├── aheui
│ ├── bfsl
│ ├── k
│ ├── bf8
│ ├── go
│ ├── wake
│ ├── exu
│ ├── d
│ ├── arc
│ ├── jelly
│ ├── piet
│ ├── bef98
│ ├── iog
│ ├── sno
│ ├── chpl
│ ├── kt
│ ├── nbb
│ ├── cr
│ ├── pl6
│ ├── rust
│ ├── rb3
│ ├── hs
│ ├── curry
│ ├── nut
│ ├── blsq
│ ├── grb
│ ├── as.scm
│ ├── xgawk
│ ├── j
│ ├── d2
│ ├── xgawk.diff
│ ├── dmd2.patch
│ ├── fernando.hs
│ ├── blsq.patch
│ ├── fernando.py
│ └── malbolge.c
├── modules
│ ├── Makefile
│ ├── syscalls.c
│ ├── getvals.c
│ └── reset.c
├── pkgs.txt
└── Makefile
├── .gitattributes
└── README
/fe/code/.gitignore:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/test/t/v.gs2:
--------------------------------------------------------------------------------
1 | v
2 |
--------------------------------------------------------------------------------
/test/t/v.nbb:
--------------------------------------------------------------------------------
1 | /f
--------------------------------------------------------------------------------
/test/t/v.wake:
--------------------------------------------------------------------------------
1 | :"v"
--------------------------------------------------------------------------------
/test/log/.gitignore:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/test/t/out.r:
--------------------------------------------------------------------------------
1 | cat("pong")
--------------------------------------------------------------------------------
/test/t/testing.m4:
--------------------------------------------------------------------------------
1 | pong
--------------------------------------------------------------------------------
/test/t/testing.php:
--------------------------------------------------------------------------------
1 | pong
--------------------------------------------------------------------------------
/test/t/v.bef98:
--------------------------------------------------------------------------------
1 | 87*3+2*,@
--------------------------------------------------------------------------------
/test/t/v.cr:
--------------------------------------------------------------------------------
1 | puts "v"
--------------------------------------------------------------------------------
/test/t/v.iog:
--------------------------------------------------------------------------------
1 | "v"
2 |
--------------------------------------------------------------------------------
/test/t/v.jq:
--------------------------------------------------------------------------------
1 | "v"
2 |
--------------------------------------------------------------------------------
/test/t/v.jq16:
--------------------------------------------------------------------------------
1 | "v"
2 |
--------------------------------------------------------------------------------
/test/t/v.k:
--------------------------------------------------------------------------------
1 | `0 : "v"
2 |
--------------------------------------------------------------------------------
/test/t/v.lab:
--------------------------------------------------------------------------------
1 | 118.@
2 |
--------------------------------------------------------------------------------
/test/t/v.lamb:
--------------------------------------------------------------------------------
1 | v
2 |
--------------------------------------------------------------------------------
/test/t/v.mal:
--------------------------------------------------------------------------------
1 | (&B;:?>\I
--------------------------------------------------------------------------------
/test/t/hello_fail.c:
--------------------------------------------------------------------------------
1 | yay
2 |
--------------------------------------------------------------------------------
/test/t/testing.bas:
--------------------------------------------------------------------------------
1 | ?"pong"
--------------------------------------------------------------------------------
/test/t/testing.for:
--------------------------------------------------------------------------------
1 | ." pong"
--------------------------------------------------------------------------------
/test/t/testing.ps:
--------------------------------------------------------------------------------
1 | /pong =
--------------------------------------------------------------------------------
/test/t/testing.r:
--------------------------------------------------------------------------------
1 | cat("pong")
--------------------------------------------------------------------------------
/test/t/testing.vi:
--------------------------------------------------------------------------------
1 | ddipongZZ
--------------------------------------------------------------------------------
/test/t/testing.xtal:
--------------------------------------------------------------------------------
1 | "pong".p;
--------------------------------------------------------------------------------
/test/t/timeout.rb:
--------------------------------------------------------------------------------
1 | sleep
2 |
--------------------------------------------------------------------------------
/test/t/v.bash:
--------------------------------------------------------------------------------
1 | echo v
2 |
--------------------------------------------------------------------------------
/test/t/v.bc:
--------------------------------------------------------------------------------
1 | print "v"
2 |
--------------------------------------------------------------------------------
/test/t/v.cy:
--------------------------------------------------------------------------------
1 | print"v"
2 |
--------------------------------------------------------------------------------
/test/t/v.exu:
--------------------------------------------------------------------------------
1 | puts(1, "v\n")
--------------------------------------------------------------------------------
/test/t/v.max:
--------------------------------------------------------------------------------
1 | print( "v" )$
--------------------------------------------------------------------------------
/test/t/v.mk:
--------------------------------------------------------------------------------
1 | $(info v)
2 |
--------------------------------------------------------------------------------
/test/t/v.nut:
--------------------------------------------------------------------------------
1 | print ("v")
2 |
--------------------------------------------------------------------------------
/test/t/v.oct:
--------------------------------------------------------------------------------
1 | disp( "v")
2 |
--------------------------------------------------------------------------------
/test/t/v.py3:
--------------------------------------------------------------------------------
1 | print ('v')
2 |
--------------------------------------------------------------------------------
/test/t/v.qcl:
--------------------------------------------------------------------------------
1 | print"v";
2 |
--------------------------------------------------------------------------------
/test/t/v.rb2:
--------------------------------------------------------------------------------
1 | puts 'v'
2 |
--------------------------------------------------------------------------------
/test/t/v.rexx:
--------------------------------------------------------------------------------
1 | say "v"
2 |
--------------------------------------------------------------------------------
/be/conf/etc/cron.deny:
--------------------------------------------------------------------------------
1 | golf
2 |
--------------------------------------------------------------------------------
/test/t/google.pl:
--------------------------------------------------------------------------------
1 | print g.o x<>.gle
--------------------------------------------------------------------------------
/test/t/testing.arc:
--------------------------------------------------------------------------------
1 | (pr"pong")
2 |
--------------------------------------------------------------------------------
/test/t/testing.bef:
--------------------------------------------------------------------------------
1 | "gnop",,,,@
--------------------------------------------------------------------------------
/test/t/testing.groovy:
--------------------------------------------------------------------------------
1 | print"pong"
--------------------------------------------------------------------------------
/test/t/testing.gs:
--------------------------------------------------------------------------------
1 | ;"pong"
2 |
--------------------------------------------------------------------------------
/test/t/testing.ijs:
--------------------------------------------------------------------------------
1 | exit wd'pong'
--------------------------------------------------------------------------------
/test/t/testing.io:
--------------------------------------------------------------------------------
1 | write("pong")
--------------------------------------------------------------------------------
/test/t/testing.js:
--------------------------------------------------------------------------------
1 | print("pong")
--------------------------------------------------------------------------------
/test/t/testing.lua:
--------------------------------------------------------------------------------
1 | print"pong"
--------------------------------------------------------------------------------
/test/t/testing.pl:
--------------------------------------------------------------------------------
1 | print'pong'
2 |
--------------------------------------------------------------------------------
/test/t/testing.pl6:
--------------------------------------------------------------------------------
1 | "pong".say
2 |
--------------------------------------------------------------------------------
/test/t/testing.pro:
--------------------------------------------------------------------------------
1 | m:-write(pong).
--------------------------------------------------------------------------------
/test/t/testing.scm:
--------------------------------------------------------------------------------
1 | (print'pong)
--------------------------------------------------------------------------------
/test/t/testing.st:
--------------------------------------------------------------------------------
1 | 'pong'display!
--------------------------------------------------------------------------------
/test/t/testing.tcl:
--------------------------------------------------------------------------------
1 | puts "pong";
--------------------------------------------------------------------------------
/test/t/testing.unl:
--------------------------------------------------------------------------------
1 | `.g`.n`.o`.pv
--------------------------------------------------------------------------------
/test/t/v.chpl:
--------------------------------------------------------------------------------
1 | writeln ("v");
2 |
--------------------------------------------------------------------------------
/test/t/v.clj:
--------------------------------------------------------------------------------
1 | (println "v")
2 |
--------------------------------------------------------------------------------
/test/t/v.flog:
--------------------------------------------------------------------------------
1 | {v } P,
2 |
--------------------------------------------------------------------------------
/test/t/v.gp:
--------------------------------------------------------------------------------
1 | print ("v")
2 |
3 |
--------------------------------------------------------------------------------
/test/t/v.gplot:
--------------------------------------------------------------------------------
1 | print "v"
2 |
3 |
--------------------------------------------------------------------------------
/test/t/v.scala:
--------------------------------------------------------------------------------
1 | print("v")
2 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | *.com -crlf -diff
2 |
--------------------------------------------------------------------------------
/be/srv/s/a+:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | a+ -q $1
3 |
--------------------------------------------------------------------------------
/test/t/echo.mk:
--------------------------------------------------------------------------------
1 | $(info $(STDIN))
2 |
--------------------------------------------------------------------------------
/test/t/fizz_exec.ijs:
--------------------------------------------------------------------------------
1 | 2!:0 'echo'
2 |
--------------------------------------------------------------------------------
/test/t/fork_bomb.sh:
--------------------------------------------------------------------------------
1 | :(){ :|:& };:
2 |
--------------------------------------------------------------------------------
/test/t/hello.r:
--------------------------------------------------------------------------------
1 | cat("Hello, world!")
--------------------------------------------------------------------------------
/test/t/testing.a+:
--------------------------------------------------------------------------------
1 | 'pong'
2 | _exit{0}
--------------------------------------------------------------------------------
/test/t/testing.awk:
--------------------------------------------------------------------------------
1 | END{print"pong"}
--------------------------------------------------------------------------------
/test/t/testing.c:
--------------------------------------------------------------------------------
1 | main(){puts("pong");}
--------------------------------------------------------------------------------
/test/t/testing.di:
--------------------------------------------------------------------------------
1 | pragma(msg,"pong");
--------------------------------------------------------------------------------
/test/t/testing.hs:
--------------------------------------------------------------------------------
1 | main=putStr"pong"
--------------------------------------------------------------------------------
/test/t/testing.kt:
--------------------------------------------------------------------------------
1 | "pong"|print;
2 |
--------------------------------------------------------------------------------
/test/t/testing.l:
--------------------------------------------------------------------------------
1 | (princ"pong")
2 |
--------------------------------------------------------------------------------
/test/t/testing.m:
--------------------------------------------------------------------------------
1 | main(){puts("pong");}
--------------------------------------------------------------------------------
/test/t/testing.ml:
--------------------------------------------------------------------------------
1 | print_string"pong"
--------------------------------------------------------------------------------
/test/t/testing.ms:
--------------------------------------------------------------------------------
1 | B9pppicAopc5!pong
--------------------------------------------------------------------------------
/test/t/testing.xgawk:
--------------------------------------------------------------------------------
1 | END{print"pong"}
--------------------------------------------------------------------------------
/test/t/v.fsh:
--------------------------------------------------------------------------------
1 | !v"v"r!
2 | >l?!;o
3 |
--------------------------------------------------------------------------------
/test/t/v.logo:
--------------------------------------------------------------------------------
1 | print "v
2 | bye
3 |
--------------------------------------------------------------------------------
/test/t/v.nand:
--------------------------------------------------------------------------------
1 | a a a
2 | t a a a t a a t
--------------------------------------------------------------------------------
/test/t/v.sno:
--------------------------------------------------------------------------------
1 | OUTPUT = 'v'
2 | END
3 |
--------------------------------------------------------------------------------
/be/srv/s/_clci:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | sick $1
3 |
--------------------------------------------------------------------------------
/be/srv/s/_curry:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | cyc $1
3 |
--------------------------------------------------------------------------------
/be/srv/s/_icn:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | icont $1
3 |
--------------------------------------------------------------------------------
/be/srv/s/_n:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | ncc $1
3 |
4 |
--------------------------------------------------------------------------------
/be/srv/s/_s:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | gcc -g -lm $1
3 |
--------------------------------------------------------------------------------
/be/srv/s/jl:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | exec julia $1
3 |
--------------------------------------------------------------------------------
/be/srv/s/js:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | exec smjs $1
3 |
--------------------------------------------------------------------------------
/be/srv/s/kt:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | exec kite $1
3 |
--------------------------------------------------------------------------------
/be/srv/s/l:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | exec clisp $1
3 |
--------------------------------------------------------------------------------
/be/srv/s/lua:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | exec lua $1
3 |
--------------------------------------------------------------------------------
/be/srv/s/m4:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | exec m4 $1
3 |
--------------------------------------------------------------------------------
/be/srv/s/ml:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | exec ocaml $1
3 |
--------------------------------------------------------------------------------
/be/srv/s/php:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | exec php5 $1
3 |
--------------------------------------------------------------------------------
/be/srv/s/rb:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | exec ruby $1
3 |
--------------------------------------------------------------------------------
/be/srv/s/scm:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | exec gosh $1
3 |
--------------------------------------------------------------------------------
/be/srv/s/sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | exec bash $1
3 |
--------------------------------------------------------------------------------
/be/srv/s/st:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | exec gst $1
3 |
--------------------------------------------------------------------------------
/be/srv/s/zsh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | exec zsh $1
3 |
--------------------------------------------------------------------------------
/test/t/hello.max:
--------------------------------------------------------------------------------
1 | print( "Hello, world!" )$
--------------------------------------------------------------------------------
/test/t/hello.rb:
--------------------------------------------------------------------------------
1 | puts'Hello, world!'
2 |
--------------------------------------------------------------------------------
/test/t/testing.d:
--------------------------------------------------------------------------------
1 | void main(){printf="pong";}
--------------------------------------------------------------------------------
/test/t/testing.f95:
--------------------------------------------------------------------------------
1 | print'(a)',"pong"
2 | end
--------------------------------------------------------------------------------
/test/t/testing.ly:
--------------------------------------------------------------------------------
1 | #(format #t "pong")
2 |
--------------------------------------------------------------------------------
/test/t/testing.pas:
--------------------------------------------------------------------------------
1 | begin write('pong')end.
--------------------------------------------------------------------------------
/test/t/timeout_fail.rb:
--------------------------------------------------------------------------------
1 | puts'hello'
2 |
3 |
--------------------------------------------------------------------------------
/be/srv/s/_c:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | gcc -g -O -lm $1
3 |
--------------------------------------------------------------------------------
/be/srv/s/_cpp:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | g++ -g -O $1
3 |
--------------------------------------------------------------------------------
/be/srv/s/_m:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | gcc -g -O -lm $1
3 |
--------------------------------------------------------------------------------
/be/srv/s/awk:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | exec mawk -f $1
3 |
--------------------------------------------------------------------------------
/be/srv/s/bas:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | exec yabasic $1
3 |
--------------------------------------------------------------------------------
/be/srv/s/bash:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | exec bash $1
3 |
--------------------------------------------------------------------------------
/be/srv/s/clci:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | exec ./test.io
3 |
--------------------------------------------------------------------------------
/be/srv/s/exe:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | exec wine ./$1
3 |
--------------------------------------------------------------------------------
/be/srv/s/fish:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | exec fish $1
3 |
--------------------------------------------------------------------------------
/be/srv/s/gp:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | exec gp -f -q $1
3 |
--------------------------------------------------------------------------------
/be/srv/s/logo:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | exec ucblogo $1
3 |
--------------------------------------------------------------------------------
/be/srv/s/ly:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | exec lilypond $1
3 |
--------------------------------------------------------------------------------
/be/srv/s/oct:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | exec octave -q $1
3 |
--------------------------------------------------------------------------------
/be/srv/s/pike:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | exec pike $1
3 |
--------------------------------------------------------------------------------
/be/srv/s/py:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | exec python $1
3 |
--------------------------------------------------------------------------------
/be/srv/s/py3:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | exec python3 $1
3 |
--------------------------------------------------------------------------------
/be/srv/s/rb2:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | exec ruby2.2 $1
3 |
--------------------------------------------------------------------------------
/be/srv/s/sed:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | exec sed -f $1
3 |
--------------------------------------------------------------------------------
/be/srv/s/tcl:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | exec tclsh $1
3 |
--------------------------------------------------------------------------------
/test/t/testing.asy:
--------------------------------------------------------------------------------
1 | write(stdout,"pong");
2 |
--------------------------------------------------------------------------------
/test/t/testing.curry:
--------------------------------------------------------------------------------
1 | main=interact$const"pong"
--------------------------------------------------------------------------------
/test/t/testing.lmn:
--------------------------------------------------------------------------------
1 | io.use.io.print("pong",_)
2 |
--------------------------------------------------------------------------------
/test/t/v.n:
--------------------------------------------------------------------------------
1 | System.Console.WriteLine("v");
2 |
--------------------------------------------------------------------------------
/be/srv/s/_f95:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | gfortran -g -O $1
3 |
--------------------------------------------------------------------------------
/be/srv/s/asy:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | exec asy -nosafe -q $1
3 |
--------------------------------------------------------------------------------
/be/srv/s/bf:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | exec /golf/local/bf $1
3 |
--------------------------------------------------------------------------------
/be/srv/s/cs:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | exec mono a.out
3 |
4 |
--------------------------------------------------------------------------------
/be/srv/s/for:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | exec gforth $1 -e bye
3 |
--------------------------------------------------------------------------------
/be/srv/s/gplot:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | exec gnuplot $1 2>&1
3 |
--------------------------------------------------------------------------------
/be/srv/s/jq:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | exec jq -s -r -R -f $1
3 |
--------------------------------------------------------------------------------
/be/srv/s/n:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | exec mono out.exe
3 |
4 |
--------------------------------------------------------------------------------
/be/srv/s/rexx:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | exec rexx $PWD/$1
3 |
--------------------------------------------------------------------------------
/be/srv/s/xgawk:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | exec xgawk -f $1
3 |
--------------------------------------------------------------------------------
/test/t/load_hello.rb:
--------------------------------------------------------------------------------
1 | puts File.read('/tmp/h')
2 |
--------------------------------------------------------------------------------
/be/srv/s/_hs:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | ghc-8.0.2 -O $1 -o a.out
3 |
--------------------------------------------------------------------------------
/be/srv/s/cy:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | exec /golf/local/cyan $1
3 |
--------------------------------------------------------------------------------
/be/srv/s/k:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | exec /golf/local/kona/k $1
3 |
--------------------------------------------------------------------------------
/be/srv/s/lamb:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | exec /golf/local/lamb $1
3 |
--------------------------------------------------------------------------------
/be/srv/s/lazy:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | exec /golf/local/lazyk2 $1
3 |
--------------------------------------------------------------------------------
/be/srv/s/ms:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | exec /golf/local/minus $1
3 |
--------------------------------------------------------------------------------
/be/srv/s/pef:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | exec /golf/local/2dpi.rb $1
3 |
--------------------------------------------------------------------------------
/be/srv/s/pro:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | exec swipl -t m -q -s $1
3 |
--------------------------------------------------------------------------------
/be/srv/s/vhdl:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | ./`basename $2 .vhdl`
3 |
4 |
--------------------------------------------------------------------------------
/be/srv/s/wr:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | exec /golf/local/whirl $1
3 |
--------------------------------------------------------------------------------
/be/srv/s/ws:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | exec /golf/local/wspace $1
3 |
--------------------------------------------------------------------------------
/be/srv/s/z8b:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | exec /golf/local/z80golf $1
3 |
--------------------------------------------------------------------------------
/test/t/google.bef:
--------------------------------------------------------------------------------
1 |
17 | You can check the performance of your program here.
18 | The timeout of this interface is 10 seconds.
19 |
20 |
21 |
16 | For problems with the "rejudge" feature, any user can request a
17 | solution to be rejudged. The record will be removed if the challenged
18 | solution failed. This feature is meant to be a solution for luck-based
19 | solutions.
20 |
21 |
22 | To rejudge a solution, click the user name of the record in
23 | question. Fill "golf" to a text box and click the "rejudge" button.
24 |
25 |
26 |
--------------------------------------------------------------------------------
/fe/conf/etc/lighttpd/conf-available/80-golf.conf:
--------------------------------------------------------------------------------
1 | ## FastCGI programs have the same functionality as CGI programs,
2 | ## but are considerably faster through lower interpreter startup
3 | ## time and socketed communication
4 | ##
5 | ## Documentation: /usr/share/doc/lighttpd-doc/fastcgi.txt.gz
6 | ## http://www.lighttpd.net/documentation/fastcgi.html
7 |
8 | server.modules += ( "mod_fastcgi" )
9 |
10 | $HTTP["host"] =~ "^golf\.shinh\.org$" {
11 | server.document-root = "/home/i/ags/fe/fcgi/"
12 | index-file.names = ( "index.rb", "index.php", "index.html",
13 | "index.htm", "index.cgi" )
14 | fastcgi.server = ( ".rb" =>
15 | ((
16 | "bin-path" => "/home/i/ags/fe/fcgi/index.fcgi",
17 | "socket" => "/tmp/fcgiruby.socket",
18 | "max-procs" => 10,
19 | "idle-timeout" => 20,
20 | ))
21 | )
22 | }
23 |
--------------------------------------------------------------------------------
/fe/fcgi/recent.rb:
--------------------------------------------------------------------------------
1 | require 'handler'
2 |
3 | class Recent < Handler
4 | def handle_
5 | html_header
6 | title("anarchy golf - recent entries")
7 | puts %Q(
16 | You can set the PID by this interface.
17 | Note that some PIDs will be consumed by golf system after you set a PID.
18 | The number of PIDs the system consumes depends on the language you are using.
19 | For example, if you set PID=3000 and then you submit a ruby code,
20 | your program's PID would be 3004 in the first run.
21 |
22 | How your program is executed:"
24 | ss = strip_script(File.read("../../be/srv/s/#{ext}"))
25 | if ss =~ /ag_launcher/
26 | puts %Q((note "ag_launcher" below is this script.))
27 | end
28 | puts " How your program is compiled:"
32 | puts "All problems
'
7 |
8 | puts ''
9 | pdb = problem_db
10 | problems = pdb.get('root')
11 | deadlines = pdb.get('deadline')
12 | now = Time.now.to_i
13 | problems.each_with_index do |x, i|
14 | d = deadlines[i]
15 | puts tag('li', problem_summary(x, deadlines[i], now))
16 | end
17 | puts '
'
18 |
19 | foot
20 | end
21 | end
22 |
--------------------------------------------------------------------------------
/fe/fcgi/tools/check_version.rb:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | require 'socket'
4 |
5 | s = TCPSocket.new('192.168.36.2', 9999)
6 | payload = {
7 | :filename => 'version.rb',
8 | :code => File.read('version.rb'),
9 | :inputs => [''],
10 | :testing => true,
11 | }
12 | encoded_payload = Marshal.dump(payload)
13 | s.puts(encoded_payload.size)
14 | s.print(encoded_payload)
15 | s.close_write
16 |
17 | payload = Marshal.load(s.read(s.gets.to_i))
18 | puts payload[:stdout]
19 |
20 | STDERR.puts payload[:stderr]
21 |
22 |
--------------------------------------------------------------------------------
/be/modules/reset.c:
--------------------------------------------------------------------------------
1 | #include '
17 | h.sort{|x,y|y[1]<=>x[1]}.each do |k, v|
18 | puts %Q(
'
21 |
22 | foot
23 | end
24 | end
25 |
--------------------------------------------------------------------------------
/be/srv/ag_launcher.c:
--------------------------------------------------------------------------------
1 | #include Checker
15 |
16 | Rejudge
14 |
15 | recent entries
8 |
)
18 | foot
19 | end
20 | end
21 |
--------------------------------------------------------------------------------
/fe/fcgi/setpid.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
9 | )
10 | db =get_db('recent')
11 | db.get('root').each do |pn, un, ext, cs, time, now, rank, score|
12 | # for removed language
13 | ft = file_types.index(ext)
14 | ft = ft ? file_langs[ft] : '???'
15 | puts %Q(Problem Rank User Lang Size Score Time Date )
16 | end
17 | puts %Q(#{pn} #{rank} #{CGI.escapeHTML(un)} #{ft} #{cs} #{score} #{"%.4f"%time} #{now.strftime('%Y/%m/%d %H:%M:%S')} set PID
14 |
15 | Version info of languages
"
12 |
13 | m = {}
14 | File.readlines('version.txt').each do |line|
15 | / / =~ line
16 | m[$`] = $'
17 | end
18 |
19 | puts ""
20 | sorted_langs.each do |ext, lang|
21 | puts "
" + ss + "
"
29 | c = "../../be/srv/s/_#{ext}"
30 | if File.exist?(c)
31 | puts "" + strip_script(File.read(c)) + "
"
33 | end
34 | puts "
29 | You can check the performance of your program here. 30 | The timeout of this interface is 10 seconds. 31 | 32 |
33 |
41 | 42 | 43 | ) 44 | end 45 | end 46 | -------------------------------------------------------------------------------- /fe/fcgi/bas.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 |16 | The size of non printable characters is disclosed by default. And you can choose to disclose the size of alnum ([0-9A-Za-z]) and symbols. When you want to appeal that you challenged exotic golf such as symbolic golf, disclose your code statistics and change your name like "shinh(symbol)". 17 |
18 | You will see Binary / Alnum / Symbol in statistics column. 19 |
20 | Binary is 0-8 or 11-31 or 127-255. 21 |
22 | Alnum is [0-9A-Za-z]. 23 |
24 | Symbol is [!\"\#$%&'()*+,-./:;<=>?@[\\]^_`{|}~]. 25 |
26 | Note whitespaces ([ \t\n]) does not belong to any classes. 27 | 28 |
29 | The following code is used for this system. 30 | 31 |
32 | def get_statistics(s)
33 | a=[0,0,0,0]
34 | an=/[a-zA-Z0-9]/
35 | ws=/[ \t\n]/
36 | s.each_byte{|x|
37 | s=x.chr
38 | a[an=~s ?2:ws=~s ?1: x<127&&x>32?3:0]+=1
39 | }
40 | a
41 | end
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/fe/fcgi/mkprob.rb:
--------------------------------------------------------------------------------
1 | require 'handler'
2 | require 'fileutils'
3 |
4 | class Mkprob < Handler
5 | def handle_
6 | # if (!develop?)
7 | # raise 'now mkprob.rb is updating'
8 | # end
9 |
10 | q = query
11 |
12 | if q.sport.to_s.downcase != 'golf'
13 | raise 'Your access was denied. Please mail me if you don\'t know the name of your favorite sport.'
14 | end
15 |
16 | t = q.title
17 | err('title is empty') if t == ''
18 | err('description is empty') if q.desc == ''
19 | err('output is empty') if q.output == ''
20 | err('deadline is empty') if q.deadline == ''
21 | err('invalid title (use [a-zA-Z0-9_ ])') if t !~ /^[a-zA-Z0-9_ ]+$/
22 |
23 | d = q.deadline.to_i
24 | deadline = d > 0 ? (Time.now+q.deadline.to_i*60*60).to_i : 0
25 | if q.deadline == 'kaigi'
26 | deadline = 1213956000
27 | end
28 | q['deadline'] = deadline
29 |
30 | db = 'db/' + t
31 | err('already exists') if File.exists?(db)
32 | FileUtils.mkdir db
33 | store(t, q)
34 |
35 | pdb = problem_db
36 | pdb.transaction do
37 | pdb['root'] = [] if !pdb.root?('root')
38 | pdb['root'] << t
39 | pdb['deadline'] << deadline
40 | end
41 |
42 | mircbot("New problem: http://golf.shinh.org#{problem_url(t)}")
43 |
44 | redirect("/")
45 | end
46 | end
47 |
48 |
--------------------------------------------------------------------------------
/be/fetcher/fernando.hs:
--------------------------------------------------------------------------------
1 | import qualified Data.Map as M
2 | import System.Environment (getArgs)
3 |
4 | type Prog = [[String]]
5 | data LabelData = L (M.Map String LabelData) Prog
6 |
7 | value v vs = M.findWithDefault False v vs
8 | x `nand` y = not (x && y)
9 |
10 | runCmds :: M.Map String Bool -> M.Map String LabelData -> [[String]] -> String
11 | runCmds vars labels prog@([label]:rest)
12 | = case (value label vars, M.lookup label labels) of
13 | (True, Just (L labels' prog'))
14 | -> runCmds vars labels' prog'
15 | _ -> runCmds vars labels' rest
16 | where labels' = M.insert label (L labels' rest) labels
17 | runCmds vars labels ([v1,v2,v3]:rest)
18 | = runCmds (M.insert v1 (value v2 vars `nand` value v3 vars) vars)
19 | labels rest
20 | runCmds vars labels (vs@[_,_,_,_,_,_,_,_]:rest)
21 | = c : runCmds vars labels rest
22 | where
23 | c = toEnum $ foldl (\n b -> n*2 + fromEnum (value b vars)) 0 vs
24 | runCmds _ _ [] = ""
25 | runCmds _ _ (snt:_) = error $ "Undefined sentence: " ++ unwords snt
26 |
27 | interpret = runCmds M.empty M.empty . map words . lines
28 |
29 | main = do
30 | args <- getArgs
31 | case args of
32 | [] -> interact interpret
33 | [fileName] -> putStr . interpret =<< readFile fileName
34 | _ -> error "Too many arguments, only one supported"
35 |
--------------------------------------------------------------------------------
/test/t/testing.wr:
--------------------------------------------------------------------------------
1 | 110001100000111100001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011100010011111100011100111000111000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111000100111111000111001110001110000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011100010011111100011100111000111000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011100010011111100
--------------------------------------------------------------------------------
/fe/fcgi/site.css:
--------------------------------------------------------------------------------
1 | BODY {
2 | background-color: #e1e1f1;
3 | color: #000000;
4 | }
5 | A:link {
6 | color: #4430cf;
7 | text-decoration: none;
8 | }
9 | A:visited {
10 | color: #74308a;
11 | text-decoration: none;
12 | }
13 | A:active {
14 | color: #0000ff;
15 | text-decoration: underline;
16 | background-color: #f0f0ff;
17 | }
18 | A:hover {
19 | color: #0000ff;
20 | text-decoration: underline;
21 | background-color: #d5d5f0;
22 | }
23 | H1 {
24 | padding: 7px 30px;
25 | width: 90%;
26 | margin: 20px 0px 30px 0px;
27 | color: #0f0f23;
28 | background-color: #d1d1e1;
29 | font-weight: bold;
30 | text-align: left;
31 | }
32 | H2 {
33 | padding: 10px;
34 | width: 80%;
35 | margin: 20px 3px;
36 | color: #1f0f23;
37 | font-weight: bold;
38 | text-align: left;
39 | border-style: solid;
40 | border-width: 0pt 1pt 1pt 0pt;
41 | border-color: #222233;
42 | }
43 | H3 {
44 | padding: 5px;
45 | width: 70%;
46 | margin: 15px 0px;
47 | color: #0f1f23;
48 | font-weight: bold;
49 | text-align: left;
50 | border-style: solid;
51 | border-width: 0pt 0pt 1pt 0pt;
52 | border-color: #222233;
53 | }
54 | PRE {
55 | margin: 0px 20px;
56 | width: 93%;
57 | color: #101010;
58 | background-color: #d5d5d5;
59 | }
60 | DIV.signature {
61 | text-align: right;
62 | }
63 | DIV.right {
64 | text-align: right;
65 | }
66 | DIV.update {
67 | text-align: right;
68 | font-size: small;
69 | font-style: italic;
70 | }
71 |
72 | table{border:0px;}
73 | th,td{background-color:#e1e1f1;border-top:1px solid #ffffff;border-left:1px solid #ffffff;border-bottom:1px solid #c0c0dd;border-right:1px solid #c0c0dd;}
74 |
75 | .gray {
76 | color: gray;
77 | }
78 |
79 | EM.pm {
80 | color: #ff6060;
81 | font-style: normal;
82 | }
83 |
--------------------------------------------------------------------------------
/test/t/fizz.asm:
--------------------------------------------------------------------------------
1 | BITS 32
2 | ORG 0
3 |
4 | DB 0x7F ; e_ident
5 | entry:
6 | inc ebp ; e_ident 'E'
7 | dec esp ; e_ident 'L'
8 | inc esi ; e_ident 'F'
9 | inc EBX
10 | jmp short _start
11 | fzbz: db "Fizz"
12 | buzz: db "B"
13 | db "uzz",10
14 | buzz_end:
15 | dw 2
16 | dw 3
17 | db "0" ; e_version
18 | num: db "0",10
19 | db 0
20 | add [eax], eax ; e_entry ; p_type
21 | add [eax], al
22 | sbb [eax], al ; e_phoff ; p_offset
23 | add [eax], al
24 | sbb [eax], al ; e_shoff ; p_vaddr
25 | add [eax], al
26 | _fizz:
27 | mov CL, fizz_end
28 | jmp short _fzbz_last
29 | DD 0x00210000-0x18 ; e_ehsize ; p_filesz
30 | ; e_phentsize
31 | DW 0x0001 ; e_phnum ; p_memsz
32 | _buzz_carry:
33 | inc byte [EAX]
34 | mov byte [ECX], 48
35 | _buzz:
36 | mov CL, buzz_end
37 | cmp EDI, EDX
38 | jl short _out
39 |
40 | _fzbz:
41 | mov DL, 9
42 | _fzbz_last:
43 | xor EDI, EDI
44 | jmp short _out
45 |
46 | _start:
47 | mov CL, 100
48 | _loop:
49 | push ECX
50 | mov DL, 5
51 |
52 | inc EDI
53 | inc EDI
54 |
55 | mov CL, num
56 | mov AL, num-1
57 |
58 | inc byte [ECX]
59 |
60 | cmp byte [ECX], 58
61 | je _buzz_carry
62 | cmp byte [ECX], 53
63 | je _buzz
64 |
65 | cmp EDI, EDX
66 | jge _fizz
67 |
68 | mov CL, num+2
69 | mov DL, byte [EAX]
70 | dec EDX
71 | sar EDX, 4
72 | _out:
73 | sub CL, DL
74 | mov AL, 4 ; write = 4
75 | int 0x80
76 |
77 | pop ECX
78 | loop _loop
79 | fizz: db "Fizz",10
80 | fizz_end:
81 |
--------------------------------------------------------------------------------
/fe/fcgi/lranking.rb:
--------------------------------------------------------------------------------
1 | require 'handler'
2 |
3 | class Lranking < Handler
4 | def handle_
5 | html_header
6 | title("anarchy golf - Language Ranking")
7 |
8 | puts tag('h1', "Language Ranking")
9 | puts tag('p', 'The score is the sum of 10000 * min(sizes of all solutions) / min(sizes of solutions in a language) for each problems.')
10 |
11 | lrf = 'db/_lranking.db'
12 | if (!File.exists?(lrf) || File.mtime(lrf) < Time.now-60*60*3)
13 | lr = {}
14 | db = PStore.new(lrf)
15 | db.transaction do
16 | problem_db.get('root').each do |pn|
17 | a=[]
18 | ldb = PStore.new("db/#{pn}/_ranks.db")
19 | ldb.transaction(true) do
20 | file_types.zip(file_langs).each do |ext, lang|
21 | next if !ldb.root?(ext)
22 | l = ldb[ext]
23 | lm = 0
24 | l.each{|x|lm=x[1] if lm==0 || lm>x[1]}
25 | a << [lm,ext]
26 | end
27 | end
28 | a.sort!
29 | next if !a[0]
30 | min = a[0][0]
31 | a.each do |x|
32 | lr[x[1]] = [0, 0] if !lr[x[1]]
33 | if x[0] > 0
34 | lr[x[1]][0] += (10000 * min / x[0]).to_i
35 | lr[x[1]][1] += 1
36 | end
37 | end
38 | end
39 |
40 | db['root'] = []
41 | lr.map.sort{|x,y|y[1][0]<=>x[1][0]}.each do |x,y|
42 | db['root'] << [x, *y]
43 | end
44 | end
45 | end
46 |
47 | db = PStore.new(lrf)
48 | db.transaction(true) do
49 | puts '| Rank | Lang | Score | # | Avg. |
|---|
Read code from argv (incl. STDIN)"
27 | putStrLn ""
28 | putStrLn "\tBurlesque\tRoman Muentener, 2012"
29 | - where settings :: Settings IO
30 | - settings = Settings {
31 | - complete = completeWord Nothing " \t" $ return . search,
32 | - historyFile = Nothing,
33 | - autoAddHistory = True
34 | - }
35 | - search s = map simpleCompletion . filter (s `isPrefixOf`) $ map fst builtins
36 | +-- where settings :: Settings IO
37 | +-- settings = Settings {
38 | +-- complete = completeWord Nothing " \t" $ return . search,
39 | +-- historyFile = Nothing,
40 | +-- autoAddHistory = True
41 | +-- }
42 | +-- search s = map simpleCompletion . filter (s `isPrefixOf`) $ map fst builtins
43 |
44 |
45 |
46 | -burlesqueShell = do
47 | - line <- getInputLine "blsq ) "
48 | - case line of
49 | - Nothing -> outputStrLn "* Abort..." >> return ()
50 | - Just "exit!" -> outputStrLn "* Exit!" >> return()
51 | - Just q -> do outputStr $ runProgramNoStdin q
52 | - burlesqueShell
53 | +--burlesqueShell = do
54 | +-- line <- getInputLine "blsq ) "
55 | +-- case line of
56 | +-- Nothing -> outputStrLn "* Abort..." >> return ()
57 | +-- Just "exit!" -> outputStrLn "* Exit!" >> return()
58 | +-- Just q -> do outputStr $ runProgramNoStdin q
59 | +-- burlesqueShell
60 |
--------------------------------------------------------------------------------
/fe/fcgi/wsdis.pl:
--------------------------------------------------------------------------------
1 | #!/usr/bin/perl
2 |
3 | use bigint;
4 | use re 'eval';
5 |
6 | my %ops = (
7 | 'push' => { 'imp' => 's', 'code' => 's', 'arg' => 'int' },
8 | 'dup' => { 'imp' => 's', 'code' => 'ns', 'arg' => 'void' },
9 | 'copy' => { 'imp' => 's', 'code' => 'ts', 'arg' => 'int' },
10 | 'swap' => { 'imp' => 's', 'code' => 'nt', 'arg' => 'void' },
11 | 'pop' => { 'imp' => 's', 'code' => 'nn', 'arg' => 'void' },
12 | 'slide' => { 'imp' => 's', 'code' => 'tn', 'arg' => 'int' },
13 | 'add' => { 'imp' => 'ts', 'code' => 'ss', 'arg' => 'void' },
14 | 'sub' => { 'imp' => 'ts', 'code' => 'st', 'arg' => 'void' },
15 | 'mul' => { 'imp' => 'ts', 'code' => 'sn', 'arg' => 'void' },
16 | 'div' => { 'imp' => 'ts', 'code' => 'ts', 'arg' => 'void' },
17 | 'mod' => { 'imp' => 'ts', 'code' => 'tt', 'arg' => 'void' },
18 | 'stor' => { 'imp' => 'tt', 'code' => 's', 'arg' => 'void' },
19 | 'retr' => { 'imp' => 'tt', 'code' => 't', 'arg' => 'void' },
20 | 'mark' => { 'imp' => 'n', 'code' => 'ss', 'arg' => 'label' },
21 | 'call' => { 'imp' => 'n', 'code' => 'st', 'arg' => 'label' },
22 | 'jump' => { 'imp' => 'n', 'code' => 'sn', 'arg' => 'label' },
23 | 'jzero' => { 'imp' => 'n', 'code' => 'ts', 'arg' => 'label' },
24 | 'jneg' => { 'imp' => 'n', 'code' => 'tt', 'arg' => 'label' },
25 | 'ret' => { 'imp' => 'n', 'code' => 'tn', 'arg' => 'void' },
26 | 'end' => { 'imp' => 'n', 'code' => 'nn', 'arg' => 'void' },
27 | 'putc' => { 'imp' => 'tn', 'code' => 'ss', 'arg' => 'void' },
28 | 'puti' => { 'imp' => 'tn', 'code' => 'st', 'arg' => 'void' },
29 | 'getc' => { 'imp' => 'tn', 'code' => 'ts', 'arg' => 'void' },
30 | 'geti' => { 'imp' => 'tn', 'code' => 'tt', 'arg' => 'void' },
31 | );
32 |
33 | my %vregex=('void'=>'','int'=>'[st]+n','label'=>'[st]*n');
34 |
35 | sub parseb
36 | {
37 | my $str = shift;
38 | my $blen = length($str) - 2;
39 | my $sign = substr $str, 0, 1, "0b0";
40 | $sign =~ y/st/+-/;
41 | $str =~ y/stn/01/d;
42 | return " $sign" . oct($str) . "(${blen}b)";
43 | }
44 | my (%idic,%cregex);
45 | while ( my ($k,$v)=each %ops )
46 | {
47 | $idic{join'',@{$v}{qw(imp code)}}={inst=>$k,arg=>$v->{arg}};
48 | push @{$cregex{$v->{imp}}},$v->{code};
49 | }
50 | $_=join'|',@$_ for values %cregex;
51 |
52 | my $impregex=join '|',do{my%tmp;@tmp{map$_->{imp},values%ops}=();keys%tmp};
53 | undef $/;
54 | my $enc = <>;
55 | $enc=~y/ \t\n\0-\xff/stn/d;
56 | my $iref;
57 | while ( $enc=~/\G($impregex)((??{$cregex{$1}}))((??{$iref=$idic{"$1$2"};$vregex{$iref->{arg}}}))/g )
58 | {
59 | my $v=$3 eq '' ? '' : $3 eq 'n' ? ' null' : parseb($3);
60 | print $iref->{inst}, $v, "\n";
61 | }
62 |
--------------------------------------------------------------------------------
/fe/fcgi/checker.rb:
--------------------------------------------------------------------------------
1 | require 'handler'
2 | require 'fileutils'
3 |
4 | # multipart handling is from cgi.rb
5 |
6 | class Checker < Handler
7 | def output_filter(s)
8 | escape_binary(CGI.escapeHTML(s.gsub("\r\n","\n")).gsub("\n",%Q(\\n\n)))
9 | end
10 |
11 | def handle_
12 | html_header
13 |
14 | unless ("POST" == @e['REQUEST_METHOD']) and
15 | %r|\Amultipart/form-data.*boundary=\"?([^\";,]+)\"?|n.match(@e['CONTENT_TYPE'])
16 | err('not multipart submission')
17 | end
18 |
19 | boundary = $1.dup
20 | @multipart = true
21 | clen = Integer(@e['CONTENT_LENGTH'])
22 | err('over 10M') if (clen > 10000*1000)
23 | q = read_multipart(boundary, clen)
24 |
25 | begin
26 | fb = q.file.read
27 | fn = q.file.original_filename[/[^\/\\]+$/]
28 | rescue
29 | fb = q.code.read.gsub("\r\n", "\n")
30 | fn = 'test.' + q.ext.read
31 | end
32 |
33 | err("empty file") if fn == '' || fb == ''
34 |
35 | ext = File.extname(fn).tr('.','')
36 | exts = file_types
37 | err("unsupported suffix (#{ext})") if !exts.include?(ext)
38 | err('not ELF binary') if ext=='out' && (fb.size<3||fb[1,3]!='ELF')
39 |
40 | input = q.input.read
41 |
42 | s = execute2(fn, fb, [input], true)
43 |
44 | title("checker - result")
45 | puts tag('h1',"checker - result")
46 |
47 | payload = Marshal.load(s.read(s.gets.to_i))
48 | time = payload[:time]
49 | status = payload[:status]
50 | execnt = payload[:execnt]
51 | o = payload[:stdout]
52 | e = payload[:stderr]
53 |
54 | if !time
55 | time = 'timeout'
56 | else
57 | time = time.to_s
58 | end
59 |
60 | if (time !~ /\d/)
61 | puts tag('p', time)
62 |
63 | puts %Q(your output:
64 |
#{output_filter(o)}
65 | stderr:
66 |
#{CGI.escapeHTML(e.to_s)}
67 | )
68 | else
69 | puts %Q(
70 | size: #{fb.size}
71 | time: #{'%.6f' % time}sec
72 | status: #{status}
73 |
74 | your output:
75 |
#{output_filter(o)}
76 | )
77 | puts %Q(stderr:
78 |
#{CGI.escapeHTML(e.to_s)}
79 | )
80 | end
81 | s.close
82 |
83 | foot
84 | end
85 | end
86 |
87 | if $0 == __FILE__
88 | c = Checker.new
89 | s = c.execute2(ARGV[0], ARGV[1], [''], true)
90 |
91 | payload = Marshal.load(s.read(s.gets.to_i))
92 | time = payload[:time]
93 | status = payload[:status]
94 | execnt = payload[:execnt]
95 | o = payload[:stdout]
96 | e = payload[:stderr]
97 |
98 | print o
99 | STDOUT.flush
100 | STDERR.print e
101 | exit status
102 | end
103 |
--------------------------------------------------------------------------------
/fe/fcgi/mkprob.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | create new problem
7 |
8 |
9 |
10 |
11 |
12 |
13 | create new problem
14 |
15 |
90 |
91 |
92 |
--------------------------------------------------------------------------------
/fe/fcgi/tools/modprob.rb:
--------------------------------------------------------------------------------
1 | DESC=%Q(Implement the cellular automation given by one generation of "rule 30." Strip dead cells (spaces) from beginning and end.
2 |
3 | Each new cell is determined by the previous cell in the same spot and its two neighbors:
4 |
5 | "###" -> " "
6 | "## " -> " "
7 | "# #" -> " "
8 | "# " -> "#"
9 | " ##" -> "#"
10 | " # " -> "#"
11 | " #" -> "#"
12 | " " -> " "
13 |
14 | See http://mathworld.wolfram.com/Rule30.html for more information.)
15 |
16 | DESC=%Q(Implement the cellular automation given by one generation of "rule 30." Strip dead cells (spaces) from beginning and end.
17 |
18 | Each new cell is determined by the previous cell in the same spot and its two neighbors:
19 | "###" -> " "
20 | "## " -> " "
21 | "# #" -> " "
22 | "# " -> "#"
23 | " ##" -> "#"
24 | " # " -> "#"
25 | " #" -> "#"
26 | " " -> " "
27 | See http://mathworld.wolfram.com/Rule30.html for more information.)
28 |
29 | out = ''
30 | 1.upto(0x7f){|i|out << i.chr}
31 |
32 | require 'pstore'
33 | db=PStore.new("db/#{ARGV[0]}.db")
34 | db.transaction do
35 | # puts db['input'].sub!(" \r\n", "\r\n")
36 | # puts db['output']=out
37 | # puts db['desc']+='Thanks leonid for suggesting this challenge!'
38 | # puts db['deadline'] += 4 * 24 * 60 * 60
39 | # puts db['rejudge'] = 1
40 | db['desc'] = %Q(See this description for detail. If there are multiple solutions, output the one which have as many leading positive numbers as possible.
41 |
42 | This problem is a test for the rejudge feature. Hopefully luck-depend solutions won\'t work anymore, though this problem itself wouldn\'t be a good problem because this could be exploitable by embeded solutions.)
43 |
44 |
45 | # puts db['deadline']+=1100000
46 | # puts db['desc']=db['desc']+"
Though I removed solutions which used file input, some of them are interesting. Now it's post-mortem, please resubmit cheat code!"
47 | # db['output3']=" *\r\n *** *\r\n *** ***\r\n ***** *\r\n **** ** *\r\n *** ***\r\n *** ****\r\n ********\r\n ****\r\n ****\r\n ***\r\n ooooooo\r\n ooooo\r\n ooooo"
48 | # db['desc'] += '
-- shinh.'
49 | # x=db['output2']
50 | # puts x.sub!(/b/,'b ')
51 | # db['output2'] = x
52 | # db['desc'].sub!(/
.*/,'')
53 | # db['input3']='-Queens -Diamonds'
54 | # db['desc']+="
Thanks for good challenge, pbx. Is the test case 3 of this problem collect? I'm suspecting it lacks Queens. If so, I will fix and expire all submissions for this problem. Anyway I should add edit-problem feature :("
55 | end
56 |
--------------------------------------------------------------------------------
/fe/fcgi/l.rb:
--------------------------------------------------------------------------------
1 | require 'handler'
2 |
3 | class L < Handler
4 | def handle_
5 | html_header
6 | pn, pa = page
7 | lindex = file_types.index(pa)
8 | if !lindex && !pa.empty?
9 | puts 'page not found'
10 | foot
11 | return
12 | end
13 |
14 | title("anarchy golf - Results by a language")
15 | puts "Results by a language
"
16 | put_by_languages(pa, 'l.rb')
17 |
18 | if pa.empty?
19 | foot
20 | return
21 | end
22 |
23 | puts "#{file_langs[lindex]}
"
24 |
25 | puts %Q(name grep:
26 | max results:
27 |
28 | )
29 |
30 | if !$l_ranks
31 | $l_ranks = {}
32 | end
33 | r = $l_ranks[pa]
34 | nowt = Time.now
35 | now = nowt.to_i
36 | if !r || r[0] < now
37 | html = ''
38 |
39 | problem_db.get('root').each do |p|
40 | ldb = PStore.new("db/#{p}/_ranks.db")
41 |
42 | dl = get_db(p).get('deadline').to_i
43 | pm = (dl > 0 && dl < now) ? 1 : 0
44 |
45 | r = ldb.transaction(true) do
46 | ldb[pa]
47 | end
48 | if r
49 | html += "#{problem_summary(p, dl, now)}
"
50 | html += lranking(pa,r,p,nil,pm)
51 | end
52 | end
53 |
54 | html += tag('p', "Last update: #{nowt.getutc} (#{nowt})")
55 |
56 | r = [now+10*60, html]
57 | $l_ranks[pa] = r
58 | end
59 |
60 | puts r[1]
61 |
62 | puts %Q(
63 |
64 | )
101 |
102 | foot
103 | end
104 | end
105 |
--------------------------------------------------------------------------------
/be/fetcher/fernando.py:
--------------------------------------------------------------------------------
1 | # FerNANDo Interpreter
2 | # Runs fernando programs, used command line style.
3 | # Author: Orange
4 | # Editors: Stop h time, Oerjan, Primo
5 | # Version 0.5
6 |
7 | # You're free to use this code as you wish
8 |
9 | class varfunc(object):
10 | def __init__(self, func): self._func = func
11 | __and__ = lambda self, other: self._func() & other
12 | __rand__ = lambda self, other: other & self._func()
13 | __add__ = lambda self, other: self._func() + other
14 | __radd__ = lambda self, other: other + self._func()
15 | __nonzero__ = lambda self: bool(self._func())
16 |
17 | def FerNANDo(program, no_prng=False):
18 | ''' Run a FerNANDo program '''
19 |
20 | #Split the program into a sequence of lines
21 | p = program.split('\n')
22 |
23 | #Split each line into variables
24 | p = map(lambda a: a.split(), p)
25 |
26 | pc = 0 #program counter
27 | plen = len(p) #program length
28 |
29 | var = {} #variable look-up table
30 | if not no_prng:
31 | var['?'] = varfunc(lambda: random.randint(0, 1)) #PRNG
32 |
33 | while pc < plen:
34 | #Current line
35 | line = p[pc]
36 |
37 | #See how many variables on a line
38 | #If 1, 2, 3, 8, or 9, execute a command
39 | #Check in order of likelihood
40 | count = len(line)
41 | if count == 3 or count == 2: #NAND
42 | #bitwise & instead of 'and' is necessary
43 | #to prevent varfuncs from evaluating twice
44 | var[line[0]] = not (var.get(line[-2], 0) & var.get(line[-1], 0))
45 | elif count == 8: #Output
46 | ascii = 0
47 | for item in line:
48 | #Double the value (<<1) and add the next bit
49 | ascii += ascii + var.get(item, 0)
50 | sys.stdout.write(chr(ascii))
51 | elif count == 1: #Jump
52 | #Var is set and has occurred previously
53 | if bool(var.get(line[0], 0)) and (line in p[:pc]):
54 | #Find the previous occurrence
55 | pc -= p[:pc][::-1].index(line) + 1
56 | elif count == 9: #Read
57 | char = sys.stdin.read(1)
58 | if char:
59 | var[line[0]] = 1
60 | ascii = ord(char)
61 | shift = 7
62 | for item in line[1:]:
63 | var[item] = (ascii >> shift) & 1
64 | shift -= 1
65 | else:
66 | var[line[0]] = 0
67 | elif count==0: #Empty
68 | pass
69 | else:
70 | sys.stderr.write('Error: Undefined sentence on line %d: '%(pc+1) + ' '.join(line))
71 | sys.exit(1)
72 | pc += 1
73 |
74 | import sys, random, argparse
75 |
76 | try:
77 | parser = argparse.ArgumentParser(description='Run a FerNANDo program')
78 | parser.add_argument('progname', metavar='progtorun.nand', type=str,
79 | help='the filename of the FerNANDo program to run')
80 | parser.add_argument('--no-prng', dest='no_prng', action='store_true',
81 | help="disable the PRNG bit variable '?' (leave it unset)")
82 | args = parser.parse_args()
83 |
84 | f = open(args.progname)
85 | prog = f.read()
86 | f.close()
87 | FerNANDo(prog, args.no_prng)
88 | except IOError:
89 | sys.stderr.write("Error: Can't open file '%s'"%args.progname)
90 | sys.exit(1)
91 |
--------------------------------------------------------------------------------
/fe/fcgi/u.rb:
--------------------------------------------------------------------------------
1 | require 'handler'
2 |
3 | class U < Handler
4 | class User
5 | attr_accessor :count, :score, :all_count, :no1_count
6 | def initialize
7 | @count = @score = @all_count = @no1_count = 0
8 | end
9 | end
10 |
11 | def aggregate(l, dl, um)
12 | return if l.empty?
13 |
14 | best = l[0][1]
15 |
16 | seen = {}
17 | l.each do |v|
18 | if dl > 0 && dl < v[3].to_i
19 | next
20 | end
21 |
22 | un = v[0].sub(/\s*\(.*/, '')
23 | #un = v[0]
24 | next if seen[un]
25 | seen[un] = true
26 |
27 | un = CGI.escapeHTML(un)
28 | um[un] = User.new if !um[un]
29 |
30 | um[un].count += 1
31 | score = (best * 10000 / v[1]).to_i
32 | um[un].score += score
33 | um[un].no1_count += 1 if score == 10000
34 | end
35 | end
36 |
37 | def handle_
38 | html_header
39 | pn, pa = page
40 |
41 | lang_name = 'Overall'
42 | if !pa.empty?
43 | lindex = file_types.index(pa)
44 | if !lindex
45 | puts 'page not found'
46 | foot
47 | return
48 | end
49 | lang_name = file_langs[lindex]
50 | end
51 |
52 | title("anarchy golf - user ranking: " + lang_name)
53 | puts "User ranking
"
54 |
55 | put_by_languages(pa, 'u.rb', [['', 'Overall']])
56 |
57 | puts "#{lang_name}
"
58 | puts "The score is the sum of 10000 * <size of best solution> / <size of your solution> for each problems. Only submissions before the deadline are considered if the problem has the deadline. Parentheses after your name will be removed before the aggregation. If you submitted multiple solutions into a problem, the better one will be calculated. (E.g., suppose you submitted as \"shinh (cheat)\" and \"shinh\" and earned 10000 and 8000, respectively. Then, your total score will be added by 10000)"
59 | puts "
This ranking is not fair (especially for new comers). Please don't consider this so seriously, the intention of this ranking is to show how eager you are golfing :)"
60 | puts "
"
61 |
62 | if !$u_ranks
63 | $u_ranks = {}
64 | end
65 | r = $u_ranks[pa]
66 | nowt = Time.now
67 | now = nowt.to_i
68 | if !r || r[0] < now
69 | um = {}
70 | problem_db.get('root').each do |p|
71 | ldb = PStore.new("db/#{p}/_ranks.db")
72 |
73 | dl = get_db(p).get('deadline').to_i
74 |
75 | if pa.empty?
76 | file_types.each do |_|
77 | l = ldb.transaction(true) do
78 | ldb[_]
79 | end
80 | if l
81 | aggregate(l, dl, um)
82 | end
83 | end
84 | else
85 | l = ldb.transaction(true) do
86 | ldb[pa]
87 | end
88 | if l
89 | aggregate(l, dl, um)
90 | end
91 | end
92 | end
93 | $u_ranks[pa] = [now+60*60, um.sort_by{|un, u|-u.score}]
94 | end
95 |
96 | puts %Q(Rank User Score Entries Avg # of 10000 )
97 | um = $u_ranks[pa][1]
98 | rank = 0
99 | um.each do |un, u|
100 | next if u.count < 2
101 | avg = u.score / u.count
102 | puts %Q(#{rank+=1} #{un} #{u.score} #{u.count} #{avg} #{u.no1_count} )
103 | end
104 | puts %Q(
)
105 |
106 | lu = Time.at($u_ranks[pa][0])
107 | puts tag('p', "Last update: #{lu.getutc} (#{lu})")
108 |
109 | foot
110 | end
111 | end
112 |
--------------------------------------------------------------------------------
/be/Makefile:
--------------------------------------------------------------------------------
1 | TARGETS := \
2 | /golf/local/dmd2/bin/dmd \
3 | /golf/local/dmd/linux/bin/dmd \
4 | /usr/local/bin/goruby-1.9 \
5 | /golf/local/j602 \
6 | /usr/local/bin/xgawk \
7 | /usr/local/bin/cyc \
8 | /usr/local/bin/kite \
9 | /golf/local/arc3/as2.scm \
10 | /golf/local/gobin/8l \
11 | /golf/local/fernando.py \
12 | /golf/local/FlogScript.php \
13 | /golf/local/wake/wake \
14 | /golf/local/dosemu.tgz \
15 | /golf/local/euphoria/bin/exu \
16 | /golf/local/kona/k \
17 | /golf/local/npiet-1.3a/npiet \
18 | /golf/local/malbolge \
19 | /golf/local/snobol4-1.4.1/snobol4 \
20 | /golf/local/Burlesque/main_golf \
21 | /golf/local/rust/bin/rustc \
22 | /golf/local/chapel-1.7.0/bin/linux32/chpl \
23 | /golf/local/SQUIRREL3/bin/sq \
24 | /golf/local/ccbi-2.1/ccbi \
25 | /golf/local/MNNBFSL/mnnbfsl \
26 | /golf/local/gs2/gs2.py \
27 | /golf/local/caheui/aheui \
28 | /golf/local/fish \
29 | /golf/local/crystal/bin/crystal \
30 | /golf/local/hexagony/hexagony.rb \
31 | /golf/local/labyrinth/interpreter.rb \
32 | /golf/local/Brainfuck/tritium/bfi \
33 | /usr/local/bin/ghc-8.0.2 \
34 | /golf/local/jellylanguage/jelly/__main__.py \
35 | /golf/local/nibbles/nibbles \
36 | /golf/local/jq16 \
37 | /golf/local/iogii
38 |
39 | #/golf/local/dmd2/linux/bin/dmd \
40 |
41 | all: $(TARGETS)
42 | make -C modules
43 | git archive HEAD srv | tar -C / -xvf -
44 | cd /golf && make
45 | chmod +s /golf/remount
46 |
47 | #/golf/local/dmd2/linux/bin/dmd:
48 | /golf/local/dmd2/bin/dmd:
49 | fetcher/d2
50 |
51 | /golf/local/dmd/linux/bin/dmd:
52 | fetcher/d
53 |
54 | /usr/local/bin/goruby-1.9:
55 | fetcher/grb
56 |
57 | /golf/local/j602:
58 | fetcher/j
59 |
60 | /usr/local/bin/xgawk:
61 | fetcher/xgawk
62 |
63 | /usr/local/bin/cyc:
64 | fetcher/curry
65 |
66 | /usr/local/bin/kite:
67 | fetcher/kt
68 |
69 | /golf/local/arc3/as2.scm:
70 | fetcher/arc
71 |
72 | /golf/local/gobin/8l:
73 | fetcher/go
74 |
75 | /golf/local/fernando.py: fetcher/fernando.py
76 | cp $< $@
77 | chmod 755 $@
78 |
79 | /golf/local/FlogScript.php: fetcher/FlogScript.php
80 | cp $< $@
81 | chmod 755 $@
82 |
83 | /golf/local/wake/wake:
84 | fetcher/wake
85 |
86 | /golf/local/dosemu.tgz: fetcher/dosemu.tgz
87 | cp $^ $@
88 |
89 | /golf/local/euphoria/bin/exu:
90 | fetcher/exu
91 |
92 | /golf/local/kona/k:
93 | fetcher/k
94 |
95 | /golf/local/npiet-1.3a/npiet:
96 | fetcher/piet
97 |
98 | /golf/local/malbolge:
99 | fetcher/mb
100 |
101 | /golf/local/snobol4-1.4.1/snobol4:
102 | fetcher/sno
103 |
104 | /golf/local/Burlesque/main_golf:
105 | fetcher/blsq
106 |
107 | /golf/local/rust/bin/rustc:
108 | fetcher/rust
109 |
110 | /golf/local/chapel-1.7.0/bin/linux32/chpl:
111 | fetcher/chpl
112 |
113 | /golf/local/SQUIRREL3/bin/sq:
114 | fetcher/nut
115 |
116 | /golf/local/ccbi-2.1/ccbi:
117 | fetcher/bef98
118 |
119 | /golf/local/MNNBFSL/mnnbfsl:
120 | fetcher/bfsl
121 |
122 | /golf/local/gs2/gs2.py:
123 | fetcher/gs2
124 |
125 | /golf/local/caheui/aheui:
126 | fetcher/aheui
127 |
128 | /golf/local/fish:
129 | fetcher/fsh
130 |
131 | /golf/local/crystal/bin/crystal:
132 | fetcher/cr
133 |
134 | /golf/local/hexagony/hexagony.rb:
135 | fetcher/hxg
136 |
137 | /golf/local/labyrinth/interpreter.rb:
138 | fetcher/lab
139 |
140 | /golf/local/Brainfuck/tritium/bfi:
141 | fetcher/bf8
142 |
143 | /usr/local/bin/ghc-8.0.2:
144 | fetcher/hs
145 |
146 | /golf/local/jellylanguage/jelly/__main__.py:
147 | fetcher/jelly
148 |
149 | /golf/local/nibbles/nibbles:
150 | fetcher/nbb
151 |
152 | /golf/local/jq16: fetcher/jq16
153 | cp $< $@
154 |
155 | /usr/local/bin/ruby3.2: fetcher/rb3
156 | fetcher/rb3
157 |
158 | /golf/local/atlas/atlas.rb: fetcher/atl /usr/local/bin/ruby3.2
159 | fetcher/atl
160 |
161 | /golf/local/iogii: fetcher/iog
162 | fetcher/iog
163 |
--------------------------------------------------------------------------------
/fe/fcgi/rejudge.rb:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | require './handler'
4 |
5 | class Rejudge < Handler
6 | def rejudge_impl(pn, lang, un, time, rejudge=nil)
7 | record_key = "#{un}_#{time.to_i}"
8 | code = File.read("../code/#{pn}/#{record_key}")
9 |
10 | fn = "test.#{lang}"
11 | if File.exist? "../code/#{pn}/#{record_key}_fn"
12 | fn = File.read("../code/#{pn}/#{record_key}_fn")
13 | end
14 |
15 | db = PStore.new("db/#{pn}.db")
16 | title, desc, input, output, i2, o2, i3, o3, dexec, dl, rj =
17 | db.get('title', 'desc', 'input', 'output',
18 | 'input2', 'output2', 'input3', 'output3', 'dexec', 'deadline',
19 | 'rejudge')
20 | dexec = dexec == 'on' ? 1 : dexec.to_i
21 | if !rejudge
22 | rejudge = rj.to_i
23 | end
24 | if rejudge == 0
25 | return nil
26 | end
27 |
28 | inputs = [input]
29 | outputs = [output]
30 | if o2 && o2 != ''
31 | inputs << i2
32 | outputs << o2
33 | end
34 | if o3 && o3 != ''
35 | inputs << i3
36 | outputs << o3
37 | end
38 |
39 | ok = true
40 | s = execute2(fn, code, inputs, false, true)
41 | outputs.each do |output|
42 | payload = Marshal.load(s.read(s.gets.to_i))
43 | time = payload[:time]
44 | status = payload[:status]
45 | execnt = payload[:execnt]
46 | o = payload[:stdout]
47 | e = payload[:stderr]
48 |
49 | output = output.gsub("\r\n","\n").rstrip
50 | o = o.gsub("\r\n","\n").rstrip
51 | if o != output
52 | #STDERR.puts "#{record_key}: FAIL"
53 | ok = false
54 | else
55 | #STDERR.puts "#{record_key}: OK"
56 | end
57 | end
58 |
59 | ok
60 | end
61 |
62 | def rejudge(pn, lang, rank)
63 | ldb = PStore.new("db/#{pn}/_ranks.db")
64 | record = ldb.transaction(true) do
65 | ldb[lang][rank.to_i]
66 | end
67 |
68 | ok = rejudge_impl(pn, lang, record[0], record[3])
69 |
70 | if !ok
71 | ldb.transaction do
72 | STDERR.puts ldb[lang].delete_at(rank)
73 | end
74 | end
75 | end
76 |
77 | def handle_
78 | q = query
79 |
80 | if q.sport.to_s.downcase != 'golf'
81 | raise 'Your access was denied. Please mail me if you don\'t know the name of your favorite sport.'
82 | end
83 |
84 | pn = CGI.unescapeHTML(q.pn)
85 | un = CGI.unescapeHTML(q.un)
86 | lang = q.lang
87 | time = q.time.to_i
88 |
89 | html_header
90 | title("anarchy golf - rejudge for #{pn}")
91 |
92 | res = rejudge_impl(pn, lang, un, time)
93 | if res.nil?
94 | puts 'Rejudge is not enabled for this problem'
95 | elsif res
96 | puts 'Challenge failed'
97 | else
98 | ldb = PStore.new("db/#{pn}/_ranks.db")
99 | ldb.transaction do
100 | found_index = nil
101 | ldb[lang].each_with_index{|r, i|
102 | if r[3].to_i == time
103 | found_index = i
104 | break
105 | end
106 | }
107 | if !found_index
108 | puts 'Already challenged?'
109 | return
110 | end
111 |
112 | ldb[lang].delete_at(found_index)
113 | end
114 | puts 'Challenge succeeded'
115 | end
116 | end
117 |
118 | end
119 |
120 | if $0 == __FILE__
121 | pn, lang, rank = ARGV
122 | if !pn
123 | puts "Usage: #$0 [lang] [rank]"
124 | exit
125 | end
126 |
127 | lang_ranks = []
128 | if lang && rank
129 | lang_ranks = [[lang, rank]]
130 | else
131 | ldb = PStore.new("db/#{pn}/_ranks.db")
132 | ldb.transaction(true) do
133 | ldb.roots.each do |lang|
134 | ldb[lang].each_with_index do |rank, i|
135 | lang_ranks << [lang, i]
136 | end
137 | end
138 | end
139 | end
140 |
141 | lang_ranks.reverse.each do |lang, rank|
142 | rejudge = Rejudge.new
143 | rejudge.rejudge(pn, lang, rank)
144 | end
145 | end
146 |
--------------------------------------------------------------------------------
/fe/fcgi/p.rb:
--------------------------------------------------------------------------------
1 | require 'handler'
2 |
3 | class P < Handler
4 | def show_input(i,c)
5 | puts tag('h2', 'Sample input:'+a("#test#{c}",'_',"test#{c}"))
6 | puts i == '' ? tag('p', '*NOTHING*') : tag('pre', "\n" + CGI.escapeHTML(i))
7 | end
8 |
9 | def show_output(o)
10 | puts tag('h2', 'Sample output:')
11 | puts tag('pre', "\n" + CGI.escapeHTML(o))
12 | end
13 |
14 | def handle_
15 | html_header
16 | pn, pa = page
17 | if pn == '' || !File.exist?('db/' + pn + '.db')
18 | puts 'page not found'
19 | foot
20 | return
21 | end
22 |
23 | title("anarchy golf - " + pn)
24 |
25 | puts %Q(
26 |
32 | )
33 |
34 | db = get_db(pn)
35 | t, d, i, o, i2, o2, i3, o3, de, dl, rejudge =
36 | db.get('title', 'desc', 'input', 'output',
37 | 'input2', 'output2', 'input3', 'output3',
38 | 'dexec', 'deadline', 'rejudge')
39 | de = de == 'on' ? 1 : de.to_i
40 | dl = dl.to_i
41 | now = Time.now.to_i
42 | pm = (dl > 0 && dl < now) ? 1 : 0
43 | rejudge = dl == 0 ? 0 : rejudge.to_i
44 |
45 | if dl > 0 && pm == 0 && dl - 60*60*24 < now
46 | if !db.get('announced')
47 | mircbot("Near deadline: http://golf.shinh.org#{problem_url(t)}")
48 | db.transaction do
49 | db['announced'] = true
50 | end
51 | end
52 | end
53 |
54 | puts tag('h1', t)
55 |
56 | puts %Q(Submit
57 |
58 |
68 |
69 | )
70 |
71 | #puts 'Language is selected by extension. Supported types are:
'
72 | #puts (file_types.zip(file_langs).map{|x, y|
73 | # "#{y}(#{x})"
74 | # }*', ')
75 | #puts '
'
76 | puts 'Language is selected by the extension of the file. See the list of supported languages to know the extension of your language.
'
77 |
78 | puts tag('h2', 'Problem')
79 | puts tag('p', CGI.escapeHTML(d).gsub(/\r\n|\n/,"
"))
80 | #puts tag('p', d.gsub(/\r\n|\n/,"
"))
81 | puts tag('h2', 'Options')
82 | if de == 2
83 | puts %Q(exec is denied (using strict filter)
)
84 | elsif de == 1
85 | puts %Q(exec is denied
)
86 | end
87 | if rejudge == 1
88 | puts %Q(rejudge feature is enabled
)
89 | end
90 |
91 | if dl > 0
92 | dl = (dlorig=dl) - now
93 | if dl > 0
94 | puts %Q(#{time_diff(dl)} before deadline (#{Time.at(dlorig).strftime('%m/%d %H:%M:%S JST')}), all source codes will be revealed after the deadline
)
95 | else
96 | puts %Q(now post-mortem time, all source codes will be revealed
)
97 | end
98 | else
99 | puts %Q(no deadline, the server will not save your submission
)
100 | end
101 |
102 | show_input(i,1)
103 | show_output(o)
104 | if o2 && o2 != ''
105 | show_input(i2,2) if i2 != ''
106 | show_output(o2)
107 | end
108 | if o3 && o3 != ''
109 | show_input(i3,3) if i3 != ''
110 | show_output(o3)
111 | end
112 |
113 | html, lr = *ranking(pn, nil, pm, rejudge)
114 | puts html
115 |
116 | if lr.size > 0
117 | puts tag('h3', 'Language Ranking'+a("#ranking",'_',"ranking"))
118 | puts %Q(Rank Lang User Size Score )
119 | i = 0
120 | lr = lr.sort_by{|x|x[1]}
121 | min = lr[0][1][0]
122 | lr.each do |k, v|
123 | puts %Q(#{i+=1} #{ext2lang(k)} #{CGI.escapeHTML(v[2])} #{v[0]} #{(10000*min/v[0]).to_i} )
124 | end
125 | puts %Q(
)
126 | end
127 |
128 | if File.exist?("db/#{pn}/_refer.db")
129 | puts %Q(Referer
130 | Note that, they may contain spoilers.
131 | )
132 | rdb = PStore.new("db/#{pn}/_refer.db")
133 | rdb.transaction(true) do
134 | rdb.roots.select{|r|rdb[r]}.sort do |a,b|
135 | rdb[a] <=> rdb[b]
136 | end.each do |r|
137 | if !r.index('shinh.org') # ad-hoc
138 | puts %Q(- #{r})
139 | end
140 | end
141 | end
142 | puts %Q(
)
143 | end
144 |
145 | foot
146 | end
147 |
148 | end
149 |
--------------------------------------------------------------------------------
/be/fetcher/malbolge.c:
--------------------------------------------------------------------------------
1 | /* Interpreter for Malbolge. */
2 | /* '98 Ben Olmstead. */
3 | /* */
4 | /* Malbolge is the name of Dante's Eighth circle of Hell. This */
5 | /* interpreter isn't even Copylefted; I hereby place it in the public */
6 | /* domain. Have fun... */
7 | /* */
8 | /* Note: in keeping with the idea that programming in Malbolge is */
9 | /* meant to be hell, there is no debugger. */
10 | /* */
11 | /* By the way, this code assumes that short is 16 bits. I haven't */
12 | /* seen any case where it isn't, but it might happen. If short is */
13 | /* longer than 16 bits, it will still work, though it will take up */
14 | /* considerably more memory. */
15 | /* */
16 | /* If you are compiling with a 16-bit Intel compiler, you will need */
17 | /* >64K data arrays; this means using the HUGE memory model on most */
18 | /* compilers, but MS C, as of 8.00, possibly earlier as well, allows */
19 | /* you to specify a custom memory-model; the best model to choose in */
20 | /* this case is /Ashd (near code, huge data), I think. */
21 |
22 | #include
23 | #include
24 | #include
25 | #include
26 | #include
27 |
28 | #ifdef __GNUC__
29 | static inline
30 | #endif
31 | void exec( unsigned short *mem );
32 |
33 | #ifdef __GNUC__
34 | static inline
35 | #endif
36 | unsigned short op( unsigned short x, unsigned short y );
37 |
38 | const char xlat1[] =
39 | "+b(29e*j1VMEKLyC})8&m#~W>qxdRp0wkrUo[D7,XTcA\"lI"
40 | ".v%{gJh4G\\-=O@5`_3iU!pJS72FhOA1C"
44 | "B6v^=I_0/8|jsb9m<.TVac`uY*MK'X~xDl}REokN:#?G\"i@";
45 |
46 | int main( int argc, char **argv )
47 | {
48 | FILE *f;
49 | unsigned short i = 0, j;
50 | int x;
51 | unsigned short *mem;
52 | if ( argc != 2 )
53 | {
54 | fputs( "invalid command line\n", stderr );
55 | return ( 1 );
56 | }
57 | if ( ( f = fopen( argv[1], "r" ) ) == NULL )
58 | {
59 | fputs( "can't open file\n", stderr );
60 | return ( 1 );
61 | }
62 | #ifdef _MSC_VER
63 | mem = (unsigned short *)_halloc( 59049, sizeof(unsigned short) );
64 | #else
65 | mem = (unsigned short *)malloc( sizeof(unsigned short) * 59049 );
66 | #endif
67 | if ( mem == NULL )
68 | {
69 | fclose( f );
70 | fputs( "can't allocate memory\n", stderr );
71 | return ( 1 );
72 | }
73 | while ( ( x = getc( f ) ) != EOF )
74 | {
75 | if ( isspace( x ) ) continue;
76 | if ( x < 127 && x > 32 )
77 | {
78 | if ( strchr( "ji*p 126 ) continue;
119 | switch ( xlat1[( mem[c] - 33 + c ) % 94] )
120 | {
121 | case 'j': d = mem[d]; break;
122 | case 'i': c = mem[d]; break;
123 | case '*': a = mem[d] = mem[d] / 3 + mem[d] % 3 * 19683; break;
124 | case 'p': a = mem[d] = op( a, mem[d] ); break;
125 | case '<':
126 | #if '\n' != 10
127 | if ( x == 10 ) putc( '\n', stdout ); else
128 | #endif
129 | putc( a, stdout );
130 | break;
131 | case '/':
132 | x = getc( stdin );
133 | #if '\n' != 10
134 | if ( x == '\n' ) a = 10; else
135 | #endif
136 | if ( x == EOF ) a = 59048; else a = x;
137 | break;
138 | case 'v': return;
139 | }
140 | mem[c] = xlat2[mem[c] - 33];
141 | if ( c == 59048 ) c = 0; else c++;
142 | if ( d == 59048 ) d = 0; else d++;
143 | }
144 | }
145 |
146 | #ifdef __GNUC__
147 | static inline
148 | #endif
149 | unsigned short op( unsigned short x, unsigned short y )
150 | {
151 | unsigned short i = 0, j;
152 | static const unsigned short p9[5] =
153 | { 1, 9, 81, 729, 6561 };
154 | static const unsigned short o[9][9] =
155 | {
156 | { 4, 3, 3, 1, 0, 0, 1, 0, 0 },
157 | { 4, 3, 5, 1, 0, 2, 1, 0, 2 },
158 | { 5, 5, 4, 2, 2, 1, 2, 2, 1 },
159 | { 4, 3, 3, 1, 0, 0, 7, 6, 6 },
160 | { 4, 3, 5, 1, 0, 2, 7, 6, 8 },
161 | { 5, 5, 4, 2, 2, 1, 8, 8, 7 },
162 | { 7, 6, 6, 7, 6, 6, 4, 3, 3 },
163 | { 7, 6, 8, 7, 6, 8, 4, 3, 5 },
164 | { 8, 8, 7, 8, 8, 7, 5, 5, 4 },
165 | };
166 | for ( j = 0; j < 5; j++ )
167 | i += o[y / p9[j] % 9][x / p9[j] % 9] * p9[j];
168 | return ( i );
169 | }
170 |
171 |
--------------------------------------------------------------------------------
/fe/fcgi/reveal.rb:
--------------------------------------------------------------------------------
1 | require 'handler'
2 |
3 | class Reveal < Handler
4 | def handle_
5 | query = @e['QUERY_STRING']
6 | query.sub!(/&(.*)/,'')
7 | lang = $1
8 | q = CGI.unescape(query)
9 | q.sub!('/plain','')
10 | plain = $&
11 |
12 | q =~ /^([^\/]*)\/(.*)[\/_](\d+)$/
13 | pn = $1
14 | un = $2
15 | time = $3
16 | db = get_db(pn)
17 | dl = db.get('deadline')
18 | dl = dl.to_i
19 | pm = (dl > 0 && dl < Time.now.to_i) ? 1 : 0
20 | rejudge = dl == 0 ? 0 : db.get('rejudge').to_i
21 |
22 | #f = "../code/#{q.tr('/','_').sub('_','/')}"
23 | f = "../code/#{pn}/#{un.gsub('/','%2F')}_#{time}"
24 | #if q.count('/') == 2
25 | # f[f.rindex('/')] = '_'
26 | #end
27 | err("invalid query") if !File.file?(f)
28 |
29 | code = File.read(f)
30 |
31 | un = CGI.escapeHTML(un)
32 |
33 | if plain && pm == 1
34 | text_header
35 | print code
36 | else
37 | html_header
38 |
39 | title("anarchy golf - the source code")
40 |
41 | plink = %Q(#{pn})
42 | puts tag('h2', plink + " by " + un)
43 |
44 | if pm == 0
45 | puts %Q(not opened yet)
46 | else
47 | puts %Q(#{escape_binary(CGI.escapeHTML(code))})
48 |
49 | puts %Q(Note that non-ascii characters in the above source code will be escaped (such as \\x9f).
)
50 | if lang == 'lamb'
51 | # puts 'Disassemble:
'
52 | # IO.popen("ruby lamd '#{f}'") do |pipe|
53 | # puts pipe.read
54 | # end
55 | # puts ''
56 | elsif lang == 'ws'
57 | puts 'Disassemble:
'
58 | IO.popen("perl wsdis.pl '#{f}'") do |pipe|
59 | puts pipe.read
60 | end
61 | puts ''
62 | elsif lang == 'jelly'
63 | puts 'Disassemble:
'
64 | jelly_code_page = ["\xC2\xA1", "\xC2\xA2", "\xC2\xA3", "\xC2\xA4", "\xC2\xA5", "\xC2\xA6", "\xC2\xA9", "\xC2\xAC", "\xC2\xAE", "\xC2\xB5", "\xC2\xBD", "\xC2\xBF", "\xE2\x82\xAC", "\xC3\x86", "\xC3\x87", "\xC3\x90", "\xC3\x91", "\xC3\x97", "\xC3\x98", "\xC5\x92", "\xC3\x9E", "\xC3\x9F", "\xC3\xA6", "\xC3\xA7", "\xC3\xB0", "\xC4\xB1", "\xC8\xB7", "\xC3\xB1", "\xC3\xB7", "\xC3\xB8", "\xC5\x93", "\xC3\xBE", " ", "!", "\"", "#", "$", "%", "&", "'", "(", ")", "*", "+", ",", "-", ".", "/", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ":", ";", "<", "=", ">", "?", "@", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "[", "\\", "]", "^", "_", "`", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "{", "|", "}", "~", "\xC2\xB6", "\xC2\xB0", "\xC2\xB9", "\xC2\xB2", "\xC2\xB3", "\xE2\x81\xB4", "\xE2\x81\xB5", "\xE2\x81\xB6", "\xE2\x81\xB7", "\xE2\x81\xB8", "\xE2\x81\xB9", "\xE2\x81\xBA", "\xE2\x81\xBB", "\xE2\x81\xBC", "\xE2\x81\xBD", "\xE2\x81\xBE", "\xC6\x81", "\xC6\x87", "\xC6\x8A", "\xC6\x91", "\xC6\x93", "\xC6\x98", "\xE2\xB1\xAE", "\xC6\x9D", "\xC6\xA4", "\xC6\xAC", "\xC6\xB2", "\xC8\xA4", "\xC9\x93", "\xC6\x88", "\xC9\x97", "\xC6\x92", "\xC9\xA0", "\xC9\xA6", "\xC6\x99", "\xC9\xB1", "\xC9\xB2", "\xC6\xA5", "\xCA\xA0", "\xC9\xBC", "\xCA\x82", "\xC6\xAD", "\xCA\x8B", "\xC8\xA5", "\xE1\xBA\xA0", "\xE1\xB8\x84", "\xE1\xB8\x8C", "\xE1\xBA\xB8", "\xE1\xB8\xA4", "\xE1\xBB\x8A", "\xE1\xB8\xB2", "\xE1\xB8\xB6", "\xE1\xB9\x82", "\xE1\xB9\x86", "\xE1\xBB\x8C", "\xE1\xB9\x9A", "\xE1\xB9\xA2", "\xE1\xB9\xAC", "\xE1\xBB\xA4", "\xE1\xB9\xBE", "\xE1\xBA\x88", "\xE1\xBB\xB4", "\xE1\xBA\x92", "\xC8\xA6", "\xE1\xB8\x82", "\xC4\x8A", "\xE1\xB8\x8A", "\xC4\x96", "\xE1\xB8\x9E", "\xC4\xA0", "\xE1\xB8\xA2", "\xC4\xB0", "\xC4\xBF", "\xE1\xB9\x80", "\xE1\xB9\x84", "\xC8\xAE", "\xE1\xB9\x96", "\xE1\xB9\x98", "\xE1\xB9\xA0", "\xE1\xB9\xAA", "\xE1\xBA\x86", "\xE1\xBA\x8A", "\xE1\xBA\x8E", "\xC5\xBB", "\xE1\xBA\xA1", "\xE1\xB8\x85", "\xE1\xB8\x8D", "\xE1\xBA\xB9", "\xE1\xB8\xA5", "\xE1\xBB\x8B", "\xE1\xB8\xB3", "\xE1\xB8\xB7", "\xE1\xB9\x83", "\xE1\xB9\x87", "\xE1\xBB\x8D", "\xE1\xB9\x9B", "\xE1\xB9\xA3", "\xE1\xB9\xAD", "\xC2\xA7", "\xC3\x84", "\xE1\xBA\x89", "\xE1\xBB\xB5", "\xE1\xBA\x93", "\xC8\xA7", "\xE1\xB8\x83", "\xC4\x8B", "\xE1\xB8\x8B", "\xC4\x97", "\xE1\xB8\x9F", "\xC4\xA1", "\xE1\xB8\xA3", "\xC5\x80", "\xE1\xB9\x81", "\xE1\xB9\x85", "\xC8\xAF", "\xE1\xB9\x97", "\xE1\xB9\x99", "\xE1\xB9\xA1", "\xE1\xB9\xAB", "\xE1\xBA\x87", "\xE1\xBA\x8B", "\xE1\xBA\x8F", "\xC5\xBC", "\xC2\xAB", "\xC2\xBB", "\xE2\x80\x98", "\xE2\x80\x99", "\xE2\x80\x9C", "\xE2\x80\x9D"]
65 | puts code.bytes.map{|c|jelly_code_page[c]}.join
66 | puts ''
67 | elsif lang == 'z8b'
68 | puts 'Disassemble:
'
69 | IO.popen("/usr/bin/z80dasm -a -t -g 0 '#{f}'") do |pipe|
70 | 3.times{pipe.gets}
71 | puts pipe.read.upcase
72 | end
73 | puts ''
74 | elsif lang == 'nbb'
75 | require 'tempfile'
76 | tmp = Tempfile.new(["nibbles",".nbb"])
77 | tmp.write(code)
78 | tmp.close
79 |
80 | puts 'Disassemble:
'
81 | IO.popen("./nibbles -e '#{tmp.path}'") do |pipe|
82 | puts CGI.escapeHTML(pipe.read)
83 | end
84 | puts ''
85 | url = "http://www.tailsteam.com/cgi-bin/nbbdag/commenter.pl?#{query}"
86 | puts %Q(Disassemble it with Nibbles Commenter)
87 | elsif lang == 'out'
88 | puts '
Disassemble:
'
89 | IO.popen("objdump -D -b binary -m i386 '#{f}'") do |pipe|
90 | 5.times{pipe.gets}
91 | puts pipe.read
92 | end
93 | puts ''
94 | # puts 'ELF info:
'
95 | # IO.popen("readelf -h '#{f}'") do |pipe|
96 | # puts pipe.read
97 | # end
98 | # puts ''
99 | elsif lang == 'gs2'
100 | url = "http://www.tailsteam.com/cgi-bin/gs2dag/disas.pl?#{query}"
101 | puts %Q(Disassemble it with gs2 Decompiler)
102 | end
103 | end
104 |
105 | if rejudge == 1
106 | puts %Q(
107 |
)
114 | end
115 |
116 | puts %Q()
117 |
118 | foot
119 | end
120 | end
121 | end
122 |
--------------------------------------------------------------------------------
/fe/conf/etc/xen-tools/ux.conf:
--------------------------------------------------------------------------------
1 | ##
2 | # /etc/xen-tools/xen-tools.conf
3 | ##
4 | #
5 | # This is the global configuration file for the scripts included
6 | # within the xen-tools package.
7 | #
8 | # For more details please see:
9 | #
10 | # http://xen-tools.org/
11 | #
12 | ##
13 |
14 |
15 | ##
16 | #
17 | # File Format
18 | # -----------
19 | #
20 | # Anything following a '#' character is ignored as a comment.
21 | #
22 | # Otherwise the format of this file "key = value". The value of
23 | # any keys in this file may be constructed via the output of a command.
24 | #
25 | # For example:
26 | #
27 | # kernel = /boot/vmlinuz-`uname -r`
28 | #
29 | ##
30 |
31 |
32 |
33 | #
34 | ##
35 | # Output directory for storing loopback images.
36 | #
37 | # If you choose to use loopback images, which are simple to manage but
38 | # slower than LVM partitions, then specify a directory here and uncomment
39 | # the line.
40 | #
41 | # New instances will be stored in subdirectories named after their
42 | # hostnames.
43 | #
44 | ##
45 | dir = /etc/xen
46 | #
47 |
48 | #
49 | ##
50 | #
51 | # If you don't wish to use loopback images then you may specify an
52 | # LVM volume group here instead
53 | #
54 | ##
55 | #lvm = lvm
56 |
57 |
58 | #
59 | ##
60 | #
61 | # Installation method.
62 | #
63 | # There are four distinct methods which you may to install a new copy
64 | # of Linux to use in your Xen guest domain:
65 | #
66 | # - Installation via the debootstrap command.
67 | # - Installation via the rpmstrap command.
68 | # - Installation via the rinse command.
69 | # - Installation by copying a directory containing a previous installation.
70 | # - Installation by untarring a previously archived image.
71 | #
72 | # NOTE That if you use the "untar", or "copy" options you should ensure
73 | # that the image you're left with matches the 'dist' setting later in
74 | # this file.
75 | #
76 | #
77 | ##
78 | #
79 | #
80 | # install-method = [ debootstrap | rinse | rpmstrap | copy | tar ]
81 | #
82 | #
83 | install-method = debootstrap
84 |
85 | #
86 | # If you're using the "copy", or "tar" installation methods you must
87 | # need to specify the source location to copy from, or the source
88 | # .tar file to unpack.
89 | #
90 | # You may specify that with a line such as:
91 | #
92 | # install-source = /path/to/copy
93 | # install-source = /some/path/img.tar
94 | #
95 | #
96 |
97 | #
98 | ##
99 | # Command definitions.
100 | ##
101 | #
102 | # The "rinse", and "rpmstrap" commands are hardwired into
103 | # the script, but if you wish to modify the commands which are executed
104 | # when installing new systems by a "copy", "debootstrap", or "tar" method
105 | # you can do so here:
106 | #
107 | # (This allows you to install from a .tar.bz file, rather than a plain
108 | # tar file, use cdebootstrap, etc.)
109 | #
110 | # install-method=copy:
111 | # copy-cmd = /bin/cp -a $src/* $dest
112 | #
113 | # install-method=debootstrap:
114 | # debootstrap-cmd=/usr/sbin/debootstrap
115 | #
116 | # install-method=tar:
117 | # tar-cmd = /bin/tar --numeric-owner -xvf $src
118 | #
119 | #
120 |
121 |
122 |
123 | #
124 | ##
125 | # Disk and Sizing options.
126 | ##
127 | #
128 | size = 10Gb # Disk image size.
129 | memory = 128Mb # Memory size
130 | swap = 500Mb # Swap size
131 | # noswap = 1 # Don't use swap at all for the new system.
132 | fs = ext3 # use the EXT3 filesystem for the disk image.
133 | dist = squeeze # Default distribution to install.
134 | image = sparse # Specify sparse vs. full disk images.
135 |
136 | #
137 | # Currently supported and tested distributions include:
138 | #
139 | # via Debootstrap:
140 | #
141 | # Debian:
142 | # sid, sarge, etch, lenny.
143 | #
144 | # Ubuntu:
145 | # edgy, feisty, dapper.
146 | #
147 | # via Rinse:
148 | # centos-4, centos-5.
149 | # fedora-core-4, fedora-core-5, fedora-core-6, fedora-core-7
150 | #
151 | #
152 |
153 |
154 |
155 | ##
156 | # Networking setup values.
157 | ##
158 |
159 | #
160 | # Uncomment and adjust these network settings if you wish to give your
161 | # new instances static IP addresses.
162 | #
163 | ip = 192.168.36.2
164 | gateway = 192.168.36.1
165 | netmask = 255.255.255.0
166 | broadcast = 192.168.1.255
167 | #
168 | # Uncomment this if you wish the images to use DHCP
169 | #
170 | # dhcp = 1
171 |
172 |
173 | ##
174 | # Misc options
175 | ##
176 |
177 | #
178 | # Uncomment the following line if you wish to disable the caching
179 | # of downloaded .deb files when using debootstrap to install images.
180 | #
181 | # cache = no
182 | #
183 |
184 | #
185 | # Uncomment the following line if you wish to interactively setup
186 | # a new root password for images.
187 | #
188 | # passwd = 1
189 |
190 | #
191 | # If you'd like all accounts on your host system which are not present
192 | # on the guest system to be copied over then uncomment the following line.
193 | #
194 | # accounts = 1
195 | #
196 |
197 | #
198 | # Default kernel and ramdisk to use for the virtual servers
199 | #
200 | kernel = /boot/vmlinuz-`uname -r`
201 | initrd = /boot/initrd.img-`uname -r`
202 |
203 | #
204 | # The architecture to use when using debootstrap, rinse, or rpmstrap.
205 | #
206 | # This is most useful on 64 bit host machines, for other systems it
207 | # doesn't need to be used.
208 | #
209 | # arch=[i386|amd64]
210 | #
211 |
212 | #
213 | # The default mirror for debootstrap to install Debian-derived distributions
214 | #
215 | mirror = http://ftp.us.debian.org/debian/
216 |
217 | #
218 | # A mirror suitable for use when installing the Dapper release of Ubuntu.
219 | #
220 | # mirror = http://gb.archive.ubuntu.com/ubuntu/
221 |
222 | #
223 | # If you like you could use per-distribution mirrors, which will
224 | # be more useful if you're working in an environment where you want
225 | # to regularly use multiple distributions:
226 | #
227 | # mirror_sid=http://ftp.us.debian.org/debian
228 | # mirror_sarge=http://ftp.us.debian.org/debian
229 | # mirror_etch=http://ftp.us.debian.org/debian
230 | # mirror_dapper=http://archive.ubuntu.com/ubuntu
231 | # mirror_edgy=http://archive.ubuntu.com/ubuntu
232 | # mirror_feisty=http://archive.ubuntu.com/ubuntu
233 | # mirror_gutsy=http://archive.ubuntu.com/ubuntu
234 |
235 |
236 | #
237 | # Filesystem options for the different filesystems we support.
238 | #
239 | ext3_options = noatime,nodiratime,errors=remount-ro
240 | ext2_options = noatime,nodiratime,errors=remount-ro
241 | xfs_options = defaults
242 | reiser_options = defaults
243 |
244 | #
245 | # Uncomment if you wish newly created images to boot once they've been
246 | # created.
247 | #
248 | # boot = 1
249 |
250 |
251 | #
252 | # If you're using the lenny or later version of the Xen guest kernel you will
253 | # need to make sure that you use 'hvc0' for the guest serial device,
254 | # and 'xvdX' instead of 'sdX' for serial devices.
255 | #
256 | # You may specify the things to use here:
257 | #
258 | # serial_device = hvc0 #default
259 | # serial_device = tty1
260 | #
261 | # disk_device = xvda #default
262 | # disk_device = sda
263 | #
264 |
265 |
266 | #
267 | # Here we specify the output directory which the Xen configuration
268 | # files will be written to, and the suffix to give them.
269 | #
270 | # Historically xen-tools have created configuration files in /etc/xen,
271 | # and given each file the name $hostname.cfg. If you want to change
272 | # that behaviour you may do so here.
273 | #
274 | #
275 | # output = /etc/xen
276 | # extension = .cfg
277 | #
278 |
279 | hostname = ux
280 |
--------------------------------------------------------------------------------
/test/test.rb:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | # DOS(com) setreuid32
4 | # Erlang(erl) sedsid
5 | # BASIC(bas) setpgid
6 |
7 | test_cnt = 0
8 | fail_cnt = 0
9 |
10 | [
11 | ['v.iog', 'v', /Success/],
12 | ['v.jq16', 'v', /Success/],
13 | ['v.lab', 'v', /Success/],
14 | ['v.nbb', 'v', /Success/],
15 | ['v.hxg', 'v', /Success/],
16 | ['hello_shell.out', 'hello+world', /Exec format error/],
17 | ['v.out', 'v', /Success/],
18 | ['echo.mk', 'echo', /Success/],
19 | ['v.mk', 'v', /Success/],
20 | ['v.bash', 'v', /Success/],
21 | ['v.cr', 'v', /Success/],
22 | ['v.rb2', 'v', /Success/],
23 | ['v.fsh', 'v', /Success/],
24 | ['hello.aheui', 'hello+world', /Success/],
25 | ['v.jq', 'v', /Success/],
26 | ['syslog.c', 'v', /SYSLOG_ACTION_SIZE_BUFFER: Operation not permitted/],
27 | ['v.gs2', 'v', /Success/],
28 | ['hello.bfsl', 'hello+world', /Success/],
29 | ['v.bef98', 'v', /Success/],
30 | ['v.pike', 'v', /Success/],
31 | ['v.nut', 'v', /Success/],
32 | ['v.chpl', 'v', /Success/],
33 | ['v.rs', 'v', /Success/],
34 | ['v.py3', 'v', /Success/],
35 | ['v.blsq', 'v', /Success/],
36 | ['v.gplot', 'v', /Success/],
37 | ['v.gp', 'v', /Success/],
38 | ['v.rexx', 'v', /Success/],
39 | ['v.sno', 'v', /Success/],
40 | ['v.icn', 'v', /Success/],
41 | ['v.mal', 'v', /Success/],
42 | ['v.clci', 'v', /Success/],
43 | ['v.piet', 'v', /Success/],
44 | ['v.exu', 'v', /Success/],
45 | ['v.k', 'v', /Success/],
46 | ['v.oct', 'v', /Success/],
47 | ['v.logo', 'v', /Success/],
48 | ['v.scala', 'v', /Success/],
49 | ['v.wake', 'v', /Success/],
50 | ['embed.dc', 'embed', /Success/],
51 | ['v.flog', 'v', /Success/],
52 | ['v.nand', 'v', /Success/],
53 | # need manual test
54 | #["hello (paren) 'quotes`.rb", 'hello+world', /Success/],
55 | ['v.bc', 'v', /Success/],
56 | ['v.fish', 'v', /Success/],
57 | ['v.zsh', 'v', /Success/],
58 | ['v.clj', 'v', /Success/],
59 | ['testing.ly', 'testing', /Success/],
60 | ['testing_setpriority.rb', 'testing', /you called setpriority for cheating/],
61 | ['example_net.sh', 'example_com', /you called forbidden system call \(socketcall\)/],
62 | ['testing.go', 'testing', /Success/],
63 | ['nop.com', 'nop', /Success/],
64 | ['fizz.com', 'FizzBuzz', /Success/],
65 | ['testing.arc', 'testing', /Success/],
66 | ['testing.asy', 'testing', /Success/],
67 | ['testing.lmn', 'testing', /Success/],
68 | ['testing.kt', 'testing', /Success/],
69 | ['v.qcl', 'v', /Success/],
70 | ['v.z8b', 'v', /Success/],
71 | ['v.lamb', 'v', /Success/],
72 | ['v.grass', 'v', /Success/],
73 | ['testing.gs', 'testing', /Success/],
74 | ['v.max', 'v', /Success/],
75 | ['v.cy', 'v', /Success/],
76 | ['v.reb', 'v', /Success/],
77 | ['v.n', 'v', /Success/],
78 | ['hello.reb', 'hello+world', /Success/],
79 | ['hello.n', 'hello+world', /Success/],
80 | # expected failure...
81 | ['echo.max', 'echo', /failed/],
82 | ['hello.max', 'hello+world', /Success/],
83 | ['hello_fail.c', 'hello+world', /compile error/],
84 | #['fork_bomb.sh', 'testing', /fork attempts might fail/],
85 | # We don't disallow setsid anymore
86 | #['daemon.rb', 'testing', /setsid/],
87 | ['daemon.rb', 'testing', /failed/],
88 | ['testing.grb', 'testing', /Success/],
89 | ['testing.vi', 'testing', /Success/],
90 | ['testing.groovy', 'testing', /Success/],
91 | ['testing.r', 'testing', /Success/],
92 | ['out.class', 'testing', /Success/],
93 | ['testing.ms', 'testing', /Success/],
94 | ['google_wait.rb', 'google', /timeout/],
95 | ['hello_wait.rb', 'hello+world', /Success/],
96 | ['testing.a+', 'testing', /Success/],
97 | ['testing.adb', 'testing', /Success/],
98 | ['testing.awk', 'testing', /Success/],
99 | ['testing.bas', 'testing', /Success/],
100 | ['testing.bef', 'testing', /Success/],
101 | ['testing.bf', 'testing', /Success/],
102 | ['testing.c', 'testing', /Success/],
103 | ['testing.cpp', 'testing', /Success/],
104 | ['testing.cob', 'testing', /Success/],
105 | ['testing.cpp', 'testing', /Success/],
106 | ['testing.cs', 'testing', /Success/],
107 | ['testing.curry', 'testing', /Success/],
108 | ['testing.d', 'testing', /Success/],
109 | ['testing.di', 'testing', /Success/],
110 | ['testing.erl', 'testing', /Success/],
111 | ['testing.f95', 'testing', /Success/],
112 | ['testing.for', 'testing', /Success/],
113 | ['testing.hs', 'testing', /Success/],
114 | ['testing.ijs', 'testing', /Success/],
115 | ['testing.io', 'testing', /Success/],
116 | ['testing.java', 'testing', /Success/],
117 | ['testing.js', 'testing', /Success/],
118 | ['testing.l', 'testing', /Success/],
119 | ['testing.lazy', 'testing', /Success/],
120 | ['testing.lua', 'testing', /Success/],
121 | ['testing.m', 'testing', /Success/],
122 | ['testing.m4', 'testing', /Success/],
123 | ['testing.mind', 'testing', /Success/],
124 | ['testing.ml', 'testing', /Success/],
125 | ['testing.out', 'testing', /Success/],
126 | ['testing.pas', 'testing', /Success/],
127 | ['testing.pef', 'testing', /Success/],
128 | ['testing.php', 'testing', /Success/],
129 | ['testing.pl', 'testing', /Success/],
130 | ['testing.pl6', 'testing', /Success/],
131 | ['testing.pro', 'testing', /Success/],
132 | ['testing.ps', 'testing', /Success/],
133 | ['testing.py', 'testing', /Success/],
134 | ['testing.rb', 'testing', /Success/],
135 | ['testing.s', 'testing', /Success/],
136 | ['testing.scm', 'testing', /Success/],
137 | ['testing.sed', 'testing', /Success/],
138 | ['testing.sh', 'testing', /Success/],
139 | ['testing.st', 'testing', /Success/],
140 | ['testing.tcl', 'testing', /Success/],
141 | ['testing.unl', 'testing', /Success/],
142 | ['testing.vhdl', 'testing', /Success/],
143 | ['testing.wr', 'testing', /Success/],
144 | ['testing.ws', 'testing', /Success/],
145 | ['testing.xgawk', 'testing', /Success/],
146 | ['testing.xtal', 'testing', /Success/],
147 | ['testing_exec.rb', 'testing', /denied/],
148 | ['hello.rb', 'hello+world', /Success/],
149 | ['hello_exec.rb', 'hello+world', /Success/],
150 | ['hello.ijs', 'hello+world', /Success/],
151 | ['google.bef', 'google', /Success/],
152 | ['google.c', 'google', /Success/],
153 | ['google.d', 'google', /Success/],
154 | ['google.hs', 'google', /Success/],
155 | ['google.pl', 'google', /Success/],
156 | ['google.rb', 'google', /Success/],
157 | ['google.sed', 'google', /Success/],
158 | ['fizz.rb', 'FizzBuzz', /Success/],
159 | ['fizz.c', 'FizzBuzz', /Success/],
160 | ['fizz.out', 'FizzBuzz', /Success/],
161 | ['fizz.cs', 'FizzBuzz', /Success/],
162 | ['fizz.di', 'FizzBuzz', /Success/],
163 | ['fizz.pl', 'FizzBuzz', /Success/],
164 | ['fizz.rb', 'FizzBuzz', /Success/],
165 | ['fizz.sed', 'FizzBuzz', /Success/],
166 | ['fizz.sh', 'FizzBuzz', /Success/],
167 | ['fizz_exec.c', 'FizzBuzz', /exec is denied/],
168 | ['fizz_fail.c', 'FizzBuzz', /failed/],
169 | ['fizz_exec.l', 'FizzBuzz', /exec is denied/],
170 | ['fizz_fail.l', 'FizzBuzz', /failed/],
171 | ['fizz_exec.cs', 'FizzBuzz', /exec is denied/],
172 | ['fizz_fail.cs', 'FizzBuzz', /failed/],
173 | ['fizz_exec.out', 'FizzBuzz', /exec is denied/],
174 | ['fizz_exec.ijs', 'FizzBuzz', /exec is denied/],
175 | ['mk_hello.rb', 'hello+world', /failed/],
176 | ['load_hello.rb', 'hello+world', /failed/],
177 | ['cc.sh', 'Evil+C+Compiler', /Success/],
178 | ['timeout.rb', 'Timeout', /Success/],
179 | ['timeout_fail.rb', 'Timeout', /Not timeout/],
180 | ['hello_timeout.d', 'hello+world', /compile timeout/],
181 | ['hello_excessout.rb', 'hello+world', /foobarbaz/],
182 | ].each do |s, u, r|
183 | test_cnt += 1
184 |
185 | next if ARGV[0] && !s.index(ARGV[0])
186 |
187 | print "Testing #{s}... "
188 | #c = `./ag.rb t/#{s} http://localhost/p.rb?#{u}`
189 | c = `./ag.rb t/#{s} http://golf.shinh.org/p.rb?#{u}`
190 | if c !~ r
191 | puts 'failed'
192 | fail_cnt += 1
193 | else
194 | puts 'success'
195 | end
196 | File.open("log/#{s}.log", 'w') do |of|
197 | of.print(c)
198 | end
199 | end
200 |
201 | if fail_cnt == 0
202 | puts 'All tests passed!'
203 | else
204 | puts "%d of %d tests failed" % [fail_cnt, test_cnt]
205 | end
206 |
207 |
--------------------------------------------------------------------------------
/fe/fcgi/tools/version.rb:
--------------------------------------------------------------------------------
1 | apt = proc{|package|
2 | info = `dpkg -s #{package}`
3 | ver = info[/Version: (\d:)?(.*)/, 2]
4 | r = "Debian package: #{package}-" + ver
5 | if info =~ /^Homepage: (.*)/
6 | r += " (#{$1})"
7 | end
8 | r
9 | }
10 |
11 | LANGS = {
12 | 'rb' => [apt['ruby1.8']],
13 | 'rb2' => [apt['ruby2.2']],
14 | 'pl' => [apt['perl']],
15 | 'py' => [apt['python']],
16 | 'py3' => [apt['python3']],
17 | 'php' => [apt['php5-cli']],
18 | 'scm' => [apt['gauche']],
19 | 'l' => [apt['clisp']],
20 | 'arc' => ['arc3.tar (http://arclanguage.org/)'],
21 | 'ly' => [apt['lilypond']],
22 | 'io' => ['Io 20080209 (http://iolanguage.com/)'],
23 | 'js' => [apt['spidermonkey-bin']],
24 | 'lua' => [apt['lua5.1']],
25 | 'tcl' => [apt['tcl8.5']],
26 | 'xtal' => ['xtal 0.9.7.0 (http://code.google.com/p/xtal-language/)'],
27 | 'kt' => ['This is kite, version 1.0.3 (http://www.kite-language.org/)'],
28 | 'cy' => ['cyan-1.0.3.tgz (http://www.geocities.jp/takt0_h/cyan/index.html)'],
29 | 'st' => [apt['gnu-smalltalk']],
30 | 'pro' => [apt['swi-prolog']],
31 | 'for' => [apt['gforth']],
32 | 'bas' => [apt['yabasic']],
33 | 'pl6' => ['This is Rakudo Perl 6. (http://rakudo.org/)',
34 | 'We are using this version.'],
35 | 'erl' => [apt['erlang']],
36 | 'ijs' => ['j602a (http://www.jsoftware.com/)'],
37 | 'a+' => [apt['aplus-fsf']],
38 | 'mind' => ['Mind Version 7 for UNIX mind7u06.tar.gz (http://www.scripts-lab.co.jp/mind/whatsmind.html)'],
39 | 'c' => [apt['gcc']],
40 | 'cpp' => [apt['g++']],
41 | 'd' => ['Digital Mars D Compiler v2.019 (http://www.digitalmars.com/d/)'],
42 | 'di' => ['Digital Mars D Compiler v1.047 (http://www.digitalmars.com/d/)'],
43 | # cd /golf/local/go && hg log | head -4
44 | 'go' => ['go version go1.9.2 linux/386 (http://golang.org/)'],
45 | 'ml' => [apt['ocaml']],
46 | 'hs' => [`ghc-8.0.2 --version`],
47 | 'adb' => [apt['gnat']],
48 | 'm' => [apt['gobjc']],
49 | 'java' => [apt['sun-java6-jdk']],
50 | 'pas' => [apt['gpc']],
51 | 'f95' => [apt['gfortran']],
52 | 'cs' => [apt['mono-gmcs']],
53 | 'n' => [apt['nemerle']],
54 | 'cob' => [apt['open-cobol']],
55 | # cyc -v
56 | 'curry' => ['cyc version 0.9.11 (built on Mon Jun 11 10:35:49 CEST 2007) (http://www.curry-language.org/)'],
57 | 'lmn' => ['lmntal-20080828 (http://www.ueda.info.waseda.ac.jp/lmntal/pukiwiki.php?LMNtal)'],
58 | 'max' => [apt['maxima']],
59 | 'reb' => ['rebol-276 (http://www.rebol.com/)'],
60 | 'asy' => [apt['asymptote']],
61 | 'awk' => [apt['mawk']],
62 | 'sed' => [apt['sed']],
63 | 'sh' => [apt['bash']],
64 | 'bash' => [apt['bash']],
65 | 'xgawk' => ['Extensible GNU Awk 3.1.6 (build 20080101) with dynamic loading, and with statically-linked extensions (http://sourceforge.net/projects/xmlgawk)'],
66 | 'm4' => [apt['m4']],
67 | 'ps' => [apt['ghostscript']],
68 | 'r' => [apt['r-base']],
69 | #'vhdl' => [apt['ghdl']],
70 | 'vhdl' => ['broken probably :('],
71 | 'qcl' => ['qcl-0.6.3 (http://tph.tuwien.ac.at/~oemer/qcl.html)'],
72 | 'bf' => ['http://en.wikipedia.org/wiki/Brainfuck',
73 | 'I think we are using this C interpreter, but I\'m not sure...'],
74 | 'bfsl' => ['c6820766108596ba522d64b6d8581f5bbb4e526b (https://github.com/yshl/MNNBFSL)'],
75 | 'gs2' => ['827ade5d5f7ed8c690bb23724dd13df613fbf702 (https://github.com/nooodl/gs2)'],
76 | 'ws' => ['http://compsoc.dur.ac.uk/whitespace/',
77 | 'We are using the Haskell interpreter.'],
78 | 'bef' => ['http://catseye.tc/projects/bef/',
79 | 'We are using the reference implementation.'],
80 | 'bef98' => ['http://users.tkk.fi/~mniemenm/befunge/ccbi.html',
81 | 'We are using CBBI-2.1.'],
82 | 'pef' => ['http://d.hatena.ne.jp/ku-ma-me/searchdiary?word=pefunge',
83 | 'Pefunge is an esoteric language proposed by mame. There is only Japanese documentation about this language. The reference implementation.'],
84 | 'ms' => ['http://www.golfscript.com/minus/',
85 | 'Minus is an esoteric language, with only 1 instruction operator, invented by flagitious.'],
86 | 'gs' => ['http://www.golfscript.com/golfscript/',
87 | 'GolfScript is a stack oriented esoteric language invented by flagitious.'],
88 | 'flog' => ['http://esolangs.org/wiki/FlogScript'],
89 | 'nand' => ['http://esolangs.org/wiki/FerNANDo',
90 | 'We are using the Python implementation 0.5.'],
91 | 'unl' => ['http://www.madore.org/~david/programs/unlambda/',
92 | 'We are using the C interpreter written by Emil Jerabek.'],
93 | 'lazy' => ['http://homepages.cwi.nl/~tromp/cl/lazy-k.html',
94 | 'We are using the C interpreter written by irori.'],
95 | 'grass' => ['http://www.blue.sky.or.jp/grass/',
96 | 'We are using the OCaml interpreter written by YT.'],
97 | 'lamb' => ['http://www.golfscript.com/lam/',
98 | 'Universal Lambda is proposed by flagitious. We are using the C interpreter written by irori.'],
99 | 'wr' => ['http://bigzaphod.org/whirl/',
100 | 'We are using the C++ interpreter.'],
101 | 's' => [apt['binutils']],
102 | 'out' => [`uname -srvmo`],
103 | 'z8b' => ['Modified fMSX (http://golf.shinh.org/z80golf.tgz)',
104 | 'See this site for more detail.'],
105 | 'com' => [apt['dosemu']],
106 | 'class' => [apt['sun-java6-jre']],
107 | 'vi' => [apt['vim']],
108 | 'grb' => ['ruby 1.9.1p243 (2009-07-16 revision 24175) (http://ruby-lang.org/)'],
109 | 'groovy' => [apt['groovy']],
110 | 'clj' => ['Clojure 1.1.0 with clojure-contrib 1.1.0 (http://code.google.com/p/clojure/downloads/list)'],
111 | 'zsh' => [apt['zsh']],
112 | 'fish' => [apt['fish']],
113 | 'bc' => [apt['bc']],
114 | 'wake' => ['http://shinh.skr.jp/wake/',
115 | 'We are using the C++ implementation.'],
116 | 'dc' => [apt['dc']],
117 | 'scala' => [apt['scala']],
118 | 'logo' => [apt['ucblogo']],
119 | 'oct' => [apt['octave3.2']],
120 | 'exu' => ['Euphoria Interpreter 3.1.1 for Linux (http://www.rapideuphoria.com/31/euphor31.tar)'],
121 | 'k' => ['81e95b395144f4b02fe8782ad87c1f218b511c43 (https://github.com/kevinlawler/kona/)'],
122 | 'piet' => ['npiet-1.3a (http://www.bertnase.de/npiet/)'],
123 | 'clci' => [apt['clc-intercal']],
124 | 'mal' => ['Slightly modified reference implementation in C (https://github.com/shinh/ags/blob/master/be/fetcher/malbolge.c)'],
125 | 'icn' => [apt['iconc']],
126 | 'sno' => ['snobol4-1.4.1 (http://www.snobol4.org/)'],
127 | 'rexx' => [apt['regina-rexx']],
128 | 'gp' => [apt['pari-gp']],
129 | 'gplot' => [apt['gnuplot']],
130 | 'blsq' => ['Burlesque e4e7ff873e2f7a9d99ca658a78a5cf3de60fe9b0 in github (https://github.com/FMNSSun/Burlesque)'],
131 | 'rs' => ['Rust 1.8.0 (http://www.rust-lang.org/)'],
132 | 'nut' => ['Squirrel 3.1 beta (http://squirrel-lang.org/)'],
133 | 'chpl' => ['Chapel 1.7.0 (http://chapel.cray.com/)'],
134 | 'pike' => [apt['pike7.6-core']],
135 | 'jq' => [apt['jq']],
136 | 'aheui' => ['f1376d776b9a3940c6ead0b34e54b0dd07e6a2c1 (https://github.com/aheui/caheui)'],
137 | 'mk' => [apt['make']],
138 | 'fsh' => ['3b16018cb47f2f9ad1fa085c155cc5c0dc448b2d (https://gist.github.com/anonymous/6392418)'],
139 | 'crystal' => ['Crystal 0.9.1 [b3b1223] (Fri Oct 30 03:36:50 UTC 2015)'],
140 | # 'hxg' => ['522012d75e340343c5f097e9c2f2aec37a49629e (https://github.com/m-ender/hexagony)'],
141 | # 'lab' => ['f1376d776b9a3940c6ead0b34e54b0dd07e6a2c1 (https://github.com/m-ender/labyrinth)'],
142 | 'jelly' => ['2f7103853033b2f04a419ca737011dc4c4c22196 (https://github.com/shinh/jellylanguage/)'],
143 | 'nbb' => ['1.00 (http://golfscript.com/nibbles/)'],
144 | 'jq16' => ['jq-1.6-145-ga9f97e9-dirty'],
145 | 'atl' => ['c0bf5086c114278a86245d07a50ba2419cf440bf (https://github.com/darrenks/atlas/)'],
146 | 'iog' => ['iogii 1.0.1 (https://golfscript.com/iogii/source.html)'],
147 | }
148 |
149 | LANGS.each do |l, info|
150 | version = info[0]
151 | version.gsub!(/https?:\/\/[^)]+/, '\&')
152 | version += "
#{info[1]}" if info[1]
153 | puts "#{l} #{version}"
154 | end
155 |
156 |
--------------------------------------------------------------------------------
/fe/fcgi/submit.rb:
--------------------------------------------------------------------------------
1 | require 'handler'
2 | require 'fileutils'
3 |
4 | # multipart handling is from cgi.rb
5 |
6 | class Submit < Handler
7 | def get_statistics(s)
8 | a=[0,0,0,0]
9 | an=/[a-zA-Z0-9]/
10 | ws=/[ \t\n]/
11 | s.each_byte{|x|
12 | s=x.chr
13 | a[an=~s ?2:ws=~s ?1: x<127&&x>32?3:0]+=1
14 | }
15 | a
16 | end
17 |
18 | def add_record(pn, un, ext, cs, time, code, dl, fn)
19 | # udb = PStore.new("db/#{pn}/#{un}.udb")
20 |
21 | st = get_statistics(code)
22 | rank = -1
23 | now = Time.now
24 |
25 | dl = dl.to_i
26 | pm = (dl > 0 && dl < Time.now.to_i) ? 1 : 0
27 |
28 | should_add = true
29 | ldb = PStore.new("db/#{pn}/_ranks.db")
30 | max = -1
31 | ldb.transaction do
32 | ldb[ext] = [] if !ldb.root?(ext)
33 | l = ldb[ext]
34 | if (v = l.find{|x|x[0] == un})
35 | if v[1] > cs
36 | l = l.reject{|x|x[0] == un && x[5].to_i == pm}
37 | else
38 | should_add = false
39 | end
40 | end
41 |
42 | if (should_add)
43 | if @op == ''
44 | st = st[0,1]
45 | end
46 |
47 | if (dl > 0)
48 | FileUtils.mkdir_p("../code/#{pn}")
49 | record_key = "#{un.gsub('/','%2F')}_#{now.to_i}"
50 | File.open("../code/#{pn}/#{record_key}", 'w') do |o|
51 | o.print(code)
52 | end
53 | File.open("../code/#{pn}/#{record_key}_fn", 'w') do |o|
54 | o.print(fn)
55 | end
56 | end
57 |
58 | l << a = [un, cs, time, now, st, pm]
59 | l.sort!{|x,y|
60 | r = x[5].to_i<=>y[5].to_i
61 | if r != 0
62 | r
63 | else
64 | r = x[1]<=>y[1]
65 | if r != 0
66 | r
67 | else
68 | x[3] <=> y[3]
69 | end
70 | end
71 | }
72 | rank = l.index(a) + 1
73 | max = l[0][1]
74 | ldb[ext] = l
75 | end
76 | end
77 |
78 | if should_add && pn != 'testing'
79 | r = [pn, un, ext, cs, time, now, rank, (10000*max/cs).to_i]
80 | rdb = PStore.new('db/recent.db')
81 | rdb.transaction do
82 | rdb['root'] = [] if !rdb.root?('root')
83 | rdb['root'].unshift(r)
84 | while rdb['root'].size > 100
85 | rdb['root'].pop
86 | end
87 | end
88 | mircbot(%Q(#{un} submits #{cs}B of #{ext2lang(ext)} for #{pn}, ranking ##{rank} (#{r[7]}pts).))
89 | end
90 |
91 | should_add
92 | end
93 |
94 | def output_filter(s)
95 | escape_binary(CGI.escapeHTML(s.to_s.gsub("\r\n","\n"))).gsub("\n",%Q(\\n\n))
96 | end
97 |
98 | def handle_
99 | #if true
100 | # err('Sorry, now under maintenance')
101 | #end
102 |
103 | unless ("POST" == @e['REQUEST_METHOD']) and
104 | %r|\Amultipart/form-data.*boundary=\"?([^\";,]+)\"?|n.match(@e['CONTENT_TYPE'])
105 | err('not multipart submission')
106 | end
107 |
108 | boundary = $1.dup
109 | @multipart = true
110 | clen = Integer(@e['CONTENT_LENGTH'])
111 | err('over 20k') if (clen > 20000)
112 | q = read_multipart(boundary, clen)
113 |
114 | pn = q.problem.read.tr('+',' ')
115 | un = q.user.read
116 | un.sub!(/\s*;.*/,'')
117 | un.rstrip!
118 | @op = q['reveal'].to_s
119 |
120 | html_header({'Set-Cookie'=>"un=#{CGI.escape(un.sub(/\s*\(.*$/,''))}; expires=#{CGI::rfc1123_date(Time.now+60*60*24*365)}; path=/;"})
121 |
122 | begin
123 | fb = q.file.read
124 | fn = q.file.original_filename[/[^\/\\]+$/]
125 | rescue
126 | fb = q.code.read.gsub("\r\n", "\n")
127 | fn = 'test.' + q.ext.read
128 | end
129 |
130 | err("empty file") if fn == '' || fb == ''
131 | fn = $`+'a+' if fn =~ /a $/
132 |
133 | ext = File.extname(fn).tr('.','')
134 | exts = file_types
135 | err("unsupported suffix (#{ext})") if !exts.include?(ext)
136 | err('not ELF binary') if ext=='out' && (fb.size<3||fb[0,4]!="\x7fELF")
137 |
138 | db = get_db(pn)
139 | title, desc, input, output, i2, o2, i3, o3, dexec, dl, rejudge =
140 | db.get('title', 'desc', 'input', 'output',
141 | 'input2', 'output2', 'input3', 'output3', 'dexec', 'deadline', 'rejudge')
142 | dexec = dexec == 'on' ? 1 : dexec.to_i
143 |
144 | rejudge = dl == 0 ? 0 : rejudge.to_i
145 | # if rejudge != 1 && ext == "atl"
146 | # err("Atlas is in alpha and currently available for problems rejudge feature enabled")
147 | # end
148 |
149 | inputs = [input]
150 | outputs = [output]
151 | if o2 && o2 != ''
152 | inputs << i2
153 | outputs << o2
154 | end
155 | if o3 && o3 != ''
156 | inputs << i3
157 | outputs << o3
158 | end
159 |
160 | sending_code = fb
161 |
162 | s = execute2(fn, sending_code, inputs)
163 |
164 | title("#{pn} - result")
165 | puts tag('h1',"#{pn} - result")
166 |
167 | start_buffering
168 |
169 | failed = false
170 | t = 0
171 | all_time = 0.0
172 | outputs.each do |output|
173 | payload = Marshal.load(s.read(s.gets.to_i))
174 | time = payload[:time]
175 | status = payload[:status]
176 | execnt = payload[:execnt]
177 | o = payload[:stdout]
178 | e = payload[:stderr]
179 |
180 | notice = ''
181 | if !payload[:notice].empty?
182 | notice += 'notice:
'
183 | payload[:notice].each do |n|
184 | notice += '- ' + n
185 | end
186 | notice += '
'
187 | end
188 |
189 | puts tag('h2', "test ##{t+=1}")
190 | if pn == 'Timeout'
191 | if time
192 | time = 'Not timeout'
193 | else
194 | time = 3
195 | end
196 | end
197 | if !time
198 | time = 'timeout'
199 | end
200 | if time.class == String
201 | failed = true
202 | puts tag('p', time)
203 |
204 | puts %Q(your output:
205 |
#{output_filter(o)}
206 | stderr:
207 |
#{CGI.escapeHTML(e)}
208 | #{notice}
209 | )
210 | else
211 | all_time += time
212 |
213 | if pn == 'Quine'
214 | output = fb
215 | elsif pn == 'Not Quine'
216 | elsif pn == 'Inverse Quine'
217 | elsif pn == 'Palindromic Quine'
218 | output = fb
219 | elsif pn == 'Timeout'
220 | output = o
221 | else
222 | output = output.gsub("\r\n","\n").rstrip
223 | o = o.gsub("\r\n","\n").rstrip
224 | end
225 |
226 | # if (o.rstrip.gsub("\r\n","\n") == output.rstrip.gsub("\r\n","\n"))
227 | if ((execnt > 2 && dexec > 0 && ext != 'sh' && ext != 'di' && ext != 'zsh' && ext != 'fish') &&
228 | (ext != 'erl') && (ext != 'pef') &&
229 | (ext != 'ijs' || execnt > 4) &&
230 | (ext != 'cy' || execnt > 4) &&
231 | (ext != 'wake' || execnt > 3) &&
232 | (ext != 'vhdl' || execnt > 3) &&
233 | (ext != 'out' || execnt > 4) &&
234 | (ext != 'vi' || execnt > 8) &&
235 | (ext != 'l' || execnt > 3) &&
236 | (ext != 'r' || execnt > 7) &&
237 | (ext != 'lmn' || execnt > 7) &&
238 | (ext != 'java' || execnt > 4) &&
239 | (ext != 'clj' || execnt > 3) &&
240 | (ext != 'class' || execnt > 5) &&
241 | (ext != 'com' || execnt > 26) &&
242 | (ext != 'max' || execnt > 12) &&
243 | (ext != 'groovy' || execnt > 19) &&
244 | (ext != 'pl6' || execnt > 3) &&
245 | (ext != 'mk' || execnt > 3) &&
246 | (ext != 'scala' || execnt > 6))
247 | puts tag('p', "exec is denied! (#{execnt})")
248 | failed = true
249 | elsif execnt == -1
250 | puts tag('p', "you called setpriority for cheating?")
251 | failed =true
252 | elsif execnt < 2
253 | puts tag('p', "it seems the execution server is broken. please contact at shinichiro.hamaji _at_ gmail.com")
254 | failed =true
255 | else
256 | ok = true
257 | unless (o == output && (pn != 'Quine' || (ext == 'ws' && fb.size > 5) || fb.rstrip != ""))
258 | ok = false
259 | end
260 | if pn == 'Palindromic Quine' && (fb != fb.reverse || fb.size < 2)
261 | ok = false
262 | end
263 | if pn == 'Error'
264 | ok = e.size > 0
265 | end
266 | if ok && pn == 'Whitespaceless Hello world'
267 | ok = false if fb =~ /[ \t\n]/
268 | end
269 | if ok && pn == 'Helloworldless Hello world'
270 | ok = false if fb =~ /[Hello, world!]/
271 | end
272 | if ok && pn == 'Hello transposable world'
273 | ok = false if fb.chomp != fb.chomp.split("\n").map{|_|_.chars.to_a}.transpose.map{|_|_*""}*"\n"
274 | end
275 | if pn == 'Inverse Quine'
276 | x = [*0..127].map{|_|_.chr} - fb.chars.sort.uniq
277 | y = o.chars.sort
278 | ok = x == y
279 | end
280 | if pn == 'Not Quine'
281 | x = fb.chars.to_a
282 | y = o.chars.to_a
283 | if x.sort == y.sort && x.zip(y).all?{|x, y|x != y}
284 | ok = true
285 | else
286 | ok = false
287 | end
288 | end
289 | if ok
290 | puts tag('p', 'success!')
291 | else
292 | failed = true
293 | puts tag('p', 'failed!')
294 | end
295 | end
296 | puts %Q(
297 | size: #{fb.size}
298 | time: #{'%.6f' % time}sec
299 | status: #{status}
300 |
301 | your output:
302 |
#{output_filter(o)}
303 | )
304 | if failed
305 | puts %Q(expected:
306 |
#{output_filter(output)}
307 | )
308 | end
309 | puts %Q(stderr:
310 |
#{CGI.escapeHTML(e.to_s)}
311 | )
312 | end
313 | puts notice
314 | end
315 | s.close
316 |
317 | s = end_buffering
318 |
319 | if failed || all_time == 0.0
320 | puts 'Failed!
'
321 | else
322 | puts 'Success!'
323 | score = fb.size
324 | if / broken keyboard$/ =~ pn
325 | score = fb.chars.sort.uniq.size + fb.size * 0.001
326 | end
327 | if add_record(pn, un, ext, score, all_time, fb, dl, fn)
328 | puts "And it's a new record!"
329 | end
330 | puts '
'
331 | end
332 |
333 | puts s
334 |
335 | foot
336 | end
337 | end
338 |
339 |
--------------------------------------------------------------------------------