Read Sean

Read me, read Sean.
posts - 508, comments - 655, trackbacks - 9, articles - 4

2012年11月15日

不知道从什么时候开始的,tsocks在Mac下面安装要费些周折,brew官方和曾经一度存在的第三方tap都不再支持直接brew install,需要手工创建formula。过程倒也还OK:

vim /usr/local/Library/Formula/tsocks.rb

require 'formula'

class Tsocks < Formula
  # The original is http://tsocks.sourceforge.net/
  # This GitHub repo is a maintained fork with OSX support

  homepage 'http://github.com/pc/tsocks'
  head 'https://github.com/pc/tsocks.git'

  depends_on 'autoconf' => :build if MacOS.xcode_version.to_f >= 4.3

  def install
    system "autoconf""-v"
    system "./configure""--prefix=#{prefix}""--disable-debug""--disable-dependency-tracking""--with-conf=#{config_file}"

    inreplace("tsocks") { |bin| bin.change_make_var! "LIBDIR", lib }

    system "make"
    system "make install"

    etc.install "tsocks.conf.simple.example" => "tsocks.conf" unless config_file.exist?
  end

  def test
    puts 'Your current public ip is:'
    ohai `curl -sS ifconfig.me 2>&1`.chomp
    puts "If your correctly configured #{config_file}, this should show the ip you have trough the proxy"
    puts 'Your ip through the proxy is:'
    ohai `tsocks curl -sS ifconfig.me 2>&1`.chomp
  end

  def config_file
    etc / 'tsocks.conf'
  end
end

有了上述formula之后,即可 brew install --HEAD tsocks 。

posted @ 2014-05-07 23:23 laogao 阅读(4025) | 评论 (2)编辑 收藏

有了RPi当然免不了要玩玩XBMC,这里推荐XBian,安装配置过程如下:

