-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathREADME
305 lines (277 loc) · 5.96 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
NAME
socprint.sh - POSIX™-compliant, zero-dependency shell script to print in NUS SoC
SYPNOSIS
socprint.sh (p|print) [options] <username> <printqueue> [-|<filepath>]
socprint.sh (j|jobs ) [options] <username> <printqueue>
socprint.sh (l|list ) [options] <username>
socprint.sh (h|help )
QUICKSTART
To print a file instantly, copy and paste the following line into your shell:
curl -s https://raw.githubusercontent.com/dlqs/SOCprint/master/socprint.sh | sh -s -- print <username> <printqueue> <filepath>
Alternatively, use the hosted version at https://socprint.xyz
DESCRIPTION
This script requires a POSIX™-compliant sh, a sunfire account, and connection to
SoC wifi.
Besides the above, this script has zero-dependencies, is portable, and handles text/byte streams. This makes printing
in SoC a painless, non-ass-sucking experience that doesn't require installing any drivers.
COMMANDS (shortname|longname)
(p|print) Print a file at specified printqueue.
(j|jobs ) List jobs at specified printqueue.
(l|list ) List all printqueues.
(h|help ) Show this message.
OPTIONS
<username>
Sunfire username, without the @sunfire.comp.nus.edu.sg part.
<printqueue>
Printer + suffix. See PRINTQUEUES for commonly-used printers.
[-|<filepath>]
Print file. Recommended PDF/text. Undefined behaviour for other file types.
If unspecified or -, read from standard input.
-i, --identity-file <filepath>
(optional) Additional identity file to use with ssh. Skip if you already set
up sunfire identity files for ssh.
-2
(optional) Prints every two logical pages onto one physical page.
Can only be used for pdf files that have portrait orientation.
--dry-run
(for debugging/tests) Echoes commands to be executed without executing them.
EXAMPLES
To print from filepath:
./socprint.sh print d-lee psc008-dx ~/d/cs3210_tutorial8.pdf
To combine with curl and the pipe operator:
curl -s https://www.comp.nus.edu.sg/~ooibc/bxtree.pdf | ./socprint.sh print d-lee psc008-dx
To print with shortname, using the redirection operator:
./socprint.sh p d-lee psc008-dx < ~/d/cs3210_tutorial8.pdf
To check jobs:
./socprint.sh jobs d-lee psc008-dx
To list printqueues:
./socprint.sh list d-lee
To download and run from any directory:
sudo curl https://raw.githubusercontent.com/dlqs/SOCprint/master/socprint.sh -o /usr/local/bin/socprint.sh
sudo chmod 755 /usr/local/bin/socprint.sh
PRINTQUEUES
Popular places:
- COM1 basement: psc008-dx psc008-sx psc011-dx psc011-sx
- COM1 L1, in front of tech svsc: psts-dx psts-sx pstb-dx pstb-sx pstc-dx pstc-sx
- -dx: double sided, -sx: single sided, -nb: no banner
- Most other printers have user restrictions.
See https://dochub.comp.nus.edu.sg/cf/guides/printing/print-queues.
- For the full list of printqueues, generate with the -l option, or view the SOURCE.
IMPLEMENTATION
Roughly speaking, the print command will:
1. Login to sunfire using ssh.
You will be prompted for your password, unless your identity files are set up.
This script *does not* save/record your password.
2. Copy the file into your home directory in sunfire, to a temporary file.
3. Submit your job to the printqueue.
4. List the printqueue. You job *should* appear. If not, something has gone wrong.
5. Remove the temporary file.
STANDARDS
This script targets conformance to POSIX.1-2017 standards (https://pubs.opengroup.org/onlinepubs/9699919799/).
Yes, you read that right and no, we're not kidding. POSIX™ compliance is serious enterprise business!!!1
POSIX™ is a Trademark of The IEEE.
SOURCE
https://github.com/dlqs/SOCprint
File bugs or POSIX™ compliance issues above.
CONTRIBUTORS
Donald Lee, Julius Nugroho, Sean Ng
KEYWORDS
how to print NUS SoC National University of Singapore School of Computing
printers shell command line basement sunfire mac windows linux bsd ben
LICENSE
This project is licensed under terms of the MIT License. Full text in source code.
GENERATE README
./socprint.sh help > README && echo "List of valid printqueues, generated with list command on 5 March 2021\n" >> README && ./socprint.sh list d-lee >> README
List of valid printqueues, generated with list command on 5 March 2021
psts
psts-sx
psts-dx
psts-nb
pstsb
pstsb-sx
pstsb-dx
pstsb-nb
pstsc
pstsc-sx
pstsc-dx
pstsc-nb
psgob
psgob-sx
psgob-dx
psgoc
psgoc-sx
psgoc-dx
psa206
psa206-sx
psa206-dx
psa403
psa403-sx
psa403-dx
psa411
psa411-sx
psa411-dx
psa413
psa413-sx
psa413-dx
psa421
psa421-sx
psa421-dx
psa425
psa425-sx
psa425-dx
psa426
psa426-sx
psa426-dx
psa427
psa427-sx
psa427-dx
psa501
psa501-sx
psa501-dx
psa502
psa502-sx
psa502-dx
psa518
psa518-sx
psa518-dx
psa518-nb
psa518-nb-sx
psa521
psa521-sx
psa521-dx
psa522
psa522-sx
psa522-dx
psa525
psa525-sx
psa525-dx
psa618
psa618-sx
psa618-dx
psc008
psc008-sx
psc008-dx
psc008-nb
psc011
psc011-sx
psc011-dx
psc011-nb
psc102
psc102-sx
psc102-dx
psc102-nb
psc102-nb-sx
psc106
psc106-sx
psc106-dx
psc106-nb
psc106-nb-sx
psc106-nb-dx
psc107
psc107-sx
psc107-dx
psc108
psc108-sx
psc108-dx
psc109
psc109-sx
psc109-dx
psc110
psc110-sx
psc110-dx
psc111
psc111-sx
psc111-dx
psc113
psc113-sx
psc113-dx
psc115
psc115-sx
psc115-dx
psc116
psc116-sx
psc116-dx
psc119
psc119-sx
psc119-dx
psc121
psc121-sx
psc121-dx
psc313
psc313-sx
psc313-dx
psc313-nb
psc313-nb-sx
psd001
psd001-sx
psd001-dx
psd002
psd002-sx
psd002-dx
psd003
psd003-sx
psd003-dx
psd102
psd102-sx
psd102-dx
psd103
psd103-sx
psd103-dx
psd105
psd105-sx
psd105-dx
psd106
psd106-sx
psd106-dx
psd107
psd107-sx
psd107-dx
psd109
psd109-sx
psd109-dx
psd110
psd110-sx
psd110-dx
psd238
psd238-sx
psd238-dx
psd238-nb
psd238-nb-sx
psd263
psd263-sx
psd263-dx
psd263-nb
psd263-nb-sx
psd313
psd313-sx
psd313-dx
psd313-nb
psd313-nb-sx
psd404
psd404-sx
psd404-dx
psd405
psd405-sx
psd405-dx
psd405-nb
psd405-nb-sx
psi505
psi505-sx
psi505-dx
psu102
psu102-sx
psu102-dx
psx302
psx302-sx
psx302-dx
psx302-nb
psx302-nb-sx
psx306
psx306-sx
psx306-dx
psx342a
psx342a-sx
psx342a-dx
psx342b
psx342b-sx
psx342b-dx