ubuntu18.4 にtensolrflow 動かすためにしたこと

cudaとかcudnnとか。gpuに関係しているものだろうか。

 apt-get install cuda-9.0

wget http://developer.download.nvidia.com/compute/redist/cudnn/v7.0.5/cudnn-9.0-linux-x64-v7.tgz
tar xzf cudnn-9.0-linux-x64-v7.tgz
cp -a cuda/lib64/* /usr/local/lib/
cp -a cuda/include/* /usr/local/include/
ldconfig

askubuntu.com

qiita.com

Install TensorFlow on Ubuntu  |  TensorFlow

d.hatena.ne.jp

glibcをcentosにインストールしようとして苦戦した。

以下を行ってからバグった。確かめよう。

export LD_LIBRARY_PATH=/opt/glibc-2.14/lib

unix.stackexchange.com

gist.github.com

Index of /results/mosquito/myrepo-el6/epel-6-x86_64/glibc-2.17-55.fc20/

Index of /gnu/glibc

Mysql で特定id毎の上位ランキングを出す

以下は結構便利。

SELECT *
FROM Table1 t1
WHERE 2 >= (
    SELECT COUNT(*)
    FROM Table1 t2
    WHERE t1.category = t2.category
    AND t2.point >= t1.point
)
ORDER BY category,point desc
select id, category, point, name
from 
(
   select *,
      @rank := if (@category = category, @rank + 1, 1) as rank,
      @category := category as dummy_field
  from Table1, (select @rank := 0, @category := 0) as dummy_table
  order by category, point desc
) as t
where t.rank <= 2
order by category, point desc

teratail.com

models の CharField に regex の判定を追加

alphanumeric の RegexValidator で追加。

alphanumeric = RegexValidator(r'^[0-9a-zA-Z]*$', 'Only alphanumeric characters are allowed.')

name = models.CharField(max_length=50, blank=True, null=True, validators=[alphanumeric])
email = models.EmailField(max_length=50, unique=True, validators=[alphanumeric])

stackoverflow.com