1- 下载.img文件 ( http://www.xbian.org/download/ );
2- 用dd命令将.img(比如XBian_beta_2.img)写入SD卡;
3- 将中文字体(比如wqy-zenhei.ttc)重命名为arial.ttf,复制到SD卡的~/.xbmc/media/Fonts目录(XBian默认用户为xbian,密码raspberry);
4- 从 https://code.google.com/p/xbmc-addons-chinese/downloads/detail?name=repository.googlecode.xbmc-addons-chinese-eden.zip 下载资源插件并复制到SD卡;
5- 将SD卡插入RPi并连接HDMI到电视机/显示器;
6- RPi开机,进入XBian的配置页面,可以校准屏幕,配置网络连接等;
7- 在系统设置中选择字体为Arial,语言选为中文,此时应该看到界面可正常显示中文;
8- 安装扩展程序,选择之前下载到SD卡的repository.googlecode.xbmc-addons-chinese-eden.zip文件,扩展安装成功后即可在扩展程序列表中看到对应的资源条目,逐一安装即可。

额外提示:XBMC也可以通过网络共享播放视频,之前跟大家提到过XBMC显示中文字幕有时出现整行被方块覆盖的问题,解决方法是在字幕文件中查找并删除或替换"…"字符。Enjoy!

posted @ 2014-04-06 17:45 laogao 阅读(2335) | 评论 (0)编辑 收藏


整理一下 IntelliJ IDEA 最常用的快捷键,按照便于记忆的方式排列:

Ctrl-N              Class... (find by name)
Ctrl-Shift-N        File... (find by name)
Ctrl-Shift-Alt-N    Symbol... (find by name)
Ctrl-G              Line... (goto line)
Ctrl-H              Type hierarchy (hierarchy)
Ctrl-Shift-H        Method hierarchy (hierarchy)
Ctrl-Alt-H          Call hierarchy (hierarchy)
Ctrl-Q              Quick documentation
Ctrl-Alt-I          Auto-indent lines (indent)
Ctrl-Alt-L          Reformat code (line up)
Ctrl-Alt-O          Optimize imports (optimize)
Ctrl-/              Comment with line comment (//)
Ctrl-Shift-/        Comment with block comment (/*...*/)
Ctrl-W              Select word or block (word)
Ctrl-D              Copy line (duplicate line, yyp)
Ctrl-X              Cut line (dd)
Ctrl-U              Uppercase/lowercase (upper)
Ctrl-J              Insert live template
Ctrl-Alt-J          Surround with live template
Ctrl-Alt-T          Surround with (template)
Ctrl-Shift-J        Join lines (join)
Ctrl-E              Recent files (editions)
Ctrl-Shift-E        Recently changed files (editions)
Alt-Shift-C         Recent changes (changes)
Ctrl-B              Delcaration
Ctrl-Shift-B        Type declaration
Ctrl-Alt-B          Implementation(s)
Ctrl-P              Parameter info (parameter)
Ctrl-Space          Basic completion
Ctrl-Shift-Space    Smart completion
Ctrl-Alt-Space      Completion lookup
Alt-Enter           Auto-complete
Alt-Insert          Generate...
Ctrl-Shift-Up/Down  Move statement up/down
Alt-Shift-Up/Down   Move line up/down
Ctrl-Up/Down        Scroll up/down
Alt-Up/Down         Previous/next method
F2                  Next highlighted error
Shift-F2            Previous highlighted error
Ctrl-F              Find
Ctrl-R              Replace
F3                  Next match
Shift-F3            Previous match
F4                  Jump to source
Ctrl-Alt-Shift-T    Refactor this
F5                  Refactor copy
F6                  Refactor move
Ctrl-F6             Refactor change signature
Shift-F6            Refactor rename
Alt-Delete          Refactor safe delete
Ctrl-Alt-V          Refactor extract variable
Ctrl-Alt-F          Refactor extract field
Ctrl-Alt-P          Refactor extract parameter
Ctrl-Alt-M          Refactor extract method
Ctrl-Alt-N          Refactor inline

posted @ 2014-03-09 13:38 laogao 阅读(12848) | 评论 (0)编辑 收藏

不久前入了个 Raspberry Pi 也就是大家说的树梅派(以下简称RPi),拿来做蓝牙测试,用的蓝牙dongle是ORICO的BTA-403-BL http://item.jd.com/980800.html 。这里简单记录下安装过程:

首先是操作系统。作为Arch重度用户,当然选Archlinux ARM了: http://archlinuxarm.org/platforms/armv6/raspberry-pi 下载img文件,用dd写到SD卡上:
dd bs=1M if=/path/to/archlinux-hf-*.img of=/dev/sdX

然后用GParted把SD卡上的分区拖满,充分利用空间。这样SD卡就准备好了,插到RPi上,接上Micro-USB的电源和网线,启动RPi,从路由器上找到RPi的IP地址(机器名默认是alarmpi),ssh上去(用户名root密码root),修改密码,创建非root账号,执行系统更新 sudo pacman -Syu ,这之后开始安装蓝牙相关工具:
sudo pacman -S bluez bluez-utils

确保蓝牙dongle插到RPi的USB接口,通过 hciconfig 确认蓝牙设备被识别,输出应该类似下面这个样子:
[sean@alarmpi]$ hciconfig
hci0:   Type: BR/EDR  Bus: USB
        BD Address: 84:A6:C8:DC:04:97  ACL MTU: 310:10  SCO MTU: 64:8
        DOWN 
        RX bytes:553 acl:0 sco:0 events:28 errors:0
        TX bytes:384 acl:0 sco:0 commands:27 errors:0

启动bluetooth:
sudo systemctl start bluetooth

完成以后,即可通过 bluetoothctl 命令打开蓝牙控制台,执行各项蓝牙相关操作,比如show、list、scan on、agent、info等等,这里不展开了。

如果想使用图形界面操作RPi,也很简单,基本步骤如下:
sudo pacman -S xorg xorg-xinit lxde
echo 'exec startlxde' > ~/.xinitrc
startx

Enjoy!

posted @ 2014-01-01 13:11 laogao 阅读(3440) | 评论 (1)编辑 收藏

第11页(练习):
在Scala REPL中键入3,然后按Tab键 应为 在Scala REPL中键入3.,然后按Tab键

第19页(正文):
util方法返回一个并不包含上限的区间 应为 until方法返回一个并不包含上限的区间

第19页(代码):
0 util s.length 应为 0 until s.length

第31页(正文):
util是RichInt类的方法 应为 until是RichInt类的方法

第34页(代码):
ArraryBuffer 应为 ArrayBuffer
b.sorted(_ < _) 应为 b.sorted
b.sorted(_ > _) 应为 b.sortWith(_ > _) 

第44页(代码):
scala.collections.immutable.SortedMap 应为 scala.collection.immutable.SortedMap

第53页(正文):
Scala对每个字端都提供getter和setter方法 应为 Scala对每个字段都提供getter和setter方法

第107页(代码):
val tokens = source.mkString.split("\\S+") 应为 val tokens = source.mkString.split("\\s+")

第341页(代码):
var count: (Int => Double) => null 应为 var count: (Int => Double) = null

// 本文仅作为信息发布窗口,如需讨论交流,请通过邮件 gaoyuxiang.scala@gmail.com 或 QQ群 132569382 。

posted @ 2012-11-15 15:56 laogao| 编辑 收藏