Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
FILENAME="$1"
MAIN="$2"
R --vanilla --slave <<EOF
postscript("|cat", horizontal=FALSE, height=7)
data <- read.table('$FILENAME', header=FALSE)
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
%!PS-Adobe-3.0 EPSF-3.0
%%BoundingBox: 0 0 420 200
64 dict begin
/min { 2 copy lt { pop } { exch pop } ifelse } def
/arrowdict 13 dict def
arrowdict begin
class trail_t {
public:
int data;
trail_t* parent;
public:
trail_t() : data(-1), parent(NULL), refcount_(1) {};
~trail_t() {
if (parent)
# Assuming that everything will reside on $HOME/usr/local directory as
# depicted below:
#
# $HOME
# `-- usr
# `-- local
# +-- bin
# `-- lib
#
# Also note that gcc, gcc-g++, glibc-devel.i386 and
@masashinakata
masashinakata / Makefile
Created September 8, 2013 05:51
CodeIQ - Tomerun Marathon
N = 64
all: test.txt fill.txt fill_h.txt fill_v.txt
test.txt: testcase.txt sparse.sh
head -${N} testcase.txt | cut -c1-${N} | ./sparse.sh > $@
fill.txt: fill_h.txt
ln -s -f $< $@
@masashinakata
masashinakata / srm604-250.ps
Created January 11, 2014 20:38
PostScript used in SRM604 Div I 250. Save this with the filename ending with .ps, and open from Preview.app.
%!PS-Adobe-3.0 EPSF-3.0
%%BoundingBox: 0 0 320 320
/matrixexecarray 0 array def
/matrixexec {
userdict begin /matrixexecarray [ matrixexecarray aload pop matrix currentmatrix ] def end
exch setmatrix exec
userdict begin /matrixexecarray [ matrixexecarray aload pop setmatrix ] def end
} def
@masashinakata
masashinakata / cf225-b.ps
Created January 20, 2014 22:58
PostScript used in Codeforces # 225 Div. 1 B.
%!PS-Adobe-3.0 EPSF-3.0
%%BoundingBox: 0 0 125 125
/matrixexecarray 0 array def
/matrixexec {
userdict begin /matrixexecarray [ matrixexecarray aload pop matrix currentmatrix ] def end
exch setmatrix exec
userdict begin /matrixexecarray [ matrixexecarray aload pop setmatrix ] def end
} def
@masashinakata
masashinakata / extract.sh
Created June 20, 2017 19:06
Snipet to extract scripts from single Wiki file
#!/bin/sh
i=1
sed -E -n -e '
:loop
/^<(postscript|latex|gnuplot|R)[> ]/ {
N
/<\/(postscript|latex|gnuplot|R)>/!b loop
s/\\/\\\\\\\\/g
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>