├── 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 | ++++++++<]>.-.-.-------. -------------------------------------------------------------------------------- /test/t/testing_exec.rb: -------------------------------------------------------------------------------- 1 | exec %q(ruby -e 'puts"pong"') 2 | -------------------------------------------------------------------------------- /test/t/v.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | io::println("v"); 3 | } -------------------------------------------------------------------------------- /be/srv/s/dc: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | DC_LINE_LENGTH= exec dc -f $1 3 | -------------------------------------------------------------------------------- /be/srv/s/io: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec /golf/local/io_static $1 3 | -------------------------------------------------------------------------------- /be/srv/s/mal: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec /golf/local/malbolge $1 3 | -------------------------------------------------------------------------------- /be/srv/s/pl: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | export LANG=C 3 | exec perl $1 4 | -------------------------------------------------------------------------------- /be/srv/s/scala: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec scala -nocompdaemon $1 3 | -------------------------------------------------------------------------------- /be/srv/s/unl: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec /golf/local/unlambda $1 3 | -------------------------------------------------------------------------------- /be/srv/s/xtal: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec /golf/local/xtal.exe $1 3 | -------------------------------------------------------------------------------- /test/t/hello.n: -------------------------------------------------------------------------------- 1 | System.Console.WriteLine("Hello, world!"); 2 | -------------------------------------------------------------------------------- /test/t/hello_exec.rb: -------------------------------------------------------------------------------- 1 | exec %q(ruby -e 'puts"Hello, world!"') 2 | -------------------------------------------------------------------------------- /test/t/hello_wait.rb: -------------------------------------------------------------------------------- 1 | sleep(1.2) 2 | puts "Hello, world!" 3 | -------------------------------------------------------------------------------- /test/t/testing.adb: -------------------------------------------------------------------------------- 1 | procedure gnat.io.a is begin put("pong");end; -------------------------------------------------------------------------------- /test/t/v.icn: -------------------------------------------------------------------------------- 1 | procedure main(args) 2 | write("v") 3 | end 4 | -------------------------------------------------------------------------------- /be/srv/s/_adb: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | gnat make -gnat05 -g -O $1 -o a.out 3 | -------------------------------------------------------------------------------- /be/srv/s/_cob: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cobc -x -g -debug -free $1 -o a.out 3 | -------------------------------------------------------------------------------- /be/srv/s/_cs: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | gmcs $1 -out:a.out -optimize 3 | 4 | -------------------------------------------------------------------------------- /be/srv/s/aheui: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec /golf/local/caheui/aheui -q $1 3 | -------------------------------------------------------------------------------- /be/srv/s/bc: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | BC_LINE_LENGTH=9999 exec bc -lq $1 3 | -------------------------------------------------------------------------------- /be/srv/s/bfsl: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec /golf/local/MNNBFSL/mnnbfsl $1 3 | -------------------------------------------------------------------------------- /be/srv/s/exu: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec /golf/local/euphoria/bin/exu $1 3 | -------------------------------------------------------------------------------- /be/srv/s/grb: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec /usr/local/bin/goruby-1.9 $1 3 | -------------------------------------------------------------------------------- /be/srv/s/gs: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec ruby /golf/local/golfscript.rb $1 3 | -------------------------------------------------------------------------------- /be/srv/s/jq16: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec /golf/local/jq16 -s -r -R -f $1 3 | -------------------------------------------------------------------------------- /be/srv/s/nut: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec /golf/local/SQUIRREL3/bin/sq $1 3 | -------------------------------------------------------------------------------- /test/t/cc.sh: -------------------------------------------------------------------------------- 1 | echo 'Compiling... 2 | Running...' 3 | gcc -xc - 4 | ./* -------------------------------------------------------------------------------- /test/t/testing.grb: -------------------------------------------------------------------------------- 1 | puts:pong 2 | p;p;p;p;p;p;p;p;p;p;p;p;p;p;p;p 3 | -------------------------------------------------------------------------------- /test/t/testing.rb: -------------------------------------------------------------------------------- 1 | puts:pong 2 | p;p;p;p;p;p;p;p;p;p;p;p;p;p;p;p 3 | -------------------------------------------------------------------------------- /be/srv/s/_lmn: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | /golf/local/lmntal-20080828/bin/lmnc $1 3 | -------------------------------------------------------------------------------- /be/srv/s/atl: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec ruby3.2 /golf/local/atlas/atlas $1 3 | -------------------------------------------------------------------------------- /be/srv/s/flog: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec php5 /golf/local/FlogScript.php $1 3 | -------------------------------------------------------------------------------- /be/srv/s/fsh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec python3 /golf/local/fish/fish.py $1 3 | -------------------------------------------------------------------------------- /be/srv/s/gs2: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec python /golf/local/gs2/gs2.py $1 3 | 4 | -------------------------------------------------------------------------------- /be/srv/s/piet: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec /golf/local/npiet-1.3a/npiet -q $1 3 | -------------------------------------------------------------------------------- /be/srv/s/ps: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec gs -q -dNODISPLAY -dBATCH -dNOPAUSE $1 3 | -------------------------------------------------------------------------------- /be/srv/s/r: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec /usr/bin/Rscript --vanilla --slave $1 3 | -------------------------------------------------------------------------------- /be/srv/s/reb: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec /golf/local/rebol-276/rebol -vwq $1 3 | -------------------------------------------------------------------------------- /be/srv/s/sno: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec /golf/local/snobol4-1.4.1/snobol4 $1 3 | -------------------------------------------------------------------------------- /test/t/v.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shinh/ags/master/test/t/v.out -------------------------------------------------------------------------------- /test/t/v.piet: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shinh/ags/master/test/t/v.piet -------------------------------------------------------------------------------- /test/t/v.z8b: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shinh/ags/master/test/t/v.z8b -------------------------------------------------------------------------------- /be/fetcher/jq16: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shinh/ags/master/be/fetcher/jq16 -------------------------------------------------------------------------------- /be/srv/s/_chpl: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | /golf/local/chapel-1.7.0/bin/linux32/chpl $1 3 | -------------------------------------------------------------------------------- /be/srv/s/blsq: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec /golf/local/Burlesque/main_golf --file $1 3 | -------------------------------------------------------------------------------- /be/srv/s/mind: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec /golf/local/mind7/kernel/obj/kernel test 3 | -------------------------------------------------------------------------------- /be/srv/s/mk: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec /golf/ag_launcher -i /usr/bin/make -f $1 3 | -------------------------------------------------------------------------------- /fe/fcgi/nibbles: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shinh/ags/master/fe/fcgi/nibbles -------------------------------------------------------------------------------- /test/t/fizz.com: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shinh/ags/master/test/t/fizz.com -------------------------------------------------------------------------------- /test/t/fizz.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shinh/ags/master/test/t/fizz.out -------------------------------------------------------------------------------- /test/t/nop.com: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shinh/ags/master/test/t/nop.com -------------------------------------------------------------------------------- /test/t/v.grass: -------------------------------------------------------------------------------- 1 | wwWWWWwwWWWWWwWWWWWWWwWwwwwwwWwwwwwWwwwwwWwwwwwwwvWwwwwWww 2 | -------------------------------------------------------------------------------- /test/t/v.pike: -------------------------------------------------------------------------------- 1 | int main() { 2 | write("v"); 3 | return 0; 4 | } 5 | 6 | -------------------------------------------------------------------------------- /be/srv/s/lab: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec ruby2.2 /golf/local/labyrinth/interpreter.rb $1 3 | -------------------------------------------------------------------------------- /be/srv/s/max: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec maxima --very-quiet -r 'batchload("'"$1"'")$' 3 | -------------------------------------------------------------------------------- /test/t/google.rb: -------------------------------------------------------------------------------- 1 | #puts"g#{'o'*gets.to_i}gle" 2 | print:g,'o'*gets.to_i,:gle 3 | -------------------------------------------------------------------------------- /test/t/out.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shinh/ags/master/test/t/out.class -------------------------------------------------------------------------------- /test/t/testing.cob: -------------------------------------------------------------------------------- 1 | ID DIVISION.PROGRAM-ID.h.PROCEDURE DIVISION.DISPLAY'pong'. 2 | -------------------------------------------------------------------------------- /test/t/testing.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shinh/ags/master/test/t/testing.cpp -------------------------------------------------------------------------------- /test/t/testing.cs: -------------------------------------------------------------------------------- 1 | class i{static void Main(){System.Console.WriteLine("pong");}} -------------------------------------------------------------------------------- /test/t/testing.go: -------------------------------------------------------------------------------- 1 | package main 2 | func main() { 3 | print("pong"); 4 | } 5 | -------------------------------------------------------------------------------- /test/t/testing.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shinh/ags/master/test/t/testing.out -------------------------------------------------------------------------------- /test/t/v.clci: -------------------------------------------------------------------------------- 1 | DO,1<-#2 2 | DO,1SUB#1<-#31 3 | DO,1SUB#2<-#30 4 | PLEASE READ OUT,1 -------------------------------------------------------------------------------- /be/srv/s/_cr: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec /golf/local/crystal/bin/crystal build $1 -o a.out 3 | -------------------------------------------------------------------------------- /be/srv/s/_pas: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ln -s /usr/lib/i386-linux-gnu/crt*.o . 3 | gpc -g -O $1 4 | -------------------------------------------------------------------------------- /be/srv/s/hxg: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec ruby1.9.1 /golf/local/hexagony/interpreter.rb $1 3 | -------------------------------------------------------------------------------- /fe/fcgi/z80golf.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shinh/ags/master/fe/fcgi/z80golf.tgz -------------------------------------------------------------------------------- /test/t/fizz.sh: -------------------------------------------------------------------------------- 1 | perl -le 'print $_%15?$_%5?$_%3?$_:Fizz:Buzz:FizzBuzz for(1..100)' 2 | -------------------------------------------------------------------------------- /test/t/fizz_exec.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shinh/ags/master/test/t/fizz_exec.out -------------------------------------------------------------------------------- /test/t/testing.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shinh/ags/master/test/t/testing.class -------------------------------------------------------------------------------- /test/t/testing.erl: -------------------------------------------------------------------------------- 1 | -module(testing). 2 | -export([m/0]). 3 | m()->io:write(pong). 4 | -------------------------------------------------------------------------------- /test/t/testing.mind: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shinh/ags/master/test/t/testing.mind -------------------------------------------------------------------------------- /be/fetcher/dosemu.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shinh/ags/master/be/fetcher/dosemu.tgz -------------------------------------------------------------------------------- /be/fetcher/mb: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | gcc -O -g fetcher/malbolge.c -o /golf/local/malbolge 4 | -------------------------------------------------------------------------------- /be/srv/s/_vhdl: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | mv $1 $2 3 | ghdl -a $2 4 | ghdl -e `basename $2 .vhdl` 5 | 6 | -------------------------------------------------------------------------------- /be/srv/s/wake: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ln -sf /golf/local/wake/std 3 | exec /golf/local/wake/wake $1 4 | -------------------------------------------------------------------------------- /test/t/fizz.pl: -------------------------------------------------------------------------------- 1 | #!perl -l 2 | print $_%15?$_%5?$_%3?$_:Fizz:Buzz:FizzBuzz for(1..100) 3 | 4 | -------------------------------------------------------------------------------- /test/t/mk_hello.rb: -------------------------------------------------------------------------------- 1 | File.open('/tmp/h','w') do |of| 2 | of.puts('Hello, world!') 3 | end 4 | -------------------------------------------------------------------------------- /be/fetcher/FlogScript.php: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shinh/ags/master/be/fetcher/FlogScript.php -------------------------------------------------------------------------------- /be/fetcher/gs2: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cd /golf/local 3 | git clone https://github.com/nooodl/gs2 4 | 5 | -------------------------------------------------------------------------------- /be/srv/s/class: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | m=`basename $2 .class` 3 | mv $1 $m.class 4 | exec java $m 5 | 6 | -------------------------------------------------------------------------------- /be/srv/s/grass: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec /golf/local/grass_ml $1 3 | #exec /golf/local/grass.rb $1 4 | -------------------------------------------------------------------------------- /be/srv/s/qcl: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec /golf/local/qcl-0.6.3/qcl -I /golf/local/qcl-0.6.3/lib -q $1 3 | -------------------------------------------------------------------------------- /test/t/hello_excessout.rb: -------------------------------------------------------------------------------- 1 | loop{ 2 | puts'Hello, world!' 3 | STDERR.puts'foobarbaz' 4 | } 5 | -------------------------------------------------------------------------------- /test/t/testing.sed: -------------------------------------------------------------------------------- 1 | cpong 2 | q 3 | q 4 | q 5 | q 6 | q 7 | q 8 | q 9 | q 10 | q 11 | q -------------------------------------------------------------------------------- /be/fetcher/hxg: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cd /golf/local 4 | git clone https://github.com/m-ender/hexagony 5 | -------------------------------------------------------------------------------- /be/srv/s/_rs: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | PATH=/golf/local/rust/bin:$PATH /golf/local/rust/bin/rustc $1 -o a.out 3 | -------------------------------------------------------------------------------- /be/srv/s/lmn: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec /golf/local/lmntal-20080828/bin/lmnr `basename $1 .lmn`.jar -v0 3 | -------------------------------------------------------------------------------- /test/t/example_net.sh: -------------------------------------------------------------------------------- 1 | wget -q http://www.example.com -O /dev/stdout|sed 's/ble/bl\ne/;s/ *\r//g' 2 | -------------------------------------------------------------------------------- /test/t/fizz_exec.c: -------------------------------------------------------------------------------- 1 | main(){system("perl -le 'print $_%15?$_%5?$_%3?$_:Fizz:Buzz:FizzBuzz for(1..100)'");} -------------------------------------------------------------------------------- /test/t/fizz_exec.l: -------------------------------------------------------------------------------- 1 | (run-program "perl -le 'print $_%15?$_%5?$_%3?$_:Fizz:Buzz:FizzBuzz for(1..100)'") -------------------------------------------------------------------------------- /test/t/fizz_fail.c: -------------------------------------------------------------------------------- 1 | i;main(){for(;i++<99;)printf(i%3?i%5?"%s%d\n":"%s\n":"Fizz%s\n",i%5?"":"Buzz",i);} -------------------------------------------------------------------------------- /test/t/google_wait.rb: -------------------------------------------------------------------------------- 1 | #puts"g#{'o'*gets.to_i}gle" 2 | print:g,'o'*gets.to_i,:gle 3 | sleep(1.2) 4 | -------------------------------------------------------------------------------- /test/t/testing_setpriority.rb: -------------------------------------------------------------------------------- 1 | system %q(ruby -e 'puts"pong"') 2 | Process.setpriority(1764, 11, 0) 3 | -------------------------------------------------------------------------------- /be/conf/sync_conf.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | for i in `find etc -type f`; do 4 | cp /$i $i 5 | done 6 | 7 | -------------------------------------------------------------------------------- /be/fetcher/atl: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | cd /golf/local 4 | git clone https://github.com/darrenks/atlas.git 5 | -------------------------------------------------------------------------------- /be/fetcher/lab: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | cd /golf/local 4 | git clone https://github.com/m-ender/labyrinth 5 | -------------------------------------------------------------------------------- /be/srv/s/nand: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | #exec /golf/local/fernando $1 3 | exec python /golf/local/fernando.py $1 4 | -------------------------------------------------------------------------------- /fe/conf/sync_conf.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | for i in `find etc -type f`; do 4 | cp /$i $i 5 | done 6 | 7 | -------------------------------------------------------------------------------- /test/t/testing.java: -------------------------------------------------------------------------------- 1 | class testing{public static void main(String[]a){System.out.print("pong");} } 2 | -------------------------------------------------------------------------------- /test/t/testing.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import random 3 | import os 4 | s = os.system 5 | for x in ["pong"]: print x -------------------------------------------------------------------------------- /be/fetcher/fsh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | cd /golf/local 4 | git clone https://gist.github.com/6392418.git fish 5 | -------------------------------------------------------------------------------- /be/srv/s/adb: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | export LD_PRELOAD=$LD_PRELOAD:/lib/i386-linux-gnu/libSegFault.so 3 | exec ./a.out 4 | -------------------------------------------------------------------------------- /be/srv/s/c: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | export LD_PRELOAD=$LD_PRELOAD:/lib/i386-linux-gnu/libSegFault.so 3 | exec ./a.out 4 | -------------------------------------------------------------------------------- /be/srv/s/chpl: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | export LD_PRELOAD=$LD_PRELOAD:/lib/i386-linux-gnu/libSegFault.so 3 | exec ./a.out 4 | -------------------------------------------------------------------------------- /be/srv/s/cob: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | export LD_PRELOAD=$LD_PRELOAD:/lib/i386-linux-gnu/libSegFault.so 3 | exec ./a.out 4 | -------------------------------------------------------------------------------- /be/srv/s/cpp: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | export LD_PRELOAD=$LD_PRELOAD:/lib/i386-linux-gnu/libSegFault.so 3 | exec ./a.out 4 | -------------------------------------------------------------------------------- /be/srv/s/cr: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | export LD_PRELOAD=$LD_PRELOAD:/lib/i386-linux-gnu/libSegFault.so 3 | exec ./a.out 4 | -------------------------------------------------------------------------------- /be/srv/s/d: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | export LD_PRELOAD=$LD_PRELOAD:/lib/i386-linux-gnu/libSegFault.so 3 | exec ./a.out 4 | -------------------------------------------------------------------------------- /be/srv/s/f95: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | export LD_PRELOAD=$LD_PRELOAD:/lib/i386-linux-gnu/libSegFault.so 3 | exec ./a.out 4 | -------------------------------------------------------------------------------- /be/srv/s/m: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | export LD_PRELOAD=$LD_PRELOAD:/lib/i386-linux-gnu/libSegFault.so 3 | exec ./a.out 4 | -------------------------------------------------------------------------------- /be/srv/s/pas: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | export LD_PRELOAD=$LD_PRELOAD:/lib/i386-linux-gnu/libSegFault.so 3 | exec ./a.out 4 | -------------------------------------------------------------------------------- /be/srv/s/s: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | export LD_PRELOAD=$LD_PRELOAD:/lib/i386-linux-gnu/libSegFault.so 3 | exec ./a.out 4 | -------------------------------------------------------------------------------- /be/srv/s/vi: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cat > /tmp/out 3 | TERM=dumb vi -s $1 /tmp/out > /dev/null 2>&1 4 | cat /tmp/out 5 | -------------------------------------------------------------------------------- /be/srv/s/curry: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | export LD_PRELOAD=$LD_PRELOAD:/lib/i386-linux-gnu/libSegFault.so 3 | exec ./a.out 4 | -------------------------------------------------------------------------------- /be/srv/s/go: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | export LD_PRELOAD=$LD_PRELOAD:/lib/i386-linux-gnu/libSegFault.so 3 | exec ./a.out 2>&1 4 | -------------------------------------------------------------------------------- /be/srv/s/icn: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | export LD_PRELOAD=$LD_PRELOAD:/lib/i386-linux-gnu/libSegFault.so 3 | exec iconx ./test 4 | -------------------------------------------------------------------------------- /test/t/hello.aheui: -------------------------------------------------------------------------------- 1 | 밣붍맣뱓몋두붖멓 2 | 뭏따맣불뽀뿌다맣 3 | 뭏누뻐쀀쀀쀀떠묳 4 | 붖다뭏다쀀쀀뽀도 5 | 뚜붇뱛몋도뼈타뭏 6 | 붖나빠밠다맣볼뵳 7 | 다맣맣희지민제작 8 | 9 | -------------------------------------------------------------------------------- /be/srv/s/_iog: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ruby3.2 /golf/local/iogii $1 -hs > /tmp/out.hs 3 | ghc-8.0.2 -O /tmp/out.hs -o /tmp/a.out 4 | -------------------------------------------------------------------------------- /fe/fcgi/tools/update_version.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -ex 2 | 3 | cd `dirname $0` 4 | ruby check_version.rb > ../version.txt 5 | 6 | -------------------------------------------------------------------------------- /be/fetcher/aheui: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | cd /golf/local 4 | git clone https://github.com/aheui/caheui 5 | cd caheui 6 | make 7 | -------------------------------------------------------------------------------- /be/fetcher/bfsl: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | cd /golf/local 4 | git clone https://github.com/yshl/MNNBFSL 5 | cd MNNBFSL 6 | make 7 | -------------------------------------------------------------------------------- /be/fetcher/k: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | cd /golf/local 4 | git clone https://github.com/kevinlawler/kona/ 5 | cd kona 6 | make 7 | -------------------------------------------------------------------------------- /be/srv/s/_erl: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | export HOME=/home/golf 3 | m=`basename $2 .erl` 4 | mv test.erl $m.erl 5 | erl -compile $m 6 | 7 | -------------------------------------------------------------------------------- /test/t/hello_timeout.d: -------------------------------------------------------------------------------- 1 | // http://golf.shinh.org/reveal.rb?Timeout/kurimura/1190023767&di 2 | _ A(_)(_){A!(_*);}int _=A(_); 3 | -------------------------------------------------------------------------------- /test/t/testing.pef: -------------------------------------------------------------------------------- 1 | &v 2 | v?|"p"\2! 3 | >&v 4 | v?|"o"\2! 5 | >&v 6 | v?|"n"\2! 7 | >&v 8 | v?|"g"\2! 9 | >01-&2! 10 | -------------------------------------------------------------------------------- /test/t/testing.vhdl: -------------------------------------------------------------------------------- 1 | use std.textio.all;entity testing is end;architecture s of testing is 2 | begin 3 | write(output,"pong");end; -------------------------------------------------------------------------------- /be/srv/s/bef: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | export LD_PRELOAD=$LD_PRELOAD:/lib/i386-linux-gnu/libSegFault.so 3 | exec /golf/local/befunge -i -q $1 4 | -------------------------------------------------------------------------------- /be/srv/s/hs: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | export LD_PRELOAD=$LD_PRELOAD:/lib/i386-linux-gnu/libSegFault.so 3 | export LANG=C 4 | exec ./a.out 5 | -------------------------------------------------------------------------------- /be/srv/s/jelly: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | export PYTHONPATH=/golf/local/jellylanguage 3 | exec python3 /golf/local/jellylanguage/jelly fu $1 4 | -------------------------------------------------------------------------------- /be/srv/s/rs: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | export LD_PRELOAD=$LD_PRELOAD:/lib/i386-linux-gnu/libSegFault.so 3 | export LANG=C 4 | exec ./a.out 5 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | A golf server 2 | 3 | A document for its sandbox: 4 | 5 | http://shinhoge.blogspot.jp/2014/10/sandbox-of-my-golf-server.html 6 | -------------------------------------------------------------------------------- /be/srv/s/_java: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | m=`basename $2 .java` 4 | mv $1 $m.java 5 | javac -g $m.java 6 | 7 | #gcj --main=$m -g -O $m.java 8 | -------------------------------------------------------------------------------- /be/srv/s/_nbb: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | /golf/local/nibbles/nibbles -hs $1 3 | cd /golf/local/nibbles 4 | ghc-8.0.2 -O /tmp/out.hs -o /tmp/a.out 5 | -------------------------------------------------------------------------------- /be/srv/s/arc: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cd /golf/local/arc3 && exec /golf/local/plt/bin/mzscheme -m -v -f as2.scm -e '(aload "/golf/test/'$1'")' 3 | -------------------------------------------------------------------------------- /be/srv/s/bef98: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | export LD_PRELOAD=$LD_PRELOAD:/lib/i386-linux-gnu/libSegFault.so 3 | exec /golf/local/ccbi-2.1/ccbi $1 4 | -------------------------------------------------------------------------------- /fe/fcgi/env.rb: -------------------------------------------------------------------------------- 1 | require 'handler' 2 | 3 | class Env < Handler 4 | def handle_ 5 | html_header 6 | p @e 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /test/t/echo.max: -------------------------------------------------------------------------------- 1 | a:openr("/dev/stdin")$ 2 | print(readline(a))$ 3 | print(readline(a))$ 4 | print(readline(a))$ 5 | print(readline(a))$ 6 | -------------------------------------------------------------------------------- /test/t/out.java: -------------------------------------------------------------------------------- 1 | public class out { 2 | public static void main(String[] args) { 3 | System.out.println("pong"); 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /test/t/testing.lazy: -------------------------------------------------------------------------------- 1 | ``si`k``s``s`ks``s`kk``s`ks``s`k`sik`k``s`kk``s``s`ks``s`k`si``s`kk``s`k`s``s`ksk``s``si`k`ki`kk``s`kk``si`k`ki 2 | -------------------------------------------------------------------------------- /be/srv/s/iog: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | export LD_PRELOAD=$LD_PRELOAD:/lib/i386-linux-gnu/libSegFault.so 3 | export LC_ALL=en_US.UTF-8 4 | exec ./a.out 5 | -------------------------------------------------------------------------------- /be/srv/s/nbb: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | export LD_PRELOAD=$LD_PRELOAD:/lib/i386-linux-gnu/libSegFault.so 3 | export LC_ALL=en_US.UTF-8 4 | exec ./a.out 5 | -------------------------------------------------------------------------------- /be/srv/s/_mind: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | /golf/local/nkf -e $1 > test.src 3 | /golf/local/mind7/bin/mind test /golf/local/mind7/lib/file | /golf/local/nkf 4 | -------------------------------------------------------------------------------- /be/srv/s/out: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | export LD_PRELOAD=$LD_PRELOAD:/lib/i386-linux-gnu/libSegFault.so 3 | chmod 755 $1 4 | exec /golf/ag_launcher ./$1 5 | -------------------------------------------------------------------------------- /be/fetcher/bf8: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | cd /golf/local 4 | git clone https://github.com/rdebath/Brainfuck 5 | cd /golf/local/Brainfuck/tritium 6 | make 7 | -------------------------------------------------------------------------------- /be/fetcher/go: -------------------------------------------------------------------------------- 1 | #!/bin/sh -ex 2 | 3 | GO=go1.9.2.linux-386.tar.gz 4 | cd /golf/local 5 | wget https://dl.google.com/go/${GO} 6 | tar -xvzf ${GO} 7 | 8 | -------------------------------------------------------------------------------- /be/srv/s/bf8: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # We use 8bit cells and 0 EOF to maximize diff from the other 4 | exec /golf/local/Brainfuck/tritium/bfi -b -z $1 5 | -------------------------------------------------------------------------------- /be/srv/s/erl: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | export HOME=/home/golf 3 | m=`basename $2 .erl` 4 | #mv test.beam $m.beam 5 | erl -noshell -s $m m -s erlang halt 6 | 7 | -------------------------------------------------------------------------------- /test/t/v.hxg: -------------------------------------------------------------------------------- 1 | v ; @ ; 2 | l ; d ; * 3 | ; r ; o ; W 4 | l ; ; o ; * 4 5 | 3 3 ; @ . > 6 | ; 2 3 < \ 7 | 4 ; * / 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /test/t/google.d: -------------------------------------------------------------------------------- 1 | import std.string,std.cstream,std.conv;int l;void main(){l=to!(long)(din.readLine());dout.writef("g%sgle",replace(zfill("",l),"0","o"));} 2 | -------------------------------------------------------------------------------- /test/t/testing.ws: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /test/t/v.fish: -------------------------------------------------------------------------------- 1 | ls > /dev/null 2 | ls > /dev/null 3 | ls > /dev/null 4 | ls > /dev/null 5 | ls > /dev/null 6 | ls > /dev/null 7 | ls > /dev/null 8 | echo v 9 | -------------------------------------------------------------------------------- /test/t/v.zsh: -------------------------------------------------------------------------------- 1 | ls > /dev/null 2 | ls > /dev/null 3 | ls > /dev/null 4 | ls > /dev/null 5 | ls > /dev/null 6 | ls > /dev/null 7 | ls > /dev/null 8 | echo v 9 | -------------------------------------------------------------------------------- /be/srv/s/clj: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | exec java -cp /golf/local/clojure-1.1.0/clojure.jar:/golf/local/clojure-contrib-1.1.0/clojure-contrib.jar \ 3 | clojure.main $1 4 | -------------------------------------------------------------------------------- /test/t/fizz.di: -------------------------------------------------------------------------------- 1 | import std.metastrings;class C(int i){const char[]x=i%3?i%5?Format!(i):"Buzz":i%5?"Fizz":"FizzBuzz";pragma(msg,x);static if(i<100)C!(i+1)c;}C!(1)c; -------------------------------------------------------------------------------- /test/t/testing.s: -------------------------------------------------------------------------------- 1 | .globl main 2 | main: push $.d 3 | call puts 4 | pop %eax 5 | ret 6 | .d: .ascii "pong" 7 | .byte 0 8 | 9 | -------------------------------------------------------------------------------- /be/fetcher/wake: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | cd /golf/local 4 | rm -fr wake.tgz wake 5 | wget http://shinh.skr.jp/wake/wake.tgz 6 | tar -xvzf wake.tgz 7 | cd wake 8 | make 9 | -------------------------------------------------------------------------------- /test/t/hello.bfsl: -------------------------------------------------------------------------------- 1 | [<"++++++++[>++++<-"][]"++++"[->+<"][]."+"+[->++<"][]"".+++++++"".."+++".>>>"+++ 2 | +++++++++.".<<<"++++++++.".+++..-.+ . 3 | -------------------------------------------------------------------------------- /be/fetcher/exu: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | cd /golf/local 4 | EXU=euphor31.tar 5 | rm -fr $EXU euphoria 6 | wget http://www.rapideuphoria.com/31/euphor31.tar 7 | tar -xvzf $EXU 8 | -------------------------------------------------------------------------------- /be/srv/s/di: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | b=`basename $1 .di` 3 | mv $1 $b.d 4 | exec /golf/local/dmd/linux/bin/dmd -L-L/golf/local/dmd/lib -I/golf/local/dmd/src/phobos -c -ofa.out $b.d 2>&1 5 | -------------------------------------------------------------------------------- /be/srv/s/java: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | #export LD_PRELOAD=/lib/i386-linux-gnu/libSegFault.so 3 | #exec ./a.out 4 | 5 | m=`basename $2 .java` 6 | #mv $1 $m.class 7 | exec java $m 8 | 9 | -------------------------------------------------------------------------------- /be/fetcher/d: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | cd /golf/local 4 | DMD=dmd.1.047.zip 5 | rm -fr $DMD dmd 6 | wget http://ftp.digitalmars.com/$DMD 7 | unzip $DMD 8 | chmod 755 dmd/linux/bin/dmd 9 | -------------------------------------------------------------------------------- /be/srv/old/limit: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ulimit -v 1000000 3 | rm -f /golf/test/watch.log 4 | if [ $1 != ../s/com ]; then 5 | export LD_PRELOAD=/golf/local/watch.so 6 | fi 7 | exec $@ 8 | -------------------------------------------------------------------------------- /be/fetcher/arc: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | cp fetcher/as.scm /golf/local 4 | cd /golf/local 5 | wget http://ycombinator.com/arc/arc3.tar 6 | tar -xvf arc3.tar 7 | cp as.scm arc3/as2.scm 8 | 9 | -------------------------------------------------------------------------------- /be/fetcher/jelly: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cd /golf/local 3 | git clone https://github.com/shinh/jellylanguage && cd jellylanguage && git checkout 2f7103853033b2f04a419ca737011dc4c4c22196 4 | 5 | -------------------------------------------------------------------------------- /be/fetcher/piet: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | cd /golf/local 4 | wget http://www.bertnase.de/npiet/npiet-1.3a.tar.gz 5 | tar -xvzf npiet-1.3a.tar.gz 6 | cd npiet-1.3a 7 | ./configure 8 | make 9 | -------------------------------------------------------------------------------- /be/srv/Makefile: -------------------------------------------------------------------------------- 1 | TARGETS = remount ag_launcher 2 | 3 | all: $(TARGETS) 4 | 5 | remount: remount.c 6 | 7 | ag_launcher: ag_launcher.c 8 | 9 | clean: 10 | rm -f $(TARGETS) 11 | -------------------------------------------------------------------------------- /be/fetcher/bef98: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | CCBI=ccbi-2.1-linux-x86-32.txz 4 | 5 | cd /golf/local 6 | wget http://users.tkk.fi/~mniemenm/files/befunge/interpreters/ccbi/$CCBI 7 | tar -xvf $CCBI 8 | -------------------------------------------------------------------------------- /be/fetcher/iog: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | name=iogii-1.0.1 4 | 5 | cd /golf/local 6 | wget https://golfscript.com/iogii/${name} --no-check-certificate 7 | mv ${name} iogii 8 | chmod 755 iogii 9 | -------------------------------------------------------------------------------- /be/fetcher/sno: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | cd /golf/local 4 | wget ftp://ftp.ultimate.com/snobol/snobol4-1.4.1.tar.gz 5 | tar -xvzf snobol4-1.4.1.tar.gz 6 | cd snobol4-1.4.1 7 | ./configure 8 | make 9 | -------------------------------------------------------------------------------- /be/srv/s/com: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | export HOME=/home/golf 3 | #dosemu -quiet -dumb $1 > log 4 | tar -C $HOME -xzf /golf/local/dosemu.tgz 5 | exec dosemu -quiet -dumb $1 6 | #exec dosemu.bin $1 7 | #cat log 8 | -------------------------------------------------------------------------------- /be/srv/s/pl6: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | #exec /golf/local/rakudo/parrot_install/bin/perl6 $1 3 | exec /golf/local/rakudo/install/bin/perl6 $1 4 | #exec /golf/local/rakudo-star-2010.07/perl6 $1 5 | #exec perl6 $1 6 | -------------------------------------------------------------------------------- /be/fetcher/chpl: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | CHPL=chapel-1.7.0 4 | 5 | cd /golf/local 6 | wget http://downloads.sourceforge.net/project/chapel/chapel/1.7.0/$CHPL.tar.gz 7 | tar -xvzf $CHPL.tar.gz 8 | cd $CHPL 9 | -------------------------------------------------------------------------------- /be/fetcher/kt: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | wget http://www.kite-language.org/files/kite-1.0.3.tar.gz 4 | tar -xvzf kite-1.0.3.tar.gz 5 | cd kite-1.0.3 6 | ./configure 7 | make 8 | make install 9 | 10 | -------------------------------------------------------------------------------- /be/fetcher/nbb: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | cd /golf/local 4 | wget http://golfscript.com/nibbles/nibbles-1.00.tgz --no-check-certificate 5 | tar -xvzf nibbles-1.00.tgz 6 | cd nibbles 7 | ghc -package ghc -O -Wno-tabs nibbles 8 | -------------------------------------------------------------------------------- /fe/fcgi/tools/dumppstore.rb: -------------------------------------------------------------------------------- 1 | require 'pstore' 2 | 3 | db = PStore.new(ARGV[0]) 4 | db.transaction do 5 | if ARGV[1] == '-y' 6 | print db['root'].to_yaml 7 | else 8 | p db 9 | end 10 | end 11 | 12 | -------------------------------------------------------------------------------- /test/t/testing.sh: -------------------------------------------------------------------------------- 1 | tr i o 2 | echo 3 | echo 4 | echo 5 | echo 6 | echo 7 | echo 8 | echo 9 | echo 10 | echo 11 | echo 12 | echo 13 | echo 14 | echo 15 | echo 16 | echo 17 | echo 18 | echo 19 | echo 20 | echo 21 | echo 22 | -------------------------------------------------------------------------------- /be/fetcher/cr: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | cd /golf/local 4 | wget https://github.com/manastech/crystal/releases/download/0.9.1/crystal-0.9.1-1-linux-i686.tar.gz 5 | tar -xvzf crystal-0.9.1-1-linux-i686.tar.gz 6 | ln -s crystal-0.9.1-1 crystal 7 | -------------------------------------------------------------------------------- /be/fetcher/pl6: -------------------------------------------------------------------------------- 1 | # Run the following commands in host 2 | # 3 | # cd /golf/local 4 | # git clone git://github.com/rakudo/rakudo.git 5 | # cd rakudo 6 | # perl Configure.pl --gen-moar 7 | # make 8 | # make install 9 | exit 1 10 | 11 | -------------------------------------------------------------------------------- /test/t/v.reb: -------------------------------------------------------------------------------- 1 | REBOL [ 2 | Title: "v" 3 | Author: oofoe@rocketage.obfuscated.org 4 | Date: 2009-02-08 5 | Purpose: "http://golf.shinh.org/p.rb?v" 6 | Runwith: "rebview -vw v.r" 7 | ] 8 | 9 | print system/script/title 10 | -------------------------------------------------------------------------------- /be/fetcher/rust: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | RUST=rust-1.8.0-i686-unknown-linux-gnu 4 | 5 | cd /golf/local 6 | wget http://static.rust-lang.org/dist/$RUST.tar.gz 7 | tar -xvzf $RUST.tar.gz 8 | cd $RUST 9 | ./install.sh --prefix=/golf/local/rust 10 | -------------------------------------------------------------------------------- /be/fetcher/rb3: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | cd /golf/local 4 | curl -kO https://cache.ruby-lang.org/pub/ruby/3.2/ruby-3.2.0.tar.xz 5 | tar -xvf ruby-3.2.0.tar.xz 6 | cd ruby-3.2.0 7 | ./configure --program-suffix=3.2 --disable-install-doc && make && make install 8 | -------------------------------------------------------------------------------- /test/t/google.c: -------------------------------------------------------------------------------- 1 | //g[];main(i,c){for(i=atoi(gets(c));i--;)strcat(g,"o");printf("g%sgle",g);} 2 | char g[];main(i){for(i=atoi(gets(g));i--;)g[i]='o';printf("g%sgle",g);} 3 | //char g[];main(i){for(;--i>-99;)g[-i]='o';printf("g%.*sgle",atoi(gets()),g);} 4 | -------------------------------------------------------------------------------- /be/modules/Makefile: -------------------------------------------------------------------------------- 1 | TARGETS = sandbox.ko getvals reset syscalls 2 | obj-m := sandbox.o 3 | 4 | all: $(TARGETS) 5 | 6 | sandbox.ko: sandbox.c 7 | $(MAKE) -C /lib/modules/`uname -r`/build SUBDIRS=`pwd` modules 8 | 9 | clean: 10 | rm -f $(TARGETS) 11 | -------------------------------------------------------------------------------- /be/srv/setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -x 2 | 3 | # for dosemu 4 | mkdir -p /media/CDROM 5 | 6 | rm -rf /tmp 7 | ln -s /dev/shm /tmp 8 | 9 | cd /var 10 | rm -rf tmp 11 | ln -s /tmp 12 | 13 | cd /home 14 | rm -rf golf 15 | ln -s /tmp golf 16 | 17 | chmod 755 /var/lock 18 | -------------------------------------------------------------------------------- /test/t/fizz.cs: -------------------------------------------------------------------------------- 1 | class i{static void Main(){for(int i=0;i++<100;)System.Console.WriteLine(i%3>0?i%5>0?""+i:"Buzz":i%5>0?"Fizz":"FizzBuzz");}} 2 | //class i{static void Main(){for(int i=0;i++<100;)System.Console.WriteLine(i%3>0?i%5>0?""+i:"Buzz":i%5>0?"Fizz":"FizzBuzz");}} -------------------------------------------------------------------------------- /test/t/fizz_fail.cs: -------------------------------------------------------------------------------- 1 | class i{static void Main(){for(int i=0;i++<99;)System.Console.WriteLine(i%3>0?i%5>0?""+i:"Buzz":i%5>0?"Fizz":"FizzBuzz");}} 2 | //class i{static void Main(){for(int i=0;i++<100;)System.Console.WriteLine(i%3>0?i%5>0?""+i:"Buzz":i%5>0?"Fizz":"FizzBuzz");}} -------------------------------------------------------------------------------- /be/srv/s/ijs: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | export HOME=/tmp 4 | 5 | exec /golf/local/j602/bin/jconsole $1 6 | 7 | #exec /golf/local/j701/bin/jconsole $1 8 | 9 | #export HOME=/golf/local 10 | #export LD_LIBRARY_PATH=$HOME/j601 11 | #exec $HOME/j601/jconsole $1 12 | 13 | 14 | -------------------------------------------------------------------------------- /test/t/v.reb~: -------------------------------------------------------------------------------- 1 | REBOL [ 2 | Title: "Hello, world!" 3 | Author: oofoe@rocketage.obfuscated.org 4 | Date: 2009-02-08 5 | Purpose: "http://golf.shinh.org/p.rb?hello+world" 6 | Runwith: "rebview -vw hello_world.r" 7 | ] 8 | 9 | print system/script/title 10 | -------------------------------------------------------------------------------- /be/fetcher/hs: -------------------------------------------------------------------------------- 1 | # Run the following commands in BE 2 | # 3 | # cd 4 | # wget http://downloads.haskell.org/~ghc/8.0.2/ghc-8.0.2-i386-deb7-linux.tar.xz 5 | # tar -xvf ghc-8.0.2-i386-deb7-linux.tar.xz 6 | # cd ghc-8.0.2 7 | # ./configure 8 | # make install 9 | exit 1 10 | 11 | -------------------------------------------------------------------------------- /test/t/fizz_exec.cs: -------------------------------------------------------------------------------- 1 | class i{static void Main(){System.Diagnostics.Process.Start("perl -le 'print $_%15?$_%5?$_%3?$_:Fizz:Buzz:FizzBuzz for(1..100)'");}} 2 | //class i{static void Main(){for(int i=0;i++<100;)System.Console.WriteLine(i%3>0?i%5>0?""+i:"Buzz":i%5>0?"Fizz":"FizzBuzz");}} -------------------------------------------------------------------------------- /test/t/hello.reb: -------------------------------------------------------------------------------- 1 | REBOL [ 2 | Title: "Hello, world!" 3 | Author: oofoe@rocketage.obfuscated.org 4 | Date: 2009-02-08 5 | Purpose: "http://golf.shinh.org/p.rb?hello+world" 6 | Runwith: "rebview -vw hello_world.r" 7 | ] 8 | 9 | print system/script/title 10 | -------------------------------------------------------------------------------- /be/fetcher/curry: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | wget http://danae.uni-muenster.de/~lux/curry/download/curry-0.9.11/curry-0.9.11-i686-linux-gnu.tar.gz 4 | tar -xvzf curry-0.9.11-i686-linux-gnu.tar.gz 5 | cd curry-0.9.11-i686-linux-gnu 6 | ./configure 7 | make 8 | make install 9 | 10 | -------------------------------------------------------------------------------- /be/fetcher/nut: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | SQ=squirrel_3_1_beta1.tar.gz 4 | 5 | cd /golf/local 6 | wget http://squirrel.googlecode.com/files/squirrel_3_1_beta1.tar.gz 7 | #wget http://code.google.com/p/squirrel/downloads/detail?name=$SQ -O $SQ 8 | tar -xvzf $SQ 9 | cd SQUIRREL3 10 | make 11 | -------------------------------------------------------------------------------- /be/srv/s/_go: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | export PATH=/golf/local/gobin:$PATH 3 | export GOROOT=/golf/local/go 4 | export GOARCH=386 5 | export GOOS=linux 6 | /golf/local/go/bin/go build -o a.out $1 7 | #export GOBIN=/golf/local/gobin 8 | #/golf/local/gobin/8g -o test.8 $1 && /golf/local/gobin/8l -o a.out test.8 9 | -------------------------------------------------------------------------------- /be/conf/etc/apt/preferences: -------------------------------------------------------------------------------- 1 | Package: * 2 | Pin: release a=testing 3 | Pin-Priority: 700 4 | 5 | Package: * 6 | Pin: release a=unstable 7 | Pin-Priority: 600 8 | 9 | Package: * 10 | Pin: release a=stable 11 | Pin-Priority: 500 12 | 13 | Package: * 14 | Pin: release a=lenny 15 | Pin-Priority: 400 16 | -------------------------------------------------------------------------------- /be/fetcher/blsq: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | dir=$(pwd) 4 | 5 | cabal install split web-encodings mtl regex-compat parsec digits statistics 6 | 7 | cd /golf/local 8 | git clone git://github.com/FMNSSun/Burlesque.git 9 | cd Burlesque 10 | #git apply ${dir}/fetcher/blsq.patch 11 | ghc main_golf.hs 12 | 13 | 14 | -------------------------------------------------------------------------------- /fe/fcgi/marshalp.rb: -------------------------------------------------------------------------------- 1 | require 'handler' 2 | 3 | class Marshalp < Handler 4 | def handle_ 5 | text_header 6 | pn, pa = page 7 | db = 'db/' + pn + '.db' 8 | if !File.exist?(db) 9 | puts 'page not found' 10 | return 11 | end 12 | print File.read(db) 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /be/fetcher/grb: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | cd /golf/local 4 | RUBY=ruby-1.9.2-p290 5 | RUBY_PKG=$RUBY.tar.bz2 6 | rm -fr $RUBY $RUBY_PKG 7 | wget http://ftp.ruby-lang.org/pub/ruby/$RUBY_PKG 8 | tar -xvjf $RUBY_PKG 9 | cd $RUBY 10 | ./configure --program-suffix=-1.9 11 | make 12 | make golf 13 | make install-nodoc 14 | -------------------------------------------------------------------------------- /fe/fcgi/tools/lang_population.rb: -------------------------------------------------------------------------------- 1 | require 'pstore' 2 | m=Hash.new{0} 3 | `find db/ -name _ranks.db`.each do |l| 4 | db = PStore.new(l.chomp) 5 | db.transaction(true) do 6 | db.roots.each do |k| 7 | m[k] += db[k].size 8 | end 9 | end 10 | end 11 | m.each do |k, v| 12 | puts "#{v} #{k}" 13 | end 14 | -------------------------------------------------------------------------------- /fe/fcgi/tools/maintenance.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | cd `dirname $0` 4 | cd .. 5 | 6 | if [ "x$1" = "xstart" ]; then 7 | touch maintenance 8 | touch handler.rb 9 | elif [ "x$1" = "xstop" ]; then 10 | rm -f maintenance 11 | touch handler.rb 12 | else 13 | echo "Usage: $0 [start|stop]" 14 | exit 1 15 | fi 16 | -------------------------------------------------------------------------------- /be/fetcher/as.scm: -------------------------------------------------------------------------------- 1 | ; mzscheme -m -f as.scm 2 | ; (tl) 3 | ; (asv) 4 | ; http://localhost:8080 5 | 6 | (require mzscheme) ; promise we won't redefine mzscheme bindings 7 | 8 | (require "ac.scm") 9 | (require "brackets.scm") 10 | (use-bracket-readtable) 11 | 12 | (aload "arc.arc") 13 | (aload "libs.arc") 14 | 15 | ;(tl) 16 | 17 | -------------------------------------------------------------------------------- /be/srv/s/_d: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | /golf/local/dmd2/bin/dmd -L-L/golf/local/dmd2/lib -I/golf/local/dmd2/src/phobos -g -O -ofa.out $1 3 | #/golf/local/dmd2/linux/bin/dmd -L-L/golf/local/dmd2/lib -I/golf/local/dmd2/src/phobos -g -O -ofa.out $1 4 | #/golf/local/dmd/bin/dmd -L-L/golf/local/dmd/lib -I/golf/local/dmd/src/phobos -g -O -ofa.out $1 5 | 6 | -------------------------------------------------------------------------------- /fe/fcgi/jsonp.rb: -------------------------------------------------------------------------------- 1 | require 'handler' 2 | require 'json' 3 | 4 | class Jsonp < Handler 5 | def handle_ 6 | text_header 7 | pn, pa = page 8 | db = 'db/' + pn + '.db' 9 | if !File.exist?(db) 10 | puts 'page not found' 11 | return 12 | end 13 | print JSON.dump(Marshal.load(File.read(db))) 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /fe/fcgi/yamlp.rb: -------------------------------------------------------------------------------- 1 | require 'handler' 2 | require 'yaml' 3 | 4 | class Yamlp < Handler 5 | def handle_ 6 | text_header 7 | pn, pa = page 8 | db = 'db/' + pn + '.db' 9 | if !File.exist?(db) 10 | puts 'page not found' 11 | return 12 | end 13 | print YAML.dump(Marshal.load(File.read(db))) 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /be/fetcher/xgawk: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | wget 'http://sourceforge.net/projects/xmlgawk/files/xgawk/xgawk-3.1.6-20080101.tar.gz/xgawk-3.1.6-20080101.tar.gz' 4 | tar -xvzf xgawk-3.1.6-20080101.tar.gz 5 | cd xgawk-3.1.6-20080101 6 | 7 | patch -p0 < ../fetcher/xgawk.diff 8 | 9 | ./configure --enable-static-extensions 10 | make 11 | make install 12 | 13 | -------------------------------------------------------------------------------- /fe/fcgi/tools/fixdeadline.rb: -------------------------------------------------------------------------------- 1 | require 'pstore' 2 | db=PStore.new('db/problem.db') 3 | db.transaction do 4 | a=[] 5 | db['root'].each do |pn| 6 | puts pn 7 | pdb=PStore.new("db/#{pn}.db") 8 | pdb.transaction(true) do 9 | p pdb['deadline'] 10 | a << pdb['deadline'] 11 | end 12 | end 13 | p a 14 | db['deadline'] = a 15 | end 16 | 17 | -------------------------------------------------------------------------------- /test/t/google.hs: -------------------------------------------------------------------------------- 1 | --main=do x<-readLn;putStr$'g':map(\v->'o')[1..x]++"gle" 2 | --main=readLn>>=(\x->putStr$'g':map(\v->'o')[1..x]++"gle") 3 | --main=interact(\x->'g':map(\v->'o')[1..read x]++"gle") 4 | main=interact(\x->'g':replicate(read x)'o'++"gle") 5 | --main=interact(\x->'g':take(read x)['o','o'..]++"gle") 6 | --main=readLn>>=(\x->putStr$'g':replicate x 'o'++"gle") 7 | 8 | -------------------------------------------------------------------------------- /fe/pkgs.txt: -------------------------------------------------------------------------------- 1 | xen-hypervisor-4.1-i386 2 | xen-linux-system-2.6-xen-686 3 | xen-tools 4 | libc6-xen 5 | bridge-utils 6 | lighttpd 7 | ruby 8 | lv 9 | psmisc 10 | strace 11 | xenwatch 12 | git-core 13 | xorg 14 | gcc 15 | libfcgi-ruby1.8 16 | libfcgi-ruby1.9.1 17 | ruby1.9.1 18 | gdb 19 | z80dasm 20 | subversion 21 | curl 22 | libjson-ruby 23 | linux-image-2.6.32-5-xen-686 24 | 25 | -------------------------------------------------------------------------------- /be/fetcher/j: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | cd /golf/local 4 | #wget http://www.jsoftware.com/download/j601c_linux.tar.gz 5 | #tar -xvzf j601c_linux.tar.gz 6 | 7 | #wget http://www.jsoftware.com/download/j701a_linux32.sh 8 | #sh ./j701a_linux32.sh -install /golf/local 9 | 10 | wget http://www.jsoftware.com/download/j602a_linux32.sh 11 | sh ./j602a_linux32.sh -install /golf/local 12 | 13 | -------------------------------------------------------------------------------- /test/t/daemon.rb: -------------------------------------------------------------------------------- 1 | def daemon 2 | catch(:RUN_DAEMON) do 3 | unless (fork) then 4 | Process::setsid 5 | unless (fork) then 6 | Dir::chdir("/") 7 | File::umask(0) 8 | STDIN.close 9 | STDOUT.close 10 | STDERR.close 11 | throw :RUN_DAEMON 12 | end 13 | end 14 | exit! 15 | end 16 | end 17 | 18 | daemon 19 | sleep 20 | -------------------------------------------------------------------------------- /fe/masquerade.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | case "$1" in 4 | start) 5 | echo 1 > /proc/sys/net/ipv4/ip_forward 6 | iptables -t nat -A POSTROUTING -o xenbr1 -j MASQUERADE 7 | ;; 8 | stop) 9 | echo 0 > /proc/sys/net/ipv4/ip_forward 10 | iptables -t nat -D POSTROUTING -o xenbr1 -j MASQUERADE 11 | ;; 12 | *) 13 | echo "Usage: $0 {start|stop}" 14 | exit 2 15 | esac 16 | exit $? 17 | -------------------------------------------------------------------------------- /be/srv/remount.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | int main() { 5 | sync(); 6 | if (umount("/golf/test") != 0) { 7 | perror("umount"); 8 | // It's not so serious. 9 | //return 1; 10 | } 11 | if (mount("devshm", "/golf/test", "tmpfs", MS_MGC_VAL, NULL) != 0) { 12 | perror("mount"); 13 | return 1; 14 | } 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /fe/fcgi/tools/delprob.rb: -------------------------------------------------------------------------------- 1 | require 'pstore' 2 | db=PStore.new('db/problem.db') 3 | db.transaction do 4 | prob = ARGV[0] 5 | i = db['root'].index(prob) 6 | if !i 7 | puts 'not found' 8 | #p db['root'] 9 | exit 1 10 | end 11 | p db['root'][i] 12 | p Time.at(db['deadline'][i] || 0) 13 | 14 | if ARGV[1] == '-f' 15 | db['root'].delete_at(i) 16 | db['deadline'].delete_at(i) 17 | end 18 | end 19 | 20 | -------------------------------------------------------------------------------- /fe/fcgi/tools/mkdeadline.rb: -------------------------------------------------------------------------------- 1 | require 'pstore' 2 | db=PStore.new('db/problem.db') 3 | db.transaction do 4 | deadlines = [] 5 | db['root'].each do |prob| 6 | pdb=PStore.new("db/#{prob}.db") 7 | pdb.transaction(true) do 8 | dl = pdb['deadline'] 9 | if dl && dl < Time.now.to_i 10 | dl = nil 11 | end 12 | deadlines << dl 13 | end 14 | end 15 | db['deadline'] = deadlines 16 | end 17 | -------------------------------------------------------------------------------- /test/t/fizz.l: -------------------------------------------------------------------------------- 1 | (defun iota (a m n) 2 | (if (< m n) 3 | a 4 | (iota (cons m a) (- m 1) n))) 5 | 6 | (defun fizzbuzz (n) 7 | (mapcar #'(lambda (i) 8 | (cond ((zerop (mod i 15)) "FizzBuzz") 9 | ((zerop (mod i 5)) "Buzz") 10 | ((zerop (mod i 3)) "Fizz") 11 | (t i))) 12 | (iota '() n 1))) 13 | 14 | (loop for s in (fizzbuzz 100) do 15 | (format t "~A~%" s)) 16 | -------------------------------------------------------------------------------- /be/modules/syscalls.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | int main() { 7 | puts("SYSCALLS = {"); 8 | #define DECLARE_HOOK(syscall) \ 9 | printf(" :" #syscall " => %d,\n", SYS_ ## syscall); 10 | #include "sandbox.c" 11 | puts("}"); 12 | 13 | printf("SANDBOX_MAGIC_PRIORITY = %d\n", SANDBOX_MAGIC_PRIORITY); 14 | } 15 | -------------------------------------------------------------------------------- /fe/fcgi/tools/delrecord.rb: -------------------------------------------------------------------------------- 1 | require 'pstore' 2 | raise if ARGV.size != 3 3 | pn = ARGV[0] 4 | lang = ARGV[1] 5 | rank = ARGV[2].to_i 6 | db=PStore.new("db/#{ARGV[0]}/_ranks.db") 7 | 8 | record = db.transaction(true) do 9 | db[ARGV[1]][rank] 10 | end 11 | p record 12 | 13 | puts 'Are you sure? Press return to continue' 14 | STDIN.gets 15 | 16 | db.transaction do 17 | p db[ARGV[1]].delete_at(rank) 18 | end 19 | puts 'done' 20 | -------------------------------------------------------------------------------- /test/t/fizz_fail.l: -------------------------------------------------------------------------------- 1 | (defun iota (a m n) 2 | (if (< m n) 3 | a 4 | (iota (cons m a) (- m 1) n))) 5 | 6 | (defun fizzbuzz (n) 7 | (mapcar #'(lambda (i) 8 | (cond ((zerop (mod i 15)) "FizzBuzz") 9 | ((zerop (mod i 5)) "Buzz") 10 | ((zerop (mod i 3)) "Fizz") 11 | (t i))) 12 | (iota '() n 1))) 13 | 14 | (loop for s in (fizzbuzz 99) do 15 | (format t "~A~%" s)) 16 | -------------------------------------------------------------------------------- /be/modules/getvals.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | static int getval(int sys); 7 | 8 | int main() { 9 | #define DECLARE_HOOK(syscall) \ 10 | printf(#syscall "=%d\n", getval(SYS_ ## syscall)); 11 | #include "sandbox.c" 12 | } 13 | 14 | static int getval(int sys) { 15 | return 20 - getpriority(SANDBOX_MAGIC_PRIORITY, sys); 16 | } 17 | -------------------------------------------------------------------------------- /test/t/fizz.sed: -------------------------------------------------------------------------------- 1 | s/$/@Z;1234566789@01/ 2 | :l 3 | 4 | s/\(.\?\)@\(.*;.*\1\(.0*\)\)/\3\2/ 5 | tl 6 | 7 | h 8 | 9 | #s/.*[05]Z/BuzzZ/ 10 | #/Z\(;;;\)*1/s/^/Fizz/ 11 | 12 | #s/[^z]*[05]Z/BuzzZ/ 13 | 14 | #p 15 | /Z\(;;;\)*1/s/^/FizzZ/ 16 | #p 17 | s/[^z]*[05]Z/BuzzZ/ 18 | 19 | #s/[^z]*Z\(;;;;;\)*1/BuzzZ/ 20 | 21 | #/Z\(;;;\)*1/s/../FizzZ/ 22 | #s/[^z]*Z\(;;;;;\)*1/BuzzZ/ 23 | 24 | s/Z.*// 25 | 26 | p 27 | g 28 | /00/d 29 | s/Z/@Z;/ 30 | bl 31 | -------------------------------------------------------------------------------- /fe/fcgi/tools/search_db.rb: -------------------------------------------------------------------------------- 1 | require 'pstore' 2 | `find db/ -name _ranks.db`.each do |l| 3 | db = PStore.new(l.chomp) 4 | db.transaction do 5 | db.roots.each do |k| 6 | db[k].each_with_index do |x, i| 7 | if x[0]=~/Jitensya/ 8 | p db[k][i] 9 | p db[k].delete_at(i) 10 | # p db[k][i] 11 | end 12 | # if x[2] == 0.0 13 | #p x, k, l 14 | # p db[k].delete_at(i) 15 | # end 16 | end 17 | end 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /be/conf/maintenance.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | if [ "x$1" = "xstart" ]; then 6 | perl -i -p -e '\ 7 | s@^(iface.*static|address|netmask)@#$1@; \ 8 | s@^#(iface.*dhcp)@$1@; ' /etc/network/interfaces 9 | elif [ "x$1" = "xstop" ]; then 10 | perl -i -p -e '\ 11 | s@^#(iface.*static|address|netmask)@$1@; \ 12 | s@^(iface.*dhcp)@#$1@; ' /etc/network/interfaces 13 | else 14 | echo "Usage: $0 [start|stop]" 15 | exit 1 16 | fi 17 | 18 | /etc/init.d/networking restart 19 | -------------------------------------------------------------------------------- /be/fetcher/d2: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | cp fetcher/dmd2.patch /golf/local 4 | 5 | cd /golf/local 6 | # We intentionally avoid the newest version because it doesn't have printf. 7 | #DMD=dmd.2.032.zip 8 | DMD=dmd.2.019.zip 9 | rm -fr $DMD dmd2 10 | wget http://ftp.digitalmars.com/$DMD 11 | 12 | rm -fr t 13 | mkdir t 14 | cd t 15 | unzip ../$DMD 16 | mv dmd ../dmd2 17 | cd .. 18 | rm -fr t 19 | 20 | #chmod 755 dmd2/linux/bin/dmd 21 | chmod 755 dmd2/bin/dmd 22 | 23 | cd dmd2 24 | patch -p1 < ../dmd2.patch 25 | -------------------------------------------------------------------------------- /test/t/fizz.c: -------------------------------------------------------------------------------- 1 | //i;main(){for(;i++<100;)puts(printf(i%3?i%5?"%d":"":"Fizz",i)?"":"Buzz");} 2 | i;main(){for(;i++<100;)printf(i%3?i%5?"%s%d\n":"%s\n":"Fizz%s\n",i%5?"":"Buzz",i);} 3 | 4 | //i;main(){for(;i++<100;)printf(i%3?i%5?"%d\n":"Buzz\n":"Fizz%s\n",i%3?i:i%5?"":"Buzz");} 5 | 6 | //i;main(){for(;i++<100;)printf(i%3?i%5?"%d\n":"Buzz\n":i%5?"Fizz\n":"FizzBuzz\n",i);} 7 | //printf("%s%s",i%3?"":"Fizz",i%5?"":"Buzz")?"\n":"%d\n",i);} 8 | //i;main(){for(;i++<100;)printf(printf("%s%s",i%3?"":"Fizz",i%5?"":"Buzz")?"\n":"%d\n",i);} 9 | -------------------------------------------------------------------------------- /fe/fcgi/all.rb: -------------------------------------------------------------------------------- 1 | class All < Handler 2 | def handle_ 3 | html_header 4 | title("anarchy golf - All problems") 5 | 6 | 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 2 | #include 3 | #include 4 | #include 5 | 6 | static void setval(int sys, int val); 7 | 8 | int main() { 9 | #define DECLARE_HOOK(syscall) \ 10 | puts("reseting " #syscall); \ 11 | setval(SYS_ ## syscall, 0); 12 | #include "sandbox.c" 13 | } 14 | 15 | static void setval(int sys, int val) { 16 | if (setpriority(SANDBOX_MAGIC_PRIORITY, sys, val)) { 17 | perror(""); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /test/t/syslog.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #define SYSLOG_ACTION_READ_ALL 3 6 | #define SYSLOG_ACTION_SIZE_BUFFER 10 7 | 8 | int main() { 9 | char* buf; 10 | int r; 11 | r = klogctl(SYSLOG_ACTION_SIZE_BUFFER, 0, 0); 12 | if (r < 0) { 13 | perror("SYSLOG_ACTION_SIZE_BUFFER"); 14 | return 1; 15 | } 16 | printf("size=%d\n", r); 17 | 18 | buf = malloc(r); 19 | r = klogctl(SYSLOG_ACTION_READ_ALL, buf, r); 20 | if (r < 0) { 21 | perror("SYSLOG_ACTION_SIZE_BUFFER"); 22 | return 1; 23 | } 24 | puts(buf); 25 | } 26 | -------------------------------------------------------------------------------- /fe/fcgi/setpid.rb: -------------------------------------------------------------------------------- 1 | require 'handler' 2 | require 'fileutils' 3 | 4 | class Setpid < Handler 5 | def handle_ 6 | q = query 7 | 8 | pid = q.pid.to_i 9 | 10 | s = execute2('setpid.rb', 11 | "Process.setpriority(1764, 20, #{pid}); puts 'SUCCESS'", 12 | ['']) 13 | 14 | payload = Marshal.load(s.read(s.gets.to_i)) 15 | html_header 16 | title("setpid") 17 | puts payload[:stdout] 18 | err = payload[:stderr] 19 | if !err.empty? 20 | puts 'setpid failed (maybe the pid was too small or too big)' 21 | end 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /test/t/google.sed: -------------------------------------------------------------------------------- 1 | s/^/google/ 2 | /e../s/o/ooooo/g 3 | /42/{s/o/oooo/g 4 | s/o/ooo/} 5 | s/e.*/e/ 6 | 7 | #s/$/ggle9876543210/ 8 | #:l 9 | #s/g/go/ 10 | ##s/\(.\)\(0*\)\(g.*\1\(.\).*\2\(.*\)\)/\4\5\3/ 11 | #s/\(.\)\(0*\)g\(.*\1\(.\)\)/\4g\2\3/ 12 | #s/g0/9g/ 13 | #/^0*g/!bl 14 | #s/[0-9]//g 15 | 16 | # #s/$/@;0@9876543210ggle/ 17 | # s/.*/ggle&;0@9876543210/ 18 | # :l 19 | # s/\(.\)@\(.*\1\(@*[0-9]\)\)/\3\2/ 20 | # tl 21 | # 22 | # s/g/go/ 23 | # s/;/@;/ 24 | # /e0*@/!bl 25 | # 26 | # s/0.*// 27 | # 28 | #/42/cgoooooooooooooooooooooooooooooooooooooooooogle 29 | #/10/cgoooooooooogle 30 | #cgoogle 31 | -------------------------------------------------------------------------------- /fe/fcgi/refer.rb: -------------------------------------------------------------------------------- 1 | require 'handler' 2 | 3 | class Refer < Handler 4 | def handle_ 5 | html_header 6 | title("anarchy golf - refer") 7 | 8 | h = Hash.new{0} 9 | `tail -3000 /var/log/lighttpd/access.log`.scan(/"(http:[^"]+)/) do 10 | # File.read('/var/log/lighttpd/access.log').scan(/"(http:[^"]+)/) do 11 | k = $1 12 | next if k=~/shinh.org/ 13 | next if k=~/localhost/ 14 | h[k]+=1 15 | end 16 | puts '
    ' 17 | h.sort{|x,y|y[1]<=>x[1]}.each do |k, v| 18 | puts %Q(
  • #{k} (#{v})) 19 | end 20 | puts '
