<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>case2111 (chen)</title>
    <link>https://ruby-china.org/case2111</link>
    <description></description>
    <language>en-us</language>
    <item>
      <title>Ruby China 的 gems 又抽风了</title>
      <description>&lt;p&gt;gem install backup
ERROR:  While executing gem ... (Gem::RemoteFetcher::FetchError)
    bad response Forbidden 403 (&lt;a href="https://gems-ruby-china.b0.upaiyun.com/quick/Marshal.4.8/fog-riakcs-0.1.0.gemspec.rz" rel="nofollow" target="_blank"&gt;https://gems-ruby-china.b0.upaiyun.com/quick/Marshal.4.8/fog-riakcs-0.1.0.gemspec.rz&lt;/a&gt;)&lt;/p&gt;</description>
      <author>case2111</author>
      <pubDate>Tue, 11 Apr 2017 18:42:59 +0800</pubDate>
      <link>https://ruby-china.org/topics/32750</link>
      <guid>https://ruby-china.org/topics/32750</guid>
    </item>
    <item>
      <title>36 氪挂啦</title>
      <description>&lt;p&gt;今天发现 36 氪好几个栏目都访问不了了&lt;/p&gt;</description>
      <author>case2111</author>
      <pubDate>Tue, 03 Jan 2017 11:37:15 +0800</pubDate>
      <link>https://ruby-china.org/topics/32044</link>
      <guid>https://ruby-china.org/topics/32044</guid>
    </item>
    <item>
      <title>好用的发送桌面 notify 的小工具</title>
      <description>&lt;p&gt;今天发现 ubuntu 下面有个好用方便的发 notify 的小工具 notify-send&lt;/p&gt;
&lt;h3 id="DISPLAY=:0.0 notify-send    -t 3000 "&gt;DISPLAY=:0.0 notify-send    -t 3000 "休息" "休息一下"&lt;/h3&gt;
&lt;p&gt;显示图片：
&lt;img src="https://l.ruby-china.com/photo/2016/8bb5b8b008c1d3e7febe4f9db6dc6146.png" title="" alt=""&gt;&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;以后写到crontab里面定期提醒，休息，喝水

 notify-send --help
Usage:
  notify-send [OPTION...] &amp;lt;SUMMARY&amp;gt; [BODY] - create a notification

Help Options:
  -?, --help                        Show help options

Application Options:
  -u, --urgency=LEVEL               Specifies the urgency level (low, normal, critical).
  -t, --expire-time=TIME            Specifies the timeout in milliseconds at which to expire the notification.
  -a, --app-name=APP_NAME           Specifies the app name for the icon
  -i, --icon=ICON[,ICON...]         Specifies an icon filename or stock icon to display.
  -c, --category=TYPE[,TYPE...]     Specifies the notification category.
  -h, --hint=TYPE:NAME:VALUE        Specifies basic extra data to pass. Valid types are int, double, string and byte.
  -v, --version                     Version of the package. 
&lt;/code&gt;&lt;/pre&gt;</description>
      <author>case2111</author>
      <pubDate>Tue, 12 Apr 2016 17:03:19 +0800</pubDate>
      <link>https://ruby-china.org/topics/29679</link>
      <guid>https://ruby-china.org/topics/29679</guid>
    </item>
    <item>
      <title>Rails 里的所有 rake task 查看方法</title>
      <description>&lt;h4 id="以前总是困惑于rails项目中到底有多少rake task 方法，直到今天看到了 -T 参数一下子解惑啦"&gt;以前总是困惑于 rails 项目中到底有多少 rake task 方法，直到今天看到了 -T 参数一下子解惑啦&lt;/h4&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;debian:practice$ rake -T
rake about                              # List versions of all Rails frameworks and the environment
rake assets:clean[keep]                 # Remove old compiled assets
rake assets:clobber                     # Remove compiled assets
rake assets:environment                 # Load asset compile environment
rake assets:precompile                  # Compile all the assets named in config.assets.precompile
rake cache_digests:dependencies         # Lookup first-level dependencies for TEMPLATE (like messages/show or comments/_comment.html)
rake cache_digests:nested_dependencies  # Lookup nested dependencies for TEMPLATE (like messages/show or comments/_comment.html)
rake db:create                          # Creates the database from DATABASE_URL or config/database.yml for the current RAILS_ENV (use db:create:all to create all database...
rake db:drop                            # Drops the database from DATABASE_URL or config/database.yml for the current RAILS_ENV (use db:drop:all to drop all databases in t...
rake db:fixtures:load                   # Load fixtures into the current environment's database
rake db:migrate                         # Migrate the database (options: VERSION=x, VERBOSE=false, SCOPE=blog)
rake db:migrate:status                  # Display status of migrations
rake db:rollback                        # Rolls the schema back to the previous version (specify steps w/ STEP=n)
rake db:schema:cache:clear              # Clear a db/schema_cache.dump file
rake db:schema:cache:dump               # Create a db/schema_cache.dump file
rake db:schema:dump                     # Create a db/schema.rb file that is portable against any DB supported by AR
rake db:schema:load                     # Load a schema.rb file into the database
rake db:seed                            # Load the seed data from db/seeds.rb
rake db:setup                           # Create the database, load the schema, and initialize with the seed data (use db:reset to also drop the database first)
rake db:structure:dump                  # Dump the database structure to db/structure.sql
rake db:structure:load                  # Recreate the databases from the structure.sql file
rake db:version                         # Retrieves the current schema version number
rake doc:app                            # Generate docs for the app -- also available doc:rails, doc:guides (options: TEMPLATE=/rdoc-template.rb, TITLE="Custom Title")
rake log:clear                          # Truncates all *.log files in log/ to zero bytes (specify which logs with LOGS=test,development)
rake middleware                         # Prints out your Rack middleware stack
rake notes                              # Enumerate all annotations (use notes:optimize, :fixme, :todo for focus)
rake notes:custom                       # Enumerate a custom annotation, specify with ANNOTATION=CUSTOM
rake rails:template                     # Applies the template supplied by LOCATION=(/path/to/template) or URL
rake rails:update                       # Update configs and some other initially generated files (or use just update:configs or update:bin)
rake routes                             # Print out all defined routes in match order, with names
rake secret                             # Generate a cryptographically secure secret key (this is typically used to generate a secret for cookie sessions)
rake stats                              # Report code statistics (KLOCs, etc) from the application or engine
rake test                               # Runs all tests in test folder
rake test:all                           # Run tests quickly by merging all types and not resetting db
rake test:all:db                        # Run tests quickly, but also reset db
rake test:db                            # Run tests quickly, but also reset db
rake time:zones:all                     # Displays all time zones, also available: time:zones:us, time:zones:local -- filter with OFFSET parameter, e.g., OFFSET=-6
rake tmp:clear                          # Clear session, cache, and socket files from tmp/ (narrow w/ tmp:sessions:clear, tmp:cache:clear, tmp:sockets:clear)
rake tmp:create                         # Creates tmp directories for sessions, cache, sockets, and pids
&lt;/code&gt;&lt;/pre&gt;</description>
      <author>case2111</author>
      <pubDate>Fri, 01 Apr 2016 11:47:20 +0800</pubDate>
      <link>https://ruby-china.org/topics/29525</link>
      <guid>https://ruby-china.org/topics/29525</guid>
    </item>
    <item>
      <title>墙外的世界，突破公司和 GFW 防火墙的封锁</title>
      <description>&lt;p&gt;首先鄙视一些公司，设置严格的防火墙策略，严重影响工作效率，本来就在 gfw 的封锁之下，再加上一层防火墙，整个思想就被囚禁了，那还有创新的灵感，思想都没法交流了，如果自己在不争取真的就成码奴了。
在 ruby 的世界里没有网络真是寸步难行
准备工作：
一台可以自由访问网络的 vps，并开启 ssh 服务
用 nmap 扫描公司的开放的端口，用来设置 obfstunnel 的 server 端的监听端口
一台可以用装 linux 虚拟机的本地 pc
所需要的软件 obfstunnel，ssh，privoxy 
privoxy 下载地址：&lt;a href="http://sourceforge.net/projects/ijbswa/?source=typ_redirect" rel="nofollow" target="_blank"&gt;http://sourceforge.net/projects/ijbswa/?source=typ_redirect&lt;/a&gt;
obfstunnel 下载地址：&lt;a href="https://github.com/greensea/obfstunnel" rel="nofollow" target="_blank"&gt;https://github.com/greensea/obfstunnel&lt;/a&gt;
ssh 用 linux 自带的包管理工具自行安装或下载源代码编译安装
obfstunnel
一。架设 obfstunnel
   1.obfstunnel 用处
       obfstunnel 可以通过端口转发的方式将数据包进行混淆处理，以绕过防火墙。目前支持的方法有 xor 和 random。
    obfstunnel 需要运行在客户端和服务器两边。假设客户端和服务器之间有一个防火墙，
    用户可以在客户端处以 CLIENT 模式运行 obfstunnel，同时在服务器端以 SERVER 模式运行 obfstunnel。
    以 CLIENT 模式运行的 obfstunnel 需要知道服务器端 obfstunnel 监听的端口。
    以 SERVER 模式运行的 obfstunnel 需要知道远程主机的地址以及想要连接到的端口。
    obfstunnel 会把用户发送的数据转发到远程主机上。&lt;/p&gt;

&lt;p&gt;简单的说 obfstunnel 可以躲过防火墙的对某些网络协议的封锁。
    可以从&lt;a href="https://github.com/greensea/obfstunnel" rel="nofollow" target="_blank"&gt;https://github.com/greensea/obfstunnel&lt;/a&gt;  获取 obfstunnel 及详细的使用说明。
 2.架设 obfstunel
   在我们 vps 上运行 obfstunel 的 server 端，
   运行命令：obfstunnel -s 8080 -t localhost:22 -m xor
   参数解释：
   -s 以 server 模式运行，8080 为 server 要监听的端口号，
   -t 后面跟转发的目标地址和端口号，也就是从 8080 端口来的数据都会 forward 到 localhost:8080
   -m 是数据混淆的模式
   运行上面的命令就可以把 server 端其起来了&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;启动 client 端
在本地运行 client 端
命令：obfstunnel -c 8091 -t serverip:8080 -m xor
参数解释：
-c 以 client 的模式运行
把本地端口的数据转发的 remote 端的 serverip:8080 上
二。启动 ssh 端口转发
如果 obfstunel 的 server 端和 client 端的都架设成功，
在本地运行是 ssh 登录命令：ssh user@localhost -p 8091 .就可以登录上远程服务器了，
如果登录失败重新检查 obfstunel 的架设是否正确。

&lt;ol&gt;
&lt;li&gt;开启本地 ssh 端口转发
运行命令：ssh -qTfnNg -D 7070 localhost -p 8091
就可以开启端口转发服务，如果成功开启就可以在浏览器中设置 socket5 的代理。
在浏览器中添加 socket5 代理，server：127.0.0.1 port：7070
设置完成之后浏览器能打开 google 说明 ssh 的端口转发已经成功。
在完成以上步骤之后 pc 通过 socket5 的带来已经能够实现翻墙，但是移动设备还是没法通过 socket5 代理上网。
下一步我们要把 socket5 的代理映射成标准的 http 代理
三。安装 privoxy 代理服务器
可以从&lt;a href="http://sourceforge.net/projects/ijbswa/?source=typ_redirect" rel="nofollow" target="_blank"&gt;http://sourceforge.net/projects/ijbswa/?source=typ_redirect&lt;/a&gt; 获取 privoxy 的代码
按照代码里面的 INSTALL 文档说明编译并安装 privoxy
配置 privoxy
1.修改软件的配置文件，找到找到 listen-address 这一行修改为
listen-address yourself_ip:8118
2.找到“forward-socks5”这一行，去掉前面的注释标记#，将这一行修改为
forward-socks5t / 127.0.0.1:7070 .
四。总结
所有都配置完之后，设置浏览器里面的代理设置，server 为 privoxy 中的 yourself_ip, 端口号为 8118
在 ipad，iphone 中的代理设置的参数和浏览器中的参数一样，
通过此种方式翻墙可以突破 GFW 的防火墙的封锁，更能突破公司防火墙的封锁，利用 obfstunnel 用处
obfstunnel 可以通过端口转发的方式将数据包进行混淆处理，以绕过防火墙。目前支持的方法有 xor 和 random。
obfstunnel 需要运行在客户端和服务器两边。假设客户端和服务器之间有一个防火墙，
用户可以在客户端处以 CLIENT 模式运行 obfstunnel，同时在服务器端以 SERVER 模式运行 obfstunnel。
以 CLIENT 模式运行的 obfstunnel 需要知道服务器端 obfstunnel 监听的端口。
以 SERVER 模式运行的 obfstunnel 需要知道远程主机的地址以及想要连接到的端口。
obfstunnel 会把用户发送的数据转发到远程主机上。
如果发现什么问题欢迎指出&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ol&gt;</description>
      <author>case2111</author>
      <pubDate>Mon, 26 Jan 2015 20:35:47 +0800</pubDate>
      <link>https://ruby-china.org/topics/23953</link>
      <guid>https://ruby-china.org/topics/23953</guid>
    </item>
  </channel>
</rss>
