1234567890_ 1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. data/History.txt +6 -0
  2. data/Manifest.txt +5 -0
  3. data/README.txt +36 -0
  4. data/Rakefile +14 -0
  5. data/lib/1234567890.rb +32 -0
  6. metadata +100 -0
data/History.txt ADDED
@@ -0,0 +1,6 @@
1
+ === 1.0.0 / 2010-08-17
2
+
3
+ * 1 major enhancement
4
+
5
+ * Birthday!
6
+
data/Manifest.txt ADDED
@@ -0,0 +1,5 @@
1
+ History.txt
2
+ Manifest.txt
3
+ README.txt
4
+ Rakefile
5
+ lib/1234567890.rb
data/README.txt ADDED
@@ -0,0 +1,36 @@
1
+ = 1234567890
2
+
3
+ == DESCRIPTION:
4
+
5
+ 1234567890 allows you to write Ruby script by using only numbers.
6
+
7
+ == FEATURES/PROBLEMS:
8
+
9
+
10
+ == SYNOPSIS:
11
+
12
+ The following scr1pt is a ``Hello, world!'' program which can be executed
13
+ by Ruby interpreter:
14
+
15
+ require "1234567890"
16
+ 12375227084728963689345802900599797529983544843167693630265673133962913229034848394579236452760532103006111995248931164161057058
17
+
18
+ You can make a scr1pt by scr1pt:
19
+
20
+ require "1234567890"
21
+ puts scr1pt('puts"Hello, world!"')
22
+
23
+ == REQUIREMENTS:
24
+
25
+ none
26
+
27
+ NOTE: This library uses ObjectSpace; JRuby works but needs -X+O option.
28
+
29
+ == INSTALL:
30
+
31
+ * gem install 1234567890_
32
+
33
+ == LICENSE:
34
+
35
+ Copyright:: Yusuke Endoh <mame@tsg.ne.jp>
36
+ License:: Ruby's
data/Rakefile ADDED
@@ -0,0 +1,14 @@
1
+ # -*- ruby -*-
2
+
3
+ require 'rubygems'
4
+ require 'hoe'
5
+ require './lib/1234567890.rb'
6
+
7
+ VERSION = "1.0"
8
+
9
+ Hoe.spec '1234567890_' do |p|
10
+ developer('Yusuke Endoh', 'mame@tsg.ne.jp')
11
+ self.rubyforge_name = '1234567890_'
12
+ end
13
+
14
+ # vim: syntax=Ruby
data/lib/1234567890.rb ADDED
@@ -0,0 +1,32 @@
1
+ # Quote by Kurt Goedel
2
+ SIGNATURE_1234567890 = "I don't believe in natural science."
3
+
4
+ at_exit do
5
+ next if $scr1pt
6
+
7
+ # Gather all bignums in ObjectSpace
8
+ bignums = []
9
+ ObjectSpace.each_object(Bignum) {|n| bignums << n }
10
+ GC.enable
11
+
12
+ # Decode Goedel numbering (using only power of two)
13
+ bignums = bignums.map {|n| ["%x" % n].pack("H*") }
14
+
15
+ # Search the target bignum which contains SIGNATURE and the program
16
+ if n = bignums.find {|n| n.start_with?(SIGNATURE_1234567890) }
17
+ # Found! Then, run the encoded program.
18
+ eval(n[SIGNATURE_1234567890.size..-1])
19
+ end
20
+ end
21
+
22
+ # stop GC to preserve the bignum; actually, this is not needed because the
23
+ # source code marks the target bignum, but in case...
24
+ GC.disable
25
+
26
+ # Encoding function
27
+ def scr1pt(src)
28
+ $scr1pt = true
29
+ GC.enable
30
+ n = (SIGNATURE_1234567890 + src).unpack("H*")[0].hex
31
+ %(require "1234567890"\n\n#{ n })
32
+ end
metadata ADDED
@@ -0,0 +1,100 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: 1234567890_
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 1
7
+ - 0
8
+ version: "1.0"
9
+ platform: ruby
10
+ authors:
11
+ - Yusuke Endoh
12
+ autorequire:
13
+ bindir: bin
14
+ cert_chain: []
15
+
16
+ date: 2010-08-17 00:00:00 +09:00
17
+ default_executable:
18
+ dependencies:
19
+ - !ruby/object:Gem::Dependency
20
+ name: rubyforge
21
+ prerelease: false
22
+ requirement: &id001 !ruby/object:Gem::Requirement
23
+ none: false
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 2
29
+ - 0
30
+ - 4
31
+ version: 2.0.4
32
+ type: :development
33
+ version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
35
+ name: hoe
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
38
+ none: false
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ segments:
43
+ - 2
44
+ - 6
45
+ - 1
46
+ version: 2.6.1
47
+ type: :development
48
+ version_requirements: *id002
49
+ description: 1234567890 allows you to write Ruby script by using only numbers.
50
+ email:
51
+ - mame@tsg.ne.jp
52
+ executables: []
53
+
54
+ extensions: []
55
+
56
+ extra_rdoc_files:
57
+ - History.txt
58
+ - Manifest.txt
59
+ - README.txt
60
+ files:
61
+ - History.txt
62
+ - Manifest.txt
63
+ - README.txt
64
+ - Rakefile
65
+ - lib/1234567890.rb
66
+ has_rdoc: true
67
+ homepage:
68
+ licenses: []
69
+
70
+ post_install_message:
71
+ rdoc_options:
72
+ - --main
73
+ - README.txt
74
+ require_paths:
75
+ - lib
76
+ required_ruby_version: !ruby/object:Gem::Requirement
77
+ none: false
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ segments:
82
+ - 0
83
+ version: "0"
84
+ required_rubygems_version: !ruby/object:Gem::Requirement
85
+ none: false
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ segments:
90
+ - 0
91
+ version: "0"
92
+ requirements: []
93
+
94
+ rubyforge_project: 1234567890_
95
+ rubygems_version: 1.3.7
96
+ signing_key:
97
+ specification_version: 3
98
+ summary: 1234567890 allows you to write Ruby script by using only numbers.
99
+ test_files: []
100
+