Skip to content

Instantly share code, notes, and snippets.

1、安装arcanist,clone源代码到安装目录somewhere/,arcanist依赖于libphutil,所以两个都要clone
somewhere/ git clone git://github.com/facebook/arcanist.git
somewhere/ git clone git://github.com/facebook/libphutil.git
2、配置arc,将arc加入到PATH,或在/usr/sbin里面建一个到arc的软链接
export PATH=$PATH:/somewhere/arcanist/bin/
或者:cd /usr/sbin; ln -sf /somewhere/arcanist/bin/arc
* 在系统的~/.bashrc或~/.bash_profile中加上该export语句。
* 运行命令"arc help",来检测安装是否成功。
3、配置arc的编辑器,不然会报错,提示EDITOR环境变量没配置
arc set-config editor "vim"
sql-migrate工具
工具:sql-migrate
https://github.com/rubenv/sql-migrate
模板:mysql代码库from公司
http://git.yottabyte.cn/summary/mysql.git
Available commands are:
down Undo a database migration(只恢复一个)
redo Reapply the last migration
status Show migration status
xargs
问题:在管道命令 | 后面加不加xargs有什么区别?
区别:
管道是实现“将前面的标准输出作为后面的标准输入”
xargs是实现“将标准输入作为命令的参数”
例如,
echo "--help"|cat, 相当于 cat "--help", --help作为cat的标准输入流(STDIN)
echo "--help"|xargs cat 相当于 cat --help , --help作为cat的参数
@zhaohangbo
zhaohangbo / Java Serializable Object to Byte Array
Created September 23, 2016 13:12
Java Serializable Object to Byte Array
http://stackoverflow.com/questions/2836646/java-serializable-object-to-byte-array
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ObjectOutputStream out = null;
try {
out = new ObjectOutputStream(bos);
out.writeObject(yourObject);
out.flush();
byte[] yourBytes = bos.toByteArray();
...
@zhaohangbo
zhaohangbo / 换行符 \r, \n, \r\n
Created September 24, 2016 05:37
换行符 \r, \n, \r\n
\r = CR (Carriage Return) // Used as a new line character in Mac OS before X
\n = LF (Line Feed) // Used as a new line character in Unix/Mac OS X
\r\n = CR + LF // Used as a new line character in Windows
So,
String lines[] = String.split("\\r?\\n");
@zhaohangbo
zhaohangbo / NullNotNone.scala
Created November 21, 2016 04:31
Use Option(x) instead of Some(x) to avoid Some(null)
object NullNotNone {
def main(args: Array[String]) {
test_func match {
case None => println("null is not none")
case Some(x) => println("so easy to be wrong")
}
}
def test_func: Option[java.lang.Double] = Some(null)
}
@zhaohangbo
zhaohangbo / Google Tips
Created November 21, 2016 06:30
Google搜索技巧
1、双引号 “”
完全匹配搜索,返回的结果包含双引号中出现的所有的词,连顺序也必须完全匹配。
例如搜索: “seo方法图片”
2、减号 -
减号代表搜索不包含减号后面的词的页面。使用这个指令时减号前面必须是空格,减号后面没有空格,紧跟着需要排除的词。Google 和bd都支持这个指令。
例如:搜索 -引擎
返回的则是包含“搜索”这个词,却不包含“引擎”这个词的结果
@zhaohangbo
zhaohangbo / Java转成Scala
Last active November 30, 2016 09:46
Java转成Scala
Java代码转换成Scala,常见的一些转换
转换:
SomeType.class ==> classOf[SomeType]
Class<?> ==> def read[UnknowType](classes: Set[Class[UnknowType]])
https://stackoverflow.com/questions/1135248/scala-equivalent-of-java-java-lang-classt-object
Java代码:
public Swagger read(Set<Class<?>> classes) {
@zhaohangbo
zhaohangbo / SSH的public_key和private_key
Created December 2, 2016 06:53
SSH的public_key和private_key
SSH的public_key和private_key
1、private_key [on your own PC]
Stored on the computer you log in from
2、public_key [on other PCs]
Stored on the .ssh/authorized_keys file on all the computers you want to log in to.
How it works ?
When you log in to a computer,
@zhaohangbo
zhaohangbo / Mac使用机械键盘和改键工具
Created December 27, 2016 03:17
Mac使用机械键盘和改键工具
改键工具:Karabiner
https://pqrs.org/osx/karabiner/
改键博客:
http://tieba.baidu.com/p/3489459090
http://www.jianshu.com/p/d8e59d432214