mit_stalker 1.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG ADDED
@@ -0,0 +1 @@
1
+ v1.0. Initial release.
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright (c) 2009 Zergling.Net
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/Manifest ADDED
@@ -0,0 +1,10 @@
1
+ CHANGELOG
2
+ LICENSE
3
+ Manifest
4
+ README.textile
5
+ Rakefile
6
+ lib/mit_stalker.rb
7
+ test/fixtures/multi_response.txt
8
+ test/fixtures/no_response.txt
9
+ test/fixtures/single_response.txt
10
+ test/mit_stalker_test.rb
data/README.textile ADDED
@@ -0,0 +1,19 @@
1
+ h1. MIT Student Information Retriever
2
+
3
+ mit_stalker is a Ruby gem that parses publicly available information about MIT
4
+ students.
5
+
6
+ h2. Setup
7
+
8
+ bc. gem install mit_stalker
9
+
10
+ h2. Usage
11
+
12
+ Read the RDoc.
13
+
14
+ h2. Contributions
15
+
16
+ The code was factored out of the 6.006 Web site, and it contains exactly what I
17
+ needed for that site. I will not be adding features, but I will do my best to
18
+ fix bugs. If you want a feature, please don't hesitate to fork the project and
19
+ send me pull requests.
data/Rakefile ADDED
@@ -0,0 +1,28 @@
1
+ # Rakefile that uses echoe to manage mit_stalker's gemspec.
2
+ #
3
+ # Author:: Victor Costan
4
+ # Copyright:: Copyright (C) 2009 Zergling.Net
5
+ # License:: MIT
6
+
7
+ require 'rubygems'
8
+ require 'echoe'
9
+
10
+ Echoe.new('mit_stalker') do |p|
11
+ p.project = 'zerglings' # RubyForge project.
12
+
13
+ p.author = 'Victor Costan'
14
+ p.email = 'victor@zergling.net'
15
+ p.summary = "RAM-based cache for FeedTools."
16
+ p.url = 'http://github.com/costan/feed_tools_ram_cache'
17
+ p.dependencies = ["feedtools >=0.2.29"]
18
+ p.development_dependencies = ["echoe >=3.1.1", "flexmock >=0.8.6"]
19
+
20
+ p.need_tar_gz = true
21
+ p.need_zip = true
22
+ p.rdoc_pattern = /^(lib|bin|tasks|ext)|^BUILD|^README|^CHANGELOG|^TODO|^LICENSE|^COPYING$/
23
+ end
24
+
25
+ if $0 == __FILE__
26
+ Rake.application = Rake::Application.new
27
+ Rake.application.run
28
+ end
@@ -0,0 +1,107 @@
1
+ # Fetch publicly available information about MIT students.
2
+ #
3
+ # Author:: Victor Costan
4
+ # Copyright:: Copyright (C) 2009 Zergling.Net
5
+ # License:: MIT
6
+
7
+ require 'socket'
8
+
9
+
10
+ # Fetch publicly available information about MIT students.
11
+ module MitStalker
12
+ # Issues a finger request to a server.
13
+ #
14
+ # Returns a string containing the finger response, or nil if something went
15
+ # wrong.
16
+ def self.finger(request, host)
17
+ begin
18
+ client = TCPSocket.open host, 'finger'
19
+ client.send request + "\n", 0 # 0 means standard packet
20
+ result = client.readlines.join
21
+ client.close
22
+
23
+ return result
24
+ rescue
25
+ return nil
26
+ end
27
+ end
28
+
29
+ # Retrieves an MIT student's full name, based on the Athena username.
30
+ #
31
+ # Returns a string containing the full name, or nil if the Athena username is
32
+ # not recognized.
33
+ def self.full_name_from_user_name(user_name)
34
+ athena_data = finger user_name, 'linux.mit.edu'
35
+ return nil if athena_data.nil?
36
+ match = athena_data.match /(N|n)ame\: (.*)$/
37
+ match and match[2].strip
38
+ end
39
+
40
+ # Parses a MIT directory response into users.
41
+ #
42
+ # Returns a (possibly empty) array of hashes, with one hash per user. A hash
43
+ # has the directory information for the user, using symbols as keys, e.g.
44
+ # {:name => 'Victor Costan', :year => '1'}
45
+ def self.parse_mitdir_response(response)
46
+ return [] if response.nil?
47
+
48
+ lines = response.split("\r\n").reverse
49
+ users = []
50
+ user = {}
51
+ lines.each do |line|
52
+ if line.empty?
53
+ users << user unless user.empty?
54
+ user = {}
55
+ next
56
+ end
57
+
58
+ match = /([^:]*):(.+)/.match line
59
+ break unless match
60
+
61
+ user[match[1].strip.downcase.gsub(' ', '_').to_sym] = match[2].strip
62
+ end
63
+ users
64
+ end
65
+
66
+ # Computes a name vector from a full name.
67
+ #
68
+ # The same name, in different formats, should yield the same vector. Different
69
+ # names should yield different vectors.
70
+ def self.name_vector(name)
71
+ name.gsub(/\W/, ' ').gsub(/ +/, ' ').split.sort
72
+ end
73
+
74
+ # Narrows down a MIT directory response to a single user.
75
+ #
76
+ # Returns a single user information hash, or nil if no user has the given
77
+ # full name.
78
+ def self.refine_mitdir_response(users, full_name)
79
+ vector = name_vector(full_name)
80
+ user_base_info = users.find { |user| name_vector(user[:name]) == vector }
81
+ return nil unless user_base_info
82
+
83
+ # Don't make an extra request for the same info.
84
+ return users.first if users.length == 1
85
+
86
+ # Requesting by alias should return a single name.
87
+ users = parse_mitdir_response finger(user_base_info[:alias], 'web.mit.edu')
88
+ users and users.first
89
+ end
90
+
91
+ # Retrieves information about an MIT student from an Athena username.
92
+ #
93
+ # Returns a hash containing user information, or nil if the user was not
94
+ # found.
95
+ def self.from_user_name(user_name)
96
+ full_name = full_name_from_user_name user_name
97
+ return nil unless full_name
98
+
99
+ users = parse_mitdir_response finger(full_name, 'web.mit.edu')
100
+ if users.empty?
101
+ users = parse_mitdir_response finger(user_name, 'web.mit.edu')
102
+ end
103
+
104
+ user = refine_mitdir_response(users, full_name)
105
+ user and user.merge(:full_name => full_name)
106
+ end
107
+ end
@@ -0,0 +1,40 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{mit_stalker}
5
+ s.version = "1.0"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Victor Costan"]
9
+ s.date = %q{2009-09-29}
10
+ s.description = %q{RAM-based cache for FeedTools.}
11
+ s.email = %q{victor@zergling.net}
12
+ s.extra_rdoc_files = ["CHANGELOG", "LICENSE", "README.textile", "lib/mit_stalker.rb"]
13
+ s.files = ["CHANGELOG", "LICENSE", "Manifest", "README.textile", "Rakefile", "lib/mit_stalker.rb", "test/fixtures/multi_response.txt", "test/fixtures/no_response.txt", "test/fixtures/single_response.txt", "test/mit_stalker_test.rb", "mit_stalker.gemspec"]
14
+ s.homepage = %q{http://github.com/costan/feed_tools_ram_cache}
15
+ s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Mit_stalker", "--main", "README.textile"]
16
+ s.require_paths = ["lib"]
17
+ s.rubyforge_project = %q{zerglings}
18
+ s.rubygems_version = %q{1.3.5}
19
+ s.summary = %q{RAM-based cache for FeedTools.}
20
+ s.test_files = ["test/mit_stalker_test.rb"]
21
+
22
+ if s.respond_to? :specification_version then
23
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
24
+ s.specification_version = 3
25
+
26
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
27
+ s.add_runtime_dependency(%q<feedtools>, [">= 0.2.29"])
28
+ s.add_development_dependency(%q<echoe>, [">= 3.1.1"])
29
+ s.add_development_dependency(%q<flexmock>, [">= 0.8.6"])
30
+ else
31
+ s.add_dependency(%q<feedtools>, [">= 0.2.29"])
32
+ s.add_dependency(%q<echoe>, [">= 3.1.1"])
33
+ s.add_dependency(%q<flexmock>, [">= 0.8.6"])
34
+ end
35
+ else
36
+ s.add_dependency(%q<feedtools>, [">= 0.2.29"])
37
+ s.add_dependency(%q<echoe>, [">= 3.1.1"])
38
+ s.add_dependency(%q<flexmock>, [">= 0.8.6"])
39
+ end
40
+ end
@@ -0,0 +1,732 @@
1
+ Student data loaded as of Sep 29, Staff data loaded as of Sep 29.
2
+
3
+ Notify Personnel or use WebSIS as appropriate to change your information.
4
+
5
+ Our on-line help system describes
6
+ How to change data, how the directory works, where to get more info.
7
+ For a listing of help topics, enter finger help@mit.edu. Try finger
8
+ help_about@mit.edu to read about how the directory works.
9
+ Directory bluepages may be found at http://mit.edu/communications/bp.
10
+
11
+ There were 155 matches to your request.
12
+
13
+ Complete information will be shown only when one individual matches
14
+ your query. Resubmit your query with more information.
15
+ For example, use both firstname and lastname or use the alias field.
16
+
17
+ name: Li, Alice
18
+ department: Electrical Eng & Computer Sci
19
+ year: 4
20
+ alias: A-li
21
+
22
+ name: Li, Amber H.
23
+ year: 1
24
+ alias: A-li1
25
+
26
+ name: Li, An
27
+ department: Electrical Eng & Computer Sci
28
+ year: 4
29
+ alias: A-li2
30
+
31
+ name: Li, Aoxi
32
+ department: Physics
33
+ year: 2
34
+ alias: A-li3
35
+
36
+ name: Li, Adrienne Victoria
37
+ department: Biological Engineering
38
+ year: G
39
+ alias: A-li4
40
+
41
+ name: Li, Anye
42
+ department: Lincoln Laboratory
43
+ title: LL - Assistant Staff
44
+ alias: A-li5
45
+
46
+ name: Li, Bo
47
+ title: MIT Affiliate
48
+ alias: B-li
49
+
50
+ name: Li, Bokyung
51
+ department: Management
52
+ year: G
53
+ alias: B-li1
54
+
55
+ name: Li, Biao
56
+ department: Laboratory for Manufacturing and Productivity
57
+ title: Visiting Engineer
58
+ alias: B-li2
59
+
60
+ name: Li, Chen
61
+ title: MIT Affiliate
62
+ alias: C-li
63
+
64
+ name: Li, Chi King
65
+ title: MIT Affiliate
66
+ alias: C-li1
67
+
68
+ name: Li, Chunyu
69
+ title: MIT Affiliate
70
+ alias: C-li2
71
+
72
+ name: Li, Chun
73
+ title: MIT Affiliate
74
+ alias: C-li3
75
+
76
+ name: Li, Chung-Lun
77
+ title: MIT Affiliate
78
+ alias: C-li4
79
+
80
+ name: Li, Cheng
81
+ department: Health Sciences & Technology
82
+ year: G
83
+ alias: C-li5
84
+
85
+ name: Li, Cheri Yingjie
86
+ department: Chemical Engineering
87
+ year: G
88
+ alias: C-li6
89
+
90
+ name: Li, Chikang
91
+ department: Plasma Science and Fusion Center
92
+ title: Principal Research Scientist
93
+ alias: C-li7
94
+
95
+ name: Li, Daniel
96
+ title: MIT Affiliate
97
+ alias: D-li
98
+
99
+ name: Li, Donghong
100
+ title: MIT Affiliate
101
+ alias: D-li1
102
+
103
+ name: Li, Danielle
104
+ department: Economics
105
+ year: G
106
+ alias: D-li2
107
+
108
+ name: Li, Daniel C
109
+ department: Management
110
+ year: 3
111
+ alias: D-li3
112
+
113
+ name: Li, David
114
+ department: Electrical Eng & Computer Sci
115
+ year: 4
116
+ alias: D-li4
117
+
118
+ name: Li, Dai-Yin
119
+ alias: D-li5
120
+
121
+ name: Li, Duo
122
+ department: Electrical Eng & Computer Sci
123
+ year: G
124
+ alias: D-li6
125
+
126
+ name: Li, Derek Z
127
+ department: Mechanical Engineering
128
+ year: 3
129
+ alias: D-li7
130
+
131
+ name: Li, Dian
132
+ department: Political Science
133
+ year: G
134
+ alias: D-li8
135
+
136
+ name: Li, Deyu
137
+ department: Department of Biological Engineering
138
+ title: Postdoctoral Associate
139
+ alias: D-li9
140
+
141
+ name: Li, Enhao
142
+ title: MIT Affiliate
143
+ alias: E-li
144
+
145
+ name: Li, Fang
146
+ title: MIT Affiliate
147
+ alias: F-li
148
+
149
+ name: Li, Fulu
150
+ title: MIT Affiliate
151
+ alias: F-li1
152
+
153
+ name: Li, Frank H.
154
+ year: 1
155
+ alias: F-li2
156
+
157
+ name: Li, Guang
158
+ title: MIT Affiliate
159
+ alias: G-li
160
+
161
+ name: Li, Grace M
162
+ department: Electrical Eng & Computer Sci
163
+ year: 4
164
+ alias: G-li1
165
+
166
+ name: Li, George Z
167
+ department: Chemical Engineering
168
+ year: 4
169
+ alias: G-li2
170
+
171
+ name: Li, Guoan
172
+ department: Department of Mechanical Engineering
173
+ title: Lecturer
174
+ alias: G-li3
175
+
176
+ name: Li, Guohui
177
+ department: Dept of Earth, Atmospheric, & Planetary Sciences
178
+ title: Postdoctoral Associate
179
+ alias: G-li4
180
+
181
+ name: Li, Hua-Jung
182
+ title: MIT Affiliate
183
+ alias: H-li
184
+
185
+ name: Li, Hong
186
+ title: MIT Affiliate
187
+ alias: H-li1
188
+
189
+ name: Li, Hanhan
190
+ title: MIT Affiliate
191
+ alias: H-li2
192
+
193
+ name: Li, Huipeng
194
+ title: MIT Affiliate
195
+ alias: H-li3
196
+
197
+ name: Li, Hanqing
198
+ department: Management
199
+ year: G
200
+ alias: H-li4
201
+
202
+ name: Li, HaoQi
203
+ department: Biology
204
+ year: 3
205
+ alias: H-li5
206
+
207
+ name: Li, Hsinjung
208
+ department: Chemical Engineering
209
+ year: 3
210
+ alias: H-li6
211
+
212
+ name: Li, Hui
213
+ department: Aeronautics And Astronautics
214
+ year: G
215
+ alias: H-li7
216
+
217
+ name: Li, Harriet
218
+ year: 1
219
+ alias: H-li8
220
+
221
+ name: Li, Hongyi
222
+ department: Economics
223
+ year: 3
224
+ alias: H-li9
225
+
226
+ name: Li, Hanqing
227
+ department: Microsystems Technology Laboratories
228
+ title: Research Scientist
229
+ alias: H-li10
230
+
231
+ name: Li, Jim
232
+ title: MIT Affiliate
233
+ alias: J-li
234
+
235
+ name: Li, Jie
236
+ title: MIT Affiliate
237
+ alias: J-li1
238
+
239
+ name: Li, Jacqueline
240
+ department: Non-Institute Harvard
241
+ year: 3
242
+ alias: J-li2
243
+
244
+ name: Li, Jennifer
245
+ department: Electrical Eng & Computer Sci
246
+ year: 3
247
+ alias: J-li3
248
+
249
+ name: Li, Jessica X.
250
+ year: 1
251
+ alias: J-li4
252
+
253
+ name: Li, Jessie Q
254
+ department: Electrical Eng & Computer Sci
255
+ year: 3
256
+ alias: J-li5
257
+
258
+ name: Li, Jialing
259
+ department: Physics
260
+ year: G
261
+ alias: J-li6
262
+
263
+ name: Li, Janet
264
+ department: Biology
265
+ year: 2
266
+ alias: J-li7
267
+
268
+ name: Li, Josepher
269
+ year: 1
270
+ alias: J-li8
271
+
272
+ name: Li, Junlun
273
+ department: Earth, Atmos, & Planetary Sci
274
+ year: G
275
+ alias: J-li9
276
+
277
+ name: Li, Justine
278
+ department: Aeronautics And Astronautics
279
+ year: 4
280
+ alias: J-li10
281
+
282
+ name: Li, Jing
283
+ department: Electrical Eng & Computer Sci
284
+ year: 3
285
+ alias: J-li11
286
+
287
+ name: Li, Jinghua
288
+ department: Department of Urban Studies and Planning
289
+ title: Visiting Scholar
290
+ alias: J-li12
291
+
292
+ name: Li, Kai
293
+ title: MIT Affiliate
294
+ alias: K-li
295
+
296
+ name: Li, Karen R
297
+ department: Economics
298
+ year: 3
299
+ alias: K-li1
300
+
301
+ name: Li, Kathleen Y
302
+ department: Biology
303
+ year: 3
304
+ alias: K-li2
305
+
306
+ name: Li, Kimberly Q.
307
+ department: Electrical Eng & Computer Sci
308
+ year: 2
309
+ alias: K-li3
310
+
311
+ name: Li, Kevin K.
312
+ year: 1
313
+ alias: K-li4
314
+
315
+ name: Li, Lin
316
+ title: MIT Affiliate
317
+ alias: L-li
318
+
319
+ name: Li, Loretta S
320
+ title: MIT Affiliate
321
+ alias: L-li1
322
+
323
+ name: Li, Lulu
324
+ title: MIT Affiliate
325
+ alias: L-li2
326
+
327
+ name: Li, Leon Daliang
328
+ department: Health Sciences & Technology
329
+ year: G
330
+ alias: L-li3
331
+
332
+ name: Li, Lifang
333
+ department: Mechanical Engineering
334
+ year: G
335
+ alias: L-li4
336
+
337
+ name: Li, Ling
338
+ department: Materials Science And Eng.
339
+ year: G
340
+ alias: L-li5
341
+
342
+ name: Li, Lishuai
343
+ department: Aeronautics And Astronautics
344
+ year: G
345
+ alias: L-li6
346
+
347
+ name: Li, Letitia W
348
+ department: Electrical Eng & Computer Sci
349
+ year: 3
350
+ alias: L-li7
351
+
352
+ name: Li, Lynn Lei
353
+ alias: L-li8
354
+
355
+ name: Li, Li
356
+ department: Department of Chemistry
357
+ title: Research Specialist
358
+ alias: L-li9
359
+
360
+ name: Li, Lu
361
+ department: Department of Physics
362
+ title: Postdoctoral Fellow
363
+ alias: L-li10
364
+
365
+ name: Li, Mingjie
366
+ title: MIT Affiliate
367
+ alias: M-li
368
+
369
+ name: Li, Man Chung
370
+ department: Biology
371
+ year: G
372
+ alias: M-li1
373
+
374
+ name: Li, Mingda
375
+ department: Nuclear Science & Engineering
376
+ year: G
377
+ alias: M-li2
378
+
379
+ name: Li, Meng
380
+ department: Computation For Design & Optimization
381
+ year: G
382
+ alias: M-li3
383
+
384
+ name: Li, Ning
385
+ title: MIT Affiliate
386
+ alias: N-li
387
+
388
+ name: Li, Nan
389
+ department: Mathematics
390
+ year: G
391
+ alias: N-li1
392
+
393
+ name: Li, Nathan P
394
+ department: Management
395
+ year: 3
396
+ alias: N-li2
397
+
398
+ name: Li, Ning
399
+ department: Leaders for Global Operations Program
400
+ title: Visiting Scholar
401
+ alias: N-li3
402
+
403
+ name: Li, Puyao C.
404
+ department: Health Sciences & Technology
405
+ year: G
406
+ alias: P-li
407
+
408
+ name: Li, Patricia Z.
409
+ year: 1
410
+ alias: P-li1
411
+
412
+ name: Li, Ping
413
+ department: Department of Chemistry
414
+ title: Postdoctoral Fellow
415
+ alias: P-li2
416
+
417
+ name: Li Ting, Poh
418
+ title: MIT Affiliate
419
+ alias: P-liting
420
+
421
+ name: Li, Qing
422
+ title: MIT Affiliate
423
+ alias: Q-li
424
+
425
+ name: Li, Qiushi
426
+ title: MIT Affiliate
427
+ alias: Q-li1
428
+
429
+ name: Li, Quentin
430
+ title: MIT Affiliate
431
+ alias: Q-li2
432
+
433
+ name: Li, Qing
434
+ department: Management
435
+ year: 4
436
+ alias: Q-li3
437
+
438
+ name: Li, Qing
439
+ department: Management
440
+ year: 2
441
+ alias: Q-li4
442
+
443
+ name: Li, Qiuyuan J
444
+ department: Electrical Eng & Computer Sci
445
+ year: G
446
+ alias: Q-li5
447
+
448
+ name: Li, Qingnan
449
+ department: Mathematics
450
+ year: 2
451
+ alias: Q-li6
452
+
453
+ name: Li, Qu
454
+ department: Department of Civil and Environmental Engineering
455
+ title: Research Assistant
456
+ alias: Q-li7
457
+
458
+ name: Li, Randolph H
459
+ title: MIT Affiliate
460
+ alias: R-li
461
+
462
+ name: Li, Ran
463
+ title: MIT Affiliate
464
+ alias: R-li1
465
+
466
+ name: Li, Ranning
467
+ department: Management
468
+ year: G
469
+ alias: R-li2
470
+
471
+ name: Li, Richard
472
+ department: Aeronautics And Astronautics
473
+ year: 4
474
+ alias: R-li3
475
+
476
+ name: Li, Rui
477
+ department: Electrical Eng & Computer Sci
478
+ year: G
479
+ alias: R-li4
480
+
481
+ name: Li, Sean A
482
+ title: MIT Affiliate
483
+ alias: S-li
484
+
485
+ name: Li, Sheung L
486
+ title: MIT Affiliate
487
+ alias: S-li1
488
+
489
+ name: Li, Shuo C.
490
+ department: Electrical Eng & Computer Sci
491
+ year: 2
492
+ alias: S-li2
493
+
494
+ name: Li, Shirley Xue
495
+ department: Management
496
+ year: G
497
+ alias: S-li3
498
+
499
+ name: Li, Tieyu
500
+ department: Engineering Systems Division
501
+ year: G
502
+ alias: T-li
503
+
504
+ name: Li, Tong
505
+ year: 1
506
+ alias: T-li1
507
+
508
+ name: Li, Tracy Y
509
+ department: Physics
510
+ year: 4
511
+ alias: T-li2
512
+
513
+ name: Li, Victoria
514
+ title: MIT Affiliate
515
+ alias: V-li
516
+
517
+ name: Li, Weigang
518
+ title: MIT Affiliate
519
+ alias: W-li
520
+
521
+ name: Li, Wendi
522
+ title: MIT Affiliate
523
+ alias: W-li1
524
+
525
+ name: Li, Wentao
526
+ title: MIT Affiliate
527
+ alias: W-li2
528
+
529
+ name: Li, Wu
530
+ title: MIT Affiliate
531
+ alias: W-li3
532
+
533
+ name: Li, Wei
534
+ department: Electrical Eng & Computer Sci
535
+ year: G
536
+ alias: W-li4
537
+
538
+ name: Li, Weifeng
539
+ department: Urban Studies And Planning
540
+ year: G
541
+ alias: W-li5
542
+
543
+ name: Li, Weiliang
544
+ department: Aeronautics And Astronautics
545
+ year: G
546
+ alias: W-li6
547
+
548
+ name: Li, Weisen Janet
549
+ department: Management
550
+ year: G
551
+ alias: W-li7
552
+
553
+ name: Li, William Pui Lum
554
+ department: Engineering Systems Division
555
+ year: G
556
+ alias: W-li8
557
+
558
+ name: Li, Wu-Hsi
559
+ department: Media Arts And Sciences
560
+ year: G
561
+ alias: W-li9
562
+
563
+ name: Li, Wai-ming
564
+ department: Information Services & Technology
565
+ title: Team Leader, Technical Services
566
+ alias: W-li10
567
+
568
+ name: Li, Wei
569
+ department: Laboratory for Nuclear Science
570
+ title: Postdoctoral Associate
571
+ alias: W-li11
572
+
573
+ name: Li, Xiaochang
574
+ title: MIT Affiliate
575
+ alias: X-li
576
+
577
+ name: Li, Xianlin
578
+ title: MIT Affiliate
579
+ alias: X-li1
580
+
581
+ name: Li, Xuying
582
+ department: Mathematics
583
+ year: 3
584
+ alias: X-li2
585
+
586
+ name: Li, Xingyi
587
+ department: Electrical Eng & Computer Sci
588
+ year: 3
589
+ alias: X-li3
590
+
591
+ name: Li, Xin
592
+ department: Urban Studies And Planning
593
+ year: G
594
+ alias: X-li4
595
+
596
+ name: Li, Xin Qi
597
+ department: Biology
598
+ year: 2
599
+ alias: X-li5
600
+
601
+ name: Li, Xitong
602
+ department: Management
603
+ year: G
604
+ alias: X-li6
605
+
606
+ name: Li, Xiang
607
+ department: Department of Chemical Engineering
608
+ title: Visiting Scholar
609
+ alias: X-li7
610
+
611
+ name: Li, Yuanjian
612
+ title: MIT Affiliate
613
+ alias: Y-li
614
+
615
+ name: Li, Yu
616
+ title: MIT Affiliate
617
+ alias: Y-li1
618
+
619
+ name: Li, Yue
620
+ title: MIT Affiliate
621
+ alias: Y-li2
622
+
623
+ name: Li, Yuanzhen
624
+ title: MIT Affiliate
625
+ alias: Y-li3
626
+
627
+ name: Li, Yuan
628
+ department: Non-Institute Wellesley
629
+ year: 4
630
+ alias: Y-li4
631
+
632
+ name: Li, Yu-Tzu
633
+ department: Chemistry
634
+ year: G
635
+ alias: Y-li5
636
+
637
+ name: Li, Yujing
638
+ department: Architecture
639
+ year: 4
640
+ alias: Y-li6
641
+
642
+ name: Li, Yong
643
+ department: Mechanical Engineering
644
+ year: G
645
+ alias: Y-li7
646
+
647
+ name: Li, Yan
648
+ department: Electrical Eng & Computer Sci
649
+ year: G
650
+ alias: Y-li8
651
+
652
+ name: Li, Yat Ming Victor
653
+ department: Mechanical Engineering
654
+ year: 3
655
+ alias: Y-li9
656
+
657
+ name: Li, Yang
658
+ department: Biological Engineering
659
+ year: G
660
+ alias: Y-li10
661
+
662
+ name: Li, YingFei
663
+ department: Biological Engineering
664
+ year: 4
665
+ alias: Y-li11
666
+
667
+ name: Li, Yinqing
668
+ department: Electrical Eng & Computer Sci
669
+ year: G
670
+ alias: Y-li12
671
+
672
+ name: Li, Yan
673
+ department: Mathematics
674
+ year: 2
675
+ alias: Y-li13
676
+
677
+ name: Li, Yue
678
+ department: Mechanical Engineering
679
+ year: 3
680
+ alias: Y-li14
681
+
682
+ name: Li, Yuqiong
683
+ department: Chemical Engineering
684
+ year: G
685
+ alias: Y-li15
686
+
687
+ name: Li, Yan Ping
688
+ department: Division of Comparative Medicine
689
+ title: Assistant Animal Technician
690
+ alias: Y-li16
691
+
692
+ name: Li, Yang
693
+ department: Department of Chemistry
694
+ title: Postdoctoral Associate
695
+ alias: Y-li17
696
+
697
+ name: Li, Yaning
698
+ department: Department of Mechanical Engineering
699
+ title: Postdoctoral Associate
700
+ alias: Y-li18
701
+
702
+ name: Li, Yi
703
+ department: Department of Materials Science and Engineering
704
+ title: SMA Visiting Scientist
705
+ alias: Y-li19
706
+
707
+ name: Li, Zane K
708
+ title: MIT Affiliate
709
+ alias: Z-li
710
+
711
+ name: Li, Zhongwei
712
+ title: MIT Affiliate
713
+ alias: Z-li1
714
+
715
+ name: Li, Zhen
716
+ department: Electrical Eng & Computer Sci
717
+ year: G
718
+ alias: Z-li2
719
+
720
+ name: Li, Zhipeng
721
+ department: Electrical Eng & Computer Sci
722
+ alias: Z-li3
723
+
724
+ name: Li, Zhi
725
+ department: Department of Chemical Engineering
726
+ title: SMA Visiting Scientist
727
+ alias: Z-li4
728
+
729
+ name: Li, Zhuan
730
+ department: Division of Comparative Medicine
731
+ title: Assistant Animal Technician
732
+ alias: Z-li5
@@ -0,0 +1,11 @@
1
+ Student data loaded as of Sep 29, Staff data loaded as of Sep 29.
2
+
3
+ Notify Personnel or use WebSIS as appropriate to change your information.
4
+
5
+ Our on-line help system describes
6
+ How to change data, how the directory works, where to get more info.
7
+ For a listing of help topics, enter finger help@mit.edu. Try finger
8
+ help_about@mit.edu to read about how the directory works.
9
+ Directory bluepages may be found at http://mit.edu/communications/bp.
10
+
11
+ No matches to your query.
@@ -0,0 +1,21 @@
1
+ Student data loaded as of Sep 29, Staff data loaded as of Sep 29.
2
+
3
+ Notify Personnel or use WebSIS as appropriate to change your information.
4
+
5
+ Our on-line help system describes
6
+ How to change data, how the directory works, where to get more info.
7
+ For a listing of help topics, enter finger help@mit.edu. Try finger
8
+ help_about@mit.edu to read about how the directory works.
9
+ Directory bluepages may be found at http://mit.edu/communications/bp.
10
+
11
+ There was 1 match to your request.
12
+
13
+ name: Costan, Victor Marius
14
+ email: costan@MIT.EDU
15
+ phone: (617) 452-5244
16
+ address: Sidney-Pacific NW86-948C
17
+ department: Electrical Eng & Computer Sci
18
+ school: School Of Engineering
19
+ year: G
20
+ url: http://www.costan.us
21
+ alias: V-costan
@@ -0,0 +1,80 @@
1
+ # Author:: Victor Costan
2
+ # Copyright:: Copyright (C) 2009 Zergling.Net
3
+ # License:: MIT
4
+
5
+ require 'mit_stalker'
6
+ require 'test/unit'
7
+ require 'flexmock/test_unit'
8
+
9
+
10
+ class MitStalkerTest < Test::Unit::TestCase
11
+ def fixture(name)
12
+ File.read File.join(File.dirname(__FILE__), 'fixtures', name)
13
+ end
14
+
15
+ def test_finger
16
+ assert_equal nil, MitStalker.finger('root', 'nosuchhostname.com'),
17
+ 'Invalid hostname'
18
+
19
+ result = MitStalker.finger('no_such_user', 'web.mit.edu')
20
+ assert_operator(/matche?s? to your (query)|(request)/, :=~, result,
21
+ "The finger response looks incorrect")
22
+ end
23
+
24
+ def test_full_name
25
+ assert_equal 'Srinivas Devadas',
26
+ MitStalker.full_name_from_user_name('devadas')
27
+ assert_equal nil, MitStalker.full_name_from_user_name('no_user')
28
+ end
29
+
30
+ def test_parse_mitdir_no_response
31
+ assert_equal [],
32
+ MitStalker.parse_mitdir_response(fixture('no_response.txt'))
33
+ end
34
+
35
+ def test_parse_mitdir_single_response
36
+ response = MitStalker.parse_mitdir_response fixture('single_response.txt')
37
+ assert_equal 1, response.length, 'Response should have 1 user'
38
+
39
+ assert_equal 'Costan, Victor Marius', response.first[:name]
40
+ assert_equal 'costan@MIT.EDU', response.first[:email]
41
+ assert_equal 'G', response.first[:year]
42
+ assert_equal 'Sidney-Pacific NW86-948C', response.first[:address]
43
+ assert_equal 'http://www.costan.us', response.first[:url]
44
+ assert_equal 'V-costan', response.first[:alias]
45
+ end
46
+
47
+ def test_parse_mitdir_multiple_responses
48
+ response = MitStalker.parse_mitdir_response fixture('multi_response.txt')
49
+ assert_equal 155, response.length, 'Response should have 110 users'
50
+
51
+ response.each do |user|
52
+ assert_operator(/Li/, :=~, user[:name], "Name doesn't match query")
53
+ assert_operator(/li/i, :=~, user[:alias], "Alias doesn't match query")
54
+ end
55
+ end
56
+
57
+ def test_name_vector
58
+ ['Victor-Marius Costan', 'Victor Marius Costan', 'Costan, Victor-Marius',
59
+ 'Costan, Victor Marius'].each do |name|
60
+ assert_equal ['Costan', 'Marius', 'Victor'], MitStalker.name_vector(name)
61
+ end
62
+ end
63
+
64
+ def test_refine_mitdir_response
65
+ flexmock(MitStalker).should_receive(:finger).with('Y-li16', 'web.mit.edu').
66
+ and_return(fixture('single_response.txt'))
67
+
68
+ multi_response =
69
+ MitStalker.parse_mitdir_response fixture('multi_response.txt')
70
+ user = MitStalker.refine_mitdir_response multi_response, 'Yan Ping Li'
71
+ assert_equal 'costan@MIT.EDU', user[:email], 'Wrong user information'
72
+ end
73
+
74
+ def test_from_user_name
75
+ assert_equal nil, MitStalker.from_user_name('no_such_user')
76
+
77
+ info = MitStalker.from_user_name 'devadas'
78
+ assert_equal 'Devadas, Srinivas', info[:name]
79
+ end
80
+ end
metadata ADDED
@@ -0,0 +1,102 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mit_stalker
3
+ version: !ruby/object:Gem::Version
4
+ version: "1.0"
5
+ platform: ruby
6
+ authors:
7
+ - Victor Costan
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-09-29 00:00:00 -04:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: feedtools
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 0.2.29
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: echoe
27
+ type: :development
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 3.1.1
34
+ version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: flexmock
37
+ type: :development
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: 0.8.6
44
+ version:
45
+ description: RAM-based cache for FeedTools.
46
+ email: victor@zergling.net
47
+ executables: []
48
+
49
+ extensions: []
50
+
51
+ extra_rdoc_files:
52
+ - CHANGELOG
53
+ - LICENSE
54
+ - README.textile
55
+ - lib/mit_stalker.rb
56
+ files:
57
+ - CHANGELOG
58
+ - LICENSE
59
+ - Manifest
60
+ - README.textile
61
+ - Rakefile
62
+ - lib/mit_stalker.rb
63
+ - test/fixtures/multi_response.txt
64
+ - test/fixtures/no_response.txt
65
+ - test/fixtures/single_response.txt
66
+ - test/mit_stalker_test.rb
67
+ - mit_stalker.gemspec
68
+ has_rdoc: true
69
+ homepage: http://github.com/costan/feed_tools_ram_cache
70
+ licenses: []
71
+
72
+ post_install_message:
73
+ rdoc_options:
74
+ - --line-numbers
75
+ - --inline-source
76
+ - --title
77
+ - Mit_stalker
78
+ - --main
79
+ - README.textile
80
+ require_paths:
81
+ - lib
82
+ required_ruby_version: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ version: "0"
87
+ version:
88
+ required_rubygems_version: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - ">="
91
+ - !ruby/object:Gem::Version
92
+ version: "1.2"
93
+ version:
94
+ requirements: []
95
+
96
+ rubyforge_project: zerglings
97
+ rubygems_version: 1.3.5
98
+ signing_key:
99
+ specification_version: 3
100
+ summary: RAM-based cache for FeedTools.
101
+ test_files:
102
+ - test/mit_stalker_test.rb