' 21 | 22 | foot 23 | end 24 | end 25 | -------------------------------------------------------------------------------- /be/srv/ag_launcher.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #define STDIN_MAX 130000 6 | char buf[STDIN_MAX+1]; 7 | int main(int argc, char* argv[]) { 8 | argv++; 9 | if (!strcmp(argv[0], "-i")) { 10 | argv++; 11 | ssize_t l = read(0, buf, STDIN_MAX); 12 | if (l < 0) { 13 | perror("read failed"); 14 | return 1; 15 | } 16 | if (l < STDIN_MAX) { 17 | buf[l] = 0; 18 | setenv("STDIN", buf, 1); 19 | } else { 20 | fprintf(stderr, "NOTE: $(STDIN) won't work for this problem\n"); 21 | } 22 | } 23 | execv(argv[0], argv); 24 | perror("exec failed"); 25 | } 26 | 27 | -------------------------------------------------------------------------------- /test/ag.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require'open-uri' 3 | require'yaml/store' 4 | 5 | UN = 'shinh' 6 | 7 | fn = ARGV[0] 8 | en = File.extname(fn) 9 | bn = File.basename(fn, en) 10 | url = ARGV[1] 11 | 12 | db=YAML::Store.new("ag.db") 13 | db.transaction do 14 | if url 15 | db[bn] = url 16 | else 17 | url = db[bn] 18 | if !url 19 | abort 20 | end 21 | end 22 | end 23 | 24 | url=~/p.rb\?/ 25 | pn=$' 26 | url=$`+'submit.rb' 27 | 28 | #$A=open(fn) 29 | #require'submit' 30 | # 31 | #on = "out#{en}" 32 | #on = 't/testing.vhdl' if en =~ /vhdl$/ 33 | 34 | on = fn 35 | 36 | c=%Q(curl -s -0 --form file=@#{on} --form-string problem=#{pn} --form-string reveal= --form-string user=#{UN} #{url}) 37 | puts `#{c}` 38 | 39 | -------------------------------------------------------------------------------- /be/fetcher/xgawk.diff: -------------------------------------------------------------------------------- 1 | --- extension/Makefile.am.orig 2009-11-16 03:37:19.000000000 +0900 2 | +++ extension/Makefile.am 2009-11-16 03:37:28.000000000 +0900 3 | @@ -106,7 +106,7 @@ 4 | 5 | static.link: $(install_libraries) Makefile 6 | for p in $(install_libraries); do \ 7 | - . $$p ; \ 8 | + . ./$$p ; \ 9 | echo "extension/.libs/$$old_library" ; \ 10 | done > $@ 11 | if BUILD_XML 12 | --- extension/Makefile.in.orig 2009-11-16 03:49:43.000000000 +0900 13 | +++ extension/Makefile.in 2009-11-16 03:49:50.000000000 +0900 14 | @@ -669,7 +669,7 @@ 15 | 16 | static.link: $(install_libraries) Makefile 17 | for p in $(install_libraries); do \ 18 | - . $$p ; \ 19 | + . ./$$p ; \ 20 | echo "extension/.libs/$$old_library" ; \ 21 | done > $@ 22 | @BUILD_XML_TRUE@ echo " $(libxml_la_LIBADD)" >> $@ 23 | -------------------------------------------------------------------------------- /fe/fcgi/checker.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Checker 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |

