desperado 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +26 -0
- data/bin/desperado +42 -0
- metadata +50 -0
data/README.md
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# Desperado
|
2
|
+
|
3
|
+
集中することを……強いられているんだ!
|
4
|
+
|
5
|
+
## 使い方
|
6
|
+
|
7
|
+
$ gem install desperado
|
8
|
+
$ sudo desperado -b twitter.com
|
9
|
+
|
10
|
+
これでTwitterにはアクセスできなくなりました。よかったですね。
|
11
|
+
|
12
|
+
$ sudo desperado -u twitter.com
|
13
|
+
|
14
|
+
解除は `-u` もしくは `--unblock` 。追加は `-b` もしくは `--block` です。
|
15
|
+
|
16
|
+
## 指定しておくと便利なサイト
|
17
|
+
|
18
|
+
- twitter.com
|
19
|
+
- facebook.com
|
20
|
+
- mixi.jp
|
21
|
+
- pixiv.net
|
22
|
+
- nicovideo.jp
|
23
|
+
- これだけだとブロックしきれないので www.nicovideo.jp も
|
24
|
+
- youtube.com
|
25
|
+
- www.youtube.com
|
26
|
+
|
data/bin/desperado
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'optparse'
|
4
|
+
|
5
|
+
Version = '0.0.1'
|
6
|
+
|
7
|
+
def sh(str)
|
8
|
+
`#{str}`
|
9
|
+
end
|
10
|
+
|
11
|
+
block_hosts = []
|
12
|
+
unblock_hosts = []
|
13
|
+
|
14
|
+
opt = OptionParser.new
|
15
|
+
|
16
|
+
opt.on('-b', '--block HOSTNAME', 'block HOSTNAME') { | host |
|
17
|
+
block_hosts << host
|
18
|
+
}
|
19
|
+
|
20
|
+
opt.on('-u', '--unblock HOSTNAME', 'unblock HOSTNAME') { | host |
|
21
|
+
unblock_hosts << host
|
22
|
+
}
|
23
|
+
|
24
|
+
opt.parse!(ARGV)
|
25
|
+
|
26
|
+
hosts = open('/etc/hosts', 'r') { | f | f.read }
|
27
|
+
|
28
|
+
block_hosts.each do | host |
|
29
|
+
unless hosts.match(/^127\.0\.0\.1\s+#{host}/)
|
30
|
+
hosts << "\n127.0.0.1 #{host}"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
unblock_hosts.each do | host |
|
35
|
+
if m = hosts.match(/^127\.0\.0\.1\s+#{host}$/)
|
36
|
+
hosts.sub!(/^127\.0\.0\.1\s+#{host}\n?/, '')
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
open('/etc/hosts', 'w'){|f| f.write(hosts) }
|
41
|
+
|
42
|
+
sh("dscacheutil -flushcache")
|
metadata
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: desperado
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Sho Kusano
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-02-21 00:00:00.000000000 Z
|
13
|
+
dependencies: []
|
14
|
+
description: ! 'blocking sns
|
15
|
+
|
16
|
+
'
|
17
|
+
email: rosylilly@aduca.org
|
18
|
+
executables:
|
19
|
+
- desperado
|
20
|
+
extensions: []
|
21
|
+
extra_rdoc_files: []
|
22
|
+
files:
|
23
|
+
- README.md
|
24
|
+
- bin/desperado
|
25
|
+
homepage: http://github.com/rosylilly/desperado
|
26
|
+
licenses: []
|
27
|
+
post_install_message:
|
28
|
+
rdoc_options: []
|
29
|
+
require_paths:
|
30
|
+
- lib
|
31
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
32
|
+
none: false
|
33
|
+
requirements:
|
34
|
+
- - ! '>='
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '0'
|
37
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
38
|
+
none: false
|
39
|
+
requirements:
|
40
|
+
- - ! '>='
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '0'
|
43
|
+
requirements: []
|
44
|
+
rubyforge_project:
|
45
|
+
rubygems_version: 1.8.11
|
46
|
+
signing_key:
|
47
|
+
specification_version: 3
|
48
|
+
summary: focus your works
|
49
|
+
test_files: []
|
50
|
+
has_rdoc: false
|