Skip to content

Instantly share code, notes, and snippets.

View songfei1983's full-sized avatar

songfei songfei1983

View GitHub Profile
@songfei1983
songfei1983 / tm
Created February 4, 2017 02:54
alias tm
alias tm="tmux -2 attach || tmux -2"
@songfei1983
songfei1983 / env.install
Last active February 2, 2017 08:32
install php & mysql & phpcs etc
46 brew install homebrew/php/php56
51 brew install homebrew/php/php56-mcrypt
170 brew install homebrew/php/php56-intl
180 brew install homebrew/php/php56-apcu
169 brew install icu4c
86 brew install mysql
114 brew install reattach-to-user-namespace
155 brew tap homebrew/services
@songfei1983
songfei1983 / tmux.conf
Last active February 27, 2017 02:40
my.tmux.conf
# rで設定読み込み
bind r source-file ~/.tmux.conf \; display "Config reloaded."
set-option -g default-shell /bin/zsh
set-option -g default-command "reattach-to-user-namespace -l zsh"
# ステータスバーをトップに配置する
# set-option -g status-position top
# ウィンドウ履歴の最大行数
@songfei1983
songfei1983 / Square.scala
Last active May 6, 2016 10:35
判断由参数中的四个点是否构成一个正方形。
package com.example
import scala.math._
object Square extends App {
case class Point(x: Int, y: Int)
implicit class CombinatorialList[A](l: List[A]) {
val xsize = l.size
def xcombinations(n: Int): List[List[A]] =
if (n > xsize) Nil
else l match {
trait A {
def foo = println("I am A." + super.toString)
}
trait B extends A {
override def foo = {
println("I am B." + super.toString)
super.foo
}
}
trait C extends A {
val add1: Int => Int = x => x + 1
val sq = (x: Int) => x * x
val add100 = (x: Int) => x + 100
foo map (add100 compose sq compose add1)
//res9: List[Int] = List(104, 109, 116, 125, 136)
//functionをリストにしたら、自由度高いじゃと思って!下記の方法を見つかった!
// https://bcomposes.wordpress.com/2011/08/20/fun-with-function-composition-in-scala/
@songfei1983
songfei1983 / file0.scala
Last active December 23, 2015 01:01
不等長リストの入れ替え ref: http://qiita.com/songfei1983/items/2a19b1772889e5231516
/*
List(
List(1,2,3,4),
List(5,6,7,8),
List(9,0)
)
List(
List(1,5,9),
List(2,6,0),
@songfei1983
songfei1983 / kafka.md
Last active December 22, 2015 14:13
homebrew安装Apache Kafka

Home brew安装Apache Kafka

gradle自行安装
MacBookAir上安装大概用了10分钟
brew install kafka
==> Installing kafka
==> Downloading http://mirrors.ibiblio.org/apache/kafka/0.8.2.1/kafka-0.8.2.1-src.tgz
######################################################################## 100.0%
==> gradle
==> gradle jar
@songfei1983
songfei1983 / file0.txt
Created August 30, 2015 00:28
メモ!Finderで隠しファイル・フォルダを表示 - Mac ref: http://qiita.com/songfei1983/items/84777346c65a1882cb7e
$ defaults write com.apple.finder AppleShowAllFiles TRUE
@songfei1983
songfei1983 / ls.txt
Last active August 29, 2015 14:28
lsでディレクトリのみ,ファイルのみ,表示する
// ディレクトリのみ
ls -F | grep /
// ファイルのみ
ls -F | grep -v /