Checker

15 | 16 |

17 | You can check the performance of your program here. 18 | The timeout of this interface is 10 seconds. 19 | 20 |

21 |

22 | File:
23 | Input:
24 |
25 |
26 |
27 | 28 | 29 | -------------------------------------------------------------------------------- /fe/fcgi/rejudge.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | create new problem 7 | 8 | 9 | 10 | 11 | 12 | 13 |

Rejudge

14 | 15 |

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(

recent entries

8 | 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() 16 | end 17 | puts %Q(
ProblemRankUserLangSizeScoreTimeDate
#{pn}#{rank}#{CGI.escapeHTML(un)}#{ft}#{cs}#{score}#{"%.4f"%time}#{now.strftime('%Y/%m/%d %H:%M:%S')}
) 18 | foot 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /fe/fcgi/setpid.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | setpid 7 | 8 | 9 | 10 | 11 | 12 | 13 |

set PID

14 | 15 |

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 |

23 | 24 | 25 | 26 |
27 | 28 | 29 | -------------------------------------------------------------------------------- /fe/conf/etc/network/interfaces: -------------------------------------------------------------------------------- 1 | # This file describes the network interfaces available on your system 2 | # and how to activate them. For more information, see interfaces(5). 3 | 4 | # The loopback network interface 5 | auto lo 6 | iface lo inet loopback 7 | 8 | # The primary network interface 9 | #allow-hotplug eth0 10 | auto xenbr1 11 | iface xenbr1 inet static 12 | bridge_ports eth0 13 | address 49.212.93.182 14 | netmask 255.255.254.0 15 | network 49.212.92.0 16 | broadcast 49.212.93.255 17 | gateway 49.212.92.1 18 | # dns-* options are implemented by the resolvconf package, if installed 19 | dns-nameservers 210.188.224.11 20 | dns-search sakura.ne.jp 21 | 22 | auto xenbr0 23 | iface xenbr0 inet static 24 | bridge_ports eth0:1 25 | address 192.168.36.1 26 | netmask 255.255.255.0 27 | network 192.168.36.0 28 | broadcast 192.168.36.255 29 | 30 | post-up /usr/sbin/ethtool -K eth0 tso off 31 | -------------------------------------------------------------------------------- /fe/conf/etc/apt/sources.list: -------------------------------------------------------------------------------- 1 | # 2 | 3 | # deb cdrom:[Debian GNU/Linux 6.0.1a _Squeeze_ - Official i386 NETINST Binary-1 20110320-15:03]/ squeeze main 4 | 5 | #deb cdrom:[Debian GNU/Linux 6.0.1a _Squeeze_ - Official i386 NETINST Binary-1 20110320-15:03]/ squeeze main 6 | 7 | deb http://ftp.jp.debian.org/debian squeeze main 8 | deb-src http://ftp.jp.debian.org/debian squeeze main 9 | 10 | deb http://security.debian.org/ squeeze/updates main 11 | deb-src http://security.debian.org/ squeeze/updates main 12 | 13 | deb http://ftp.jp.debian.org/debian testing main 14 | deb-src http://ftp.jp.debian.org/debian testing main 15 | 16 | deb http://security.debian.org/ testing/updates main 17 | deb-src http://security.debian.org/ testing/updates main 18 | 19 | # squeeze-updates, previously known as 'volatile' 20 | deb http://ftp.jp.debian.org/debian squeeze-updates main 21 | deb-src http://ftp.jp.debian.org/debian squeeze-updates main 22 | -------------------------------------------------------------------------------- /test/submit.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | require 'stringio' 4 | 5 | if __FILE__ == $0 6 | $A=ARGF 7 | end 8 | ext = File.extname($A.path) 9 | c = $A.read 10 | 11 | # if ext == '.bf' 12 | # c = c.scan(/[\+-\[\]><,\.]/)*'' 13 | # end 14 | 15 | # if ext == '.ms' 16 | # $i = StringIO.new(c, 'r') 17 | # require 'msc' 18 | # c = $o 19 | # c.gsub!('-=', '') 20 | # c.gsub!("\n", '') 21 | # end 22 | 23 | # if ext != '.out' 24 | # c.gsub!(/^ +/,'') 25 | # c.gsub!(/^(\/\/.*|#(?!!|import|include)|--).*/,'') 26 | # c.gsub!(/\/\*[^\*]*(\*+[^\/*][^*]*)*\*+\//,'') 27 | # 1 while c.gsub!(/\n\n/,"\n") 28 | # c.gsub!(";\n",';') 29 | # c.gsub!("{\n",'{') 30 | # if ext != '.sed' && ext != '.sh' && ext != '.cs' && ext != '.c' && ext != '.hs' 31 | # c.gsub!('\n',"\n") 32 | # end 33 | # c.strip! 34 | # end 35 | # #c.gsub!(/\n+\Z/,'') 36 | p c.size 37 | File.open("out#{ext}", 'w') do |of| 38 | of.print(c) 39 | end 40 | -------------------------------------------------------------------------------- /fe/conf/etc/xen/ux.cfg: -------------------------------------------------------------------------------- 1 | # 2 | # Configuration file for the Xen instance ux, created 3 | # by xen-tools 4.2 on Mon Oct 10 12:49:23 2011. 4 | # 5 | 6 | # 7 | # Kernel + memory size 8 | # 9 | kernel = '/boot/vmlinuz-2.6.32-5-xen-686' 10 | ramdisk = '/boot/initrd.img-2.6.32-5-xen-686' 11 | 12 | vcpus = '1' 13 | memory = '128' 14 | 15 | # 16 | # Disk device(s). 17 | # 18 | root = '/dev/xvda2 ro' 19 | disk = [ 20 | 'file:/etc/xen/domains/ux/disk.img,xvda2,w', 21 | 'file:/etc/xen/domains/ux/swap.img,xvda1,w', 22 | ] 23 | 24 | 25 | # 26 | # Physical volumes 27 | # 28 | 29 | 30 | # 31 | # Hostname 32 | # 33 | name = 'ux' 34 | 35 | # 36 | # Networking 37 | # 38 | vif = [ 'ip=192.168.36.2,mac=00:16:3E:A3:F3:98' ] 39 | 40 | # 41 | # Behaviour 42 | # 43 | on_poweroff = 'destroy' 44 | on_reboot = 'restart' 45 | on_crash = 'restart' 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /test/t/embed.dc: -------------------------------------------------------------------------------- 1 | 4481652938263432604214395290962598461211504938511782570141424058216326098668577093204360439393273894738145295760147248257184645814478369589307402499532534049054001321202577206096979459775847165942051913440379255334665219025528528177746110605580009991418566924549106220635637043805605128212006905400413248058952220610076279069426248279835428353323029540463814438492637865597611655209043383766935356355434986723973827154155951478066267769904625454826564945267178690245865357443787780096406367583096417489071904609030824403803612354834357660893762306918037152256113315313980097304720547326264365311367268592547432412150606422245712408498009095506042524300598420281051899793458949607243847971621182608660820064407525347612380709420104185691987613543725191623550784567036316667872781116269295317068839241135736466768009617919175665655799661293665510444333321930892671350255809054879812362748436531028485963450224457942716216057822070803596065857082959601819602470123808218945828760507303828156466701222846p 2 | -------------------------------------------------------------------------------- /be/pkgs.txt: -------------------------------------------------------------------------------- 1 | udev 2 | lv 3 | gcc 4 | g++ 5 | gobjc++ 6 | gfortran 7 | ruby 8 | ruby1.9.1 9 | perl 10 | python 11 | php5-cli 12 | -t unstable gauche 13 | clisp 14 | spidermonkey-bin 15 | lua5.1 16 | tcl 17 | gnu-smalltalk 18 | swi-prolog 19 | gforth 20 | yabasic 21 | erlang 22 | gdc 23 | ocaml 24 | gnat 25 | sun-java6-jdk 26 | gpc 27 | mono-gmcs 28 | open-cobol 29 | m4 30 | ghostscript 31 | nemerle 32 | maxima 33 | r-base 34 | ghdl 35 | dosemu 36 | vim 37 | groovy 38 | wine 39 | plt-scheme 40 | git-core 41 | subversion 42 | scala 43 | strace 44 | libopen4-ruby1.9.1 45 | libopen4-ruby1.8 46 | aplus-fsf 47 | linux-headers-2.6.32-5-xen-686 48 | libmpfr-dev 49 | libstdc++5 50 | libgc-dev 51 | asymptote 52 | mercurial 53 | bison 54 | lsof 55 | lilypond 56 | fish 57 | zsh 58 | bc 59 | dc 60 | ucblogo 61 | octave3.2 62 | sudo 63 | libgif-dev 64 | regina-rexx 65 | clc-intercal 66 | iconc 67 | icont 68 | iconx 69 | pari-gp 70 | gnuplot 71 | python3 72 | curl 73 | pike7.6-core 74 | jq 75 | ruby2.2 76 | julia 77 | -------------------------------------------------------------------------------- /fe/fcgi/index.fcgi: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | require 'fcgi' 4 | require 'cgi' 5 | 6 | m = {} 7 | 8 | def update_check(m, s) 9 | if (!m.key?(s) || m[s][:time] < File.mtime(s)) 10 | File.open(s) do |i| 11 | eval(i.read) 12 | end 13 | if (!m.key?(s)) 14 | m[s] = {} 15 | end 16 | m[s][:time] = Time.now 17 | m[s][:class] = eval(s[/[a-z]+/].capitalize) 18 | end 19 | end 20 | 21 | FCGI.each do |req| 22 | o = req.out 23 | e = req.env 24 | s = e['SCRIPT_NAME'] 25 | 26 | begin 27 | s = s[/\/(.*)/,1] 28 | if (!File.exists?(s)) 29 | o.print "Status Code: 404 Not Found\r\n" 30 | req.finish 31 | next 32 | end 33 | 34 | update_check(m, 'handler.rb') 35 | update_check(m, s) 36 | 37 | h = m[s][:class].send(:new) 38 | h.handle(req) 39 | rescue 40 | o.print "Content-Type: text/plain\r\n\r\n" 41 | o.puts "CORE in #{s}" 42 | o.puts "#{$!}" 43 | o.puts "#{$!.backtrace*"\n"}" 44 | req.finish 45 | end 46 | end 47 | -------------------------------------------------------------------------------- /be/conf/etc/rc.local: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | # 3 | # rc.local 4 | # 5 | # This script is executed at the end of each multiuser runlevel. 6 | # Make sure that the script will "exit 0" on success or any other 7 | # value on error. 8 | # 9 | # In order to enable or disable this script just change the execution 10 | # bits. 11 | # 12 | # By default this script does nothing. 13 | 14 | chmod 755 /run/lock 15 | umount /run/shm 16 | 17 | chown -R root:root /golf/* 18 | chown -R golf:golf /golf/test 19 | chmod +s /golf/remount 20 | 21 | # for dosemu 22 | sysctl -w vm.mmap_min_addr=0 23 | 24 | insmod /root/ags/be/modules/sandbox.ko 25 | #sudo -u golf sh -c 'cd /; /golf/run 2>&1' > /root/golf.log & 26 | /bin/bash -c 'while true; do sudo -u golf /usr/bin/ruby1.9.1 /golf/testsrv.rb 2>&1; done' > /root/golf.log & 27 | 28 | echo 0 > /proc/sys/kernel/msgmax 29 | echo 0 > /proc/sys/kernel/msgmni 30 | echo 0 > /proc/sys/kernel/shmmax 31 | echo 0 > /proc/sys/kernel/shmmni 32 | # Mono requires some semaphores. 33 | echo 8 8 1 1 > /proc/sys/kernel/sem 34 | 35 | exit 0 36 | -------------------------------------------------------------------------------- /be/srv/s/groovy: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | #export JAVACMD=java 3 | exec groovy $1 4 | 5 | #CP=`echo /usr/share/groovy/lib/* | sed 's/ /:/g'` 6 | #echo $CP 7 | 8 | CP='/usr/share/groovy/lib/ant-junit.jar:/usr/share/groovy/lib/ant-launcher.jar:/usr/share/groovy/lib/ant.jar:/usr/share/groovy/lib/antlr.jar:/usr/share/groovy/lib/asm2-analysis.jar:/usr/share/groovy/lib/asm2-tree.jar:/usr/share/groovy/lib/asm2-util.jar:/usr/share/groovy/lib/asm2.jar:/usr/share/groovy/lib/bsf.jar:/usr/share/groovy/lib/commons-cli.jar:/usr/share/groovy/lib/commons-logging.jar:/usr/share/groovy/lib/groovy-1.6.3.jar:/usr/share/groovy/lib/jline.jar:/usr/share/groovy/lib/jsp-api.jar:/usr/share/groovy/lib/junit4.jar:/usr/share/groovy/lib/mockobjects-core.jar:/usr/share/groovy/lib/regexp.jar:/usr/share/groovy/lib/servlet-api.jar:/usr/share/groovy/lib/xstream.jar' 9 | 10 | java -cp "$CP" groovy.ui.GroovyMain $1 11 | 12 | #java -cp /usr/share/groovy/lib/groovy-1.6.3.jar groovy.ui.GroovyMain $1 13 | #java -cp /usr/share/groovy/embeddable/groovy-all-1.5.4.jar groovy.ui.GroovyMain $1 14 | 15 | -------------------------------------------------------------------------------- /fe/conf/etc/lighttpd/lighttpd.conf: -------------------------------------------------------------------------------- 1 | server.modules = ( 2 | "mod_access", 3 | "mod_alias", 4 | "mod_compress", 5 | "mod_redirect", 6 | # "mod_rewrite", 7 | ) 8 | 9 | server.document-root = "/var/www" 10 | server.upload-dirs = ( "/var/cache/lighttpd/uploads" ) 11 | server.errorlog = "/var/log/lighttpd/error.log" 12 | server.pid-file = "/var/run/lighttpd.pid" 13 | server.username = "www-data" 14 | server.groupname = "www-data" 15 | 16 | index-file.names = ( "index.php", "index.html", "index.lighttpd.html" ) 17 | url.access-deny = ( "~", ".inc" ) 18 | static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" ) 19 | 20 | compress.cache-dir = "/var/cache/lighttpd/compress/" 21 | compress.filetype = ( "application/javascript", "text/css", "text/html", "text/plain" ) 22 | 23 | include_shell "/usr/share/lighttpd/use-ipv6.pl" 24 | include_shell "/usr/share/lighttpd/create-mime.assign.pl" 25 | include_shell "/usr/share/lighttpd/include-conf-enabled.pl" 26 | -------------------------------------------------------------------------------- /test/t/fizz.rb: -------------------------------------------------------------------------------- 1 | 1.upto(?d){|n|puts ["Fizz#{s=[:Buzz][n%5]}"][n%3]||s||n} 2 | #1.upto(?d){|n|s=[:Buzz][n%5];puts n%3<1?"Fizz#{s}":s||n} 3 | 4 | #1.upto(?d){|n|n%3<1&&s="Fizz";puts n%5<1?"#{s}Buzz":s||n} 5 | #1.upto(?d){|n|s=[:Fizz][n%3];puts n%5<1?"#{s}Buzz":s||n} 6 | #1.upto(?d){|i|puts"#{b=[:Fizz][i%3]}#{i%5<1?:Buzz:b ?$9:i}"} 7 | 8 | #?d.times{|i|puts"#{b=i%3>1?:Fizz:$9}#{i%5>3?:Buzz:b ?$9:i+1}"} 9 | #1.upto(?d){|i|$><<(b=[:Fizz][i%3])<<(i%5<1?:Buzz:b ?$9:i)<<$/} 10 | 11 | #1.upto(?d){|i|puts"#{b=i%3<1?:Fizz:$9}#{i%5<1?:Buzz:b ?$9:i}"} 12 | #1.upto(?d){|i|puts"#{:Fizz if b=i%3<1}#{i%5<1?:Buzz:b ?'':i}"} 13 | #1.upto(?d){|i|s="#{:Fizz if i%3<1}#{:Buzz if i%5<1}";puts s[0]?s:i} 14 | 15 | #1.upto(?d){|i|puts i%3<1?i%5<1?:FizzBuzz: :Fizz:i%5<1?:Buzz:i} 16 | #1.upto(?d){|i|s="Fizz"[i%3*4,4]+"Buzz"[i%5*4,4];puts s ?s:i} 17 | 18 | #1.upto(?d){|i|s=0;l=0;i%5<1&&l 19 | 20 | # 3 => 0,1 21 | # 5 => 1,1 22 | # 15 => 0,2 23 | 24 | 25 | 26 | #a=[*1..?d] 27 | #1.upto(33){|i|a[3*i-1]="Fizz"} 28 | #1.upto(20){|i|a[v=5*i-1].to_i<1?a[v]+="Buzz":a[v]="Buzz"} 29 | #puts a 30 | -------------------------------------------------------------------------------- /be/conf/etc/apt/sources.list: -------------------------------------------------------------------------------- 1 | # 2 | # /etc/apt/sources.list 3 | # 4 | 5 | 6 | deb http://ftp.jp.debian.org/debian/ testing main contrib non-free 7 | deb-src http://ftp.jp.debian.org/debian/ testing main contrib non-free 8 | 9 | deb http://ftp.jp.debian.org/debian/ stable main contrib non-free 10 | deb-src http://ftp.jp.debian.org/debian/ stable main contrib non-free 11 | 12 | deb http://ftp.jp.debian.org/debian/ unstable main contrib non-free 13 | deb-src http://ftp.jp.debian.org/debian/ unstable main contrib non-free 14 | 15 | deb http://ftp.jp.debian.org/debian/ lenny main contrib non-free 16 | deb-src http://ftp.jp.debian.org/debian/ lenny main contrib non-free 17 | 18 | # 19 | # Security updates 20 | # 21 | deb http://security.debian.org/ testing/updates main contrib non-free 22 | deb-src http://security.debian.org/ testing/updates main contrib non-free 23 | 24 | deb http://security.debian.org/ stable/updates main contrib non-free 25 | deb-src http://security.debian.org/ stable/updates main contrib non-free 26 | -------------------------------------------------------------------------------- /fe/fcgi/tools/mkrefer.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require 'zlib' 3 | require 'pstore' 4 | require 'open-uri' 5 | 6 | f=Zlib::GzipReader.new(File.open(ARGV[0])) 7 | dbs={} 8 | while f.gets 9 | if $_ !~ /GET \/p\.rb\?(\S+).*?" 200 .*?"([^"]+)/ 10 | next 11 | end 12 | 13 | prob = $1 14 | refer = $2 15 | 16 | next if prob =~ /%/ 17 | next if refer == '-' || refer =~ /\.shinh.org/ || refer =~ /\.google\./ || refer =~ /\.goo\./ || refer =~ /\.yahoo\./ || refer =~ /\.search\./ 18 | 19 | puts "#{prob} #{refer}" 20 | 21 | db = dbs[prob] 22 | if !db 23 | begin 24 | db = PStore.new("db/#{prob.tr("+"," ")}/_refer.db") 25 | rescue 26 | next 27 | end 28 | dbs[prob] = db 29 | end 30 | 31 | db.transaction do 32 | if db.root?(refer) 33 | if db[refer] 34 | db[refer] += 1 35 | end 36 | else 37 | begin 38 | c = open(refer).read 39 | if c =~ /golf\.shinh\.org\/p\.rb\?/ 40 | db[refer] = 1 41 | else 42 | db[refer] = nil 43 | end 44 | rescue 45 | db[refer] = nil 46 | end 47 | end 48 | end 49 | end 50 | -------------------------------------------------------------------------------- /fe/fcgi/tools/resort.rb: -------------------------------------------------------------------------------- 1 | require 'pstore' 2 | def file_types 3 | ['rb','pl','py','php','scm','l','io','js','lua','tcl', 4 | 'st', 'pro','for','bas', 5 | 'c','cpp','d','ml','hs','adb','m','java','pas','f95','cs','cob', 6 | 'awk','sed','sh', 7 | 'bf','ws','bef', 'di', 8 | 's','out',] 9 | end 10 | def file_langs 11 | ['Ruby','Perl','Python','PHP','Scheme', 12 | 'Common LISP','Io','JavaScript','Lua','Tcl', 13 | 'Smalltalk', 'Prolog','Forth','BASIC', 14 | 'C','C++','D','OCaml','Haskell', 15 | 'Ada','ObjC','Java','Pascal','Fortran','C#','COBOL', 16 | 'AWK','sed','Bash', 17 | 'Brainfuck','Whitespace','Befunge','D-compile-time', 18 | 'gas','x86',] 19 | end 20 | db = PStore.new('db/problem.db') 21 | root = db.transaction(true) do 22 | db['root'] 23 | end 24 | root.each do |pn| 25 | ldb = PStore.new("db/#{pn}/_ranks.db") 26 | ldb.transaction() do 27 | file_types.zip(file_langs).each do |ext, lang| 28 | next if !ldb.root?(ext) 29 | l = ldb[ext] 30 | l.sort!{|x,y| 31 | r = x[1]<=>y[1] 32 | if r != 0 33 | r 34 | else 35 | x[3] <=> y[3] 36 | end 37 | } 38 | ldb[ext] = l 39 | p l 40 | end 41 | end 42 | end 43 | -------------------------------------------------------------------------------- /be/fetcher/dmd2.patch: -------------------------------------------------------------------------------- 1 | diff -ur dmd2-old/src/phobos/std/conv.d dmd2/src/phobos/std/conv.d 2 | --- dmd2-old/src/phobos/std/conv.d 2011-10-12 12:38:19.000000000 +0900 3 | +++ dmd2/src/phobos/std/conv.d 2011-10-12 12:38:28.000000000 +0900 4 | @@ -1505,7 +1505,7 @@ 5 | 6 | // min and max 7 | d = toDouble("2.22507e-308"); 8 | - assert(feq(cast(real)d, cast(real)2.22507e-308)); 9 | + assert(feq(cast(real)d, cast(real)2.22507e-308L)); 10 | assert(feq(cast(real)d, cast(real)double.min)); 11 | d = toDouble("1.79769e+308"); 12 | assert(toString(d) == toString(1.79769e+308)); 13 | diff -ur dmd2-old/src/phobos/std/math.d dmd2/src/phobos/std/math.d 14 | --- dmd2-old/src/phobos/std/math.d 2011-10-12 12:38:19.000000000 +0900 15 | +++ dmd2/src/phobos/std/math.d 2011-10-12 12:38:36.000000000 +0900 16 | @@ -961,7 +961,7 @@ 17 | static if (real.mant_dig == 64) { 18 | static real extendedvals[][3] = [ // x,frexp,exp 19 | [0x1.a5f1c2eb3fe4efp+73, 0x1.A5F1C2EB3FE4EFp-1, 74], // normal 20 | - [0x1.fa01712e8f0471ap-1064, 0x1.fa01712e8f0471ap-1, -1063], 21 | + [0x1.fa01712e8f0471ap-1064L, 0x1.fa01712e8f0471ap-1, -1063], 22 | [real.min, .5, -16381], 23 | [real.min/2.0L, .5, -16382] // denormal 24 | ]; 25 | -------------------------------------------------------------------------------- /fe/fcgi/version.rb: -------------------------------------------------------------------------------- 1 | require 'handler' 2 | 3 | class Version < Handler 4 | def strip_script(s) 5 | s.gsub(/#.*/, '').sub('export LD_PRELOAD=$LD_PRELOAD:/lib/i386-linux-gnu/libSegFault.so', '').gsub(/\n+/, "\n") 6 | end 7 | 8 | def handle_ 9 | html_header 10 | title("anarchy golf - Version info of languages") 11 | puts "

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 "
#{lang} (#{ext}): #{m[ext]}
" 22 | puts "
" 23 | puts "

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 "

" + ss + "
" 29 | c = "../../be/srv/s/_#{ext}" 30 | if File.exist?(c) 31 | puts "

How your program is compiled:" 32 | puts "

" + strip_script(File.read(c)) + "
" 33 | end 34 | puts "

" 35 | puts "
" 36 | end 37 | puts "
" 38 | 39 | foot 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /fe/fcgi/check.rb: -------------------------------------------------------------------------------- 1 | require 'handler' 2 | 3 | class Check < Handler 4 | def handle_ 5 | puts %Q( 6 | 7 | 8 | 9 | 10 | 11 | Checker 12 | 13 | 14 | 15 | 16 | 17 | 23 | 24 | 25 | 26 |

Checker

27 | 28 |

29 | You can check the performance of your program here. 30 | The timeout of this interface is 10 seconds. 31 | 32 |

33 |

34 |
35 | File:
36 |
37 | Input:
38 |
39 |
40 |
41 | 42 | 43 | ) 44 | end 45 | end 46 | -------------------------------------------------------------------------------- /fe/fcgi/bas.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | binary, alnum, symbol 7 | 8 | 9 | 10 | 11 | 12 | 13 |

