This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/i{[1 1 4 3 roll {} for ]}def | |
%10 i == %[1 2 3 4 5 6 7 8 9 10] | |
/+{ | |
dup type /arraytype eq { % ? [] | |
1 index type /arraytype eq { % [] [] | |
2 copy length exch length ne { | |
2 copy length exch length exch lt { exch } if % now nA > nB | |
2 copy length exch length exch sub % A B nA-nB | |
[ 3 2 roll % A nA-nB [ B |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%apply unary proc to array. ie. proc implements a monadic operator | |
/mop{ % A proc | |
1 index type /arraytype eq { | |
[ 3 1 roll % [ A proc | |
exch % [ proc A | |
{ % [ ... proc A_i | |
1 index op % [ ... proc A_i' | |
exch % [ ... A_i' proc | |
}forall |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%1 http://www.ams.org/journals/mcom/1954-08-046/ | |
/init{ | |
P{ %check P for validity | |
W 1 ne {ERROR:W_p!=1} if | |
}forall | |
/Ptab << | |
P { | |
dup | |
} forall |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//http://www.ams.org/journals/mcom/1954-08-046/ | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
enum { LOW = -10000, HIGH = 10000 }; | |
char *P = "01"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
# labels.pl reads csv records in the form: | |
# "Name","123 Street","Apt","City, ST ZIP" | |
# from a file named "addr.csv" and | |
# produces a postscript program on stdout | |
# suitable for piping into ps2pdf or | |
# even distiller, maybe | |
# CAVEATS: prototype produces at most | |
# one page. label and sheet sizes are hard-coded | |
# at 3 3-inch-width labels which are 4*17 points |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/starpath { % n r1 r2 x y | |
matrix currentmatrix 6 1 roll % [] n r1 r2 x y | |
translate % [] n r1 r2 | |
10 dict begin {/r2 /r1 /n} {exch def}forall % [] | |
/da 360 n div def | |
r2 0 moveto | |
n { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//xcr.c | |
//cc -o xcr $(pkg-config --cflags --libs cairo xcb xcb-icccm) xcr.c -lcairo -lxcb -lxcb-icccm | |
#include <stdlib.h> | |
#include <string.h> | |
#include <cairo.h> | |
#include <cairo-xcb.h> | |
#include <xcb/xcb.h> | |
#include <xcb/xcb_image.h> | |
#include <xcb/xcb_aux.h> | |
#include <xcb/xcb_icccm.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//make font_transform_test CFLAGS=`freetype-config --cflags ` LDLIBS=`freetype-config --libs` LDLIBS+=`pkg-config fontconfig --libs` LDLIBS+='-lm' | |
/* | |
* Xpost - a Level-2 Postscript interpreter | |
* Copyright (C) 2013, Michael Joshua Ryan | |
* Copyright (C) 2013, Vincent Torri | |
* All rights reserved. | |
* | |
* Redistribution and use in source and binary forms, with or without | |
* modification, are permitted provided that the following conditions are met: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%polygon.ps | |
%rad n {proc} atpoly - | |
%call proc having rotated+scaled | |
%so (1,0) is each vertex of rad-radius n-polygon | |
/atpoly { | |
%3 args (atpoly)= | |
4 dict begin /p exch def /n exch def % rad | |
/m matrix currentmatrix def | |
%(rad2=)print rad2 = | |
%dup (atpoly: rad=)print = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<ctype.h> | |
#include<stdint.h> | |
#include<stdio.h> | |
#include<stdlib.h> | |
#include<string.h> | |
#include<sys/stat.h> | |
#include<unistd.h> | |
typedef intptr_t I; typedef uintptr_t U; | |
typedef short S; typedef unsigned short US; | |
typedef signed char C; typedef unsigned char UC; |
OlderNewer