Bashの[ -e /home/... ]による確認

[ -e filepath ] Returns true if file exists.
[ -x filepath ] Returns true if file exists and executable.
[ -S filepath ] Returns true if file exists and its a socket file.
[ expr1 -a expr2 ] Returns true if both the expression is true.
[ expr1 -o expr2 ] Returns true if either of the expression1 or 2 is true.

www.thegeekstuff.com

qiita.com

Pythonのコードの計測について(line-profiler)

@profile
def fizzbuzz(n):
    if n % 3 == 0 and n % 5 == 0:
        return 'FizzBuzz'
$ kernprof -l fizzbuzz.py
1
2
Fizz
...(省略)...
97
98
Fizz
Wrote profile results to fizzbuzz.py.lprof
$ python -m line_profiler fizzbuzz.py.lprof
Timer unit: 1e-06 s

Total time: 0.000275 s
File: fizzbuzz.py
Function: fizzbuzz at line 5

Line #      Hits         Time  Per Hit   % Time  Line Contents
==============================================================
     5                                           @profile
     6                                           def fizzbuzz(n):
     7        99          116      1.2     42.2      if n % 3 == 0 and n % 5 == 0:



blog.amedama.jp

その他の profile 手法がまとめてあった

qiita.com

Solrのf.<field>.facet.<param>のvalue指定

f.<field>.facet.<param>value指定させる場合、以下の{terms=...,...}を指定すればいい。

curl http://localhost:8983/solr/testurltext/select?indent=on&q=*:*&wt=json&facet=true&facet.field={!terms=value1,value2}category1_name&rows=0

Faceting | Apache Solr Reference Guide 6.6

Gitでブランチ切って作業して、マージする。

git flowのルールにそって 作業しない場合に

$ git branch
* master

# ブランチカット
$ git checkout -b feature-create-api
feature-create-api

$ git add .
$ git commit -am "commit message!"
$ git push -u origin feature-create-api

$ git checkout master
$ git merge --no-ff feature-create-api

qiita.com