binary, alnum, symbol

14 | 15 |

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 '' 50 | i = 0 51 | db['root'].each do |x, y, z| 52 | puts tr(i+=1, "#{ext2lang(x)}", y, z, y/z) 53 | end 54 | print '
RankLangScore#Avg.
' 55 | 56 | mt = File.mtime(lrf) 57 | puts tag('p', "#{ext2lang(db['root'][0][0])} is the programming tool of choice for discriminating golfers.") 58 | puts tag('p', "#{ext2lang(db['root'][1][0])} is a fine programming tool for many courses.") 59 | puts tag('p', "Last update: #{mt.getutc} (#{mt})") 60 | end 61 | 62 | foot 63 | end 64 | end 65 | -------------------------------------------------------------------------------- /be/fetcher/blsq.patch: -------------------------------------------------------------------------------- 1 | diff --git a/main.hs b/main.hs 2 | index 9d446c5..df07429 100644 3 | --- a/main.hs 4 | +++ b/main.hs 5 | @@ -5,8 +5,8 @@ import Burlesque.Display 6 | 7 | import System.Environment 8 | import System.IO 9 | -import System.Console.Haskeline 10 | -import System.Console.Haskeline.Completion 11 | +--import System.Console.Haskeline 12 | +--import System.Console.Haskeline.Completion 13 | import Data.List 14 | 15 | runProgram :: String -> String -> String 16 | @@ -38,7 +38,7 @@ main = do 17 | prog <- readFile file 18 | putStr $ runProgramNoStdin prog 19 | ["--no-stdin",prog] -> putStr $ runProgramNoStdin prog 20 | - ["--shell"] -> runInputT settings burlesqueShell 21 | +-- ["--shell"] -> runInputT settings burlesqueShell 22 | ["--version"] -> putStrLn "burlesque v1.6.9!" 23 | ["--stdin",prog] -> interact $ runProgram prog 24 | _ -> do putStrLn $ "Invalid usage" 25 | @@ -51,20 +51,20 @@ main = do 26 | putStrLn " --stdin 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 |
16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 31 | 32 | 33 | 38 | 39 | 40 | 41 | 52 | 53 | 54 |
title:
deny exec: 29 | 30 |
rejudge: 37 |
deadline: 51 |
55 | description:
56 | 57 |
58 | input:
59 | 60 |
61 | output:
62 | 63 |
64 | input2:
65 | 66 |
67 | output2:
68 | 69 |
70 | input3:
71 | 72 |
73 | output3:
74 | 75 |
76 | To protect the system from spam, please input your favorite sport (hint: I believe its name must start with 'g', case insensitive) 77 |
78 | 79 |
80 | NOTICE: Please check if your problem with deadline is not included in other short coding sites such as codegolf.com or Shortening codes at SPOJ. As they don't disclose code, your problem can be a spoiler for these sites. 81 | 82 |
83 |
84 | Note that the submitted problems can be re-used by anyone. 85 | 86 |
87 |
88 | 89 |
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() 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() 103 | end 104 | puts %Q(
RankUserScoreEntriesAvg# of 10000
#{rank+=1}#{un}#{u.score}#{u.count}#{avg}#{u.no1_count}
) 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 |

59 | Your name:
60 |
61 | File: 62 | 63 |
64 | Open code-statistics:
65 |
66 | 67 |
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() 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() 124 | end 125 | puts %Q(
RankLangUserSizeScore
#{i+=1}#{ext2lang(k)}#{CGI.escapeHTML(v[2])}#{v[0]}#{(10000*min/v[0]).to_i}
) 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 |

To protect the system from spam, please input your favorite sport (hint: I believe its name must start with 'g', case insensitive) 108 | 109 | 110 | 111 | 112 | 113 |
) 114 | end 115 | 116 | puts %Q(

download

) 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 | --------------------------------------------------------------------------------