Google analyticsで検索ワードを調べる
1. Google analyticsでGoogle search consoleを追加(DNSでTXTレコードを設定する必要あり)
2. Google analytics→レポート→ライブラリ→ライフサイクル→コレクションを編集、で「クエリ」を追加
Google analyticsでサイトへの流入元を調べる
セッションの参照元(Referral Traffic)を調べればいい
www.monsterinsights.com
ポーランドからのトラフィックが意味不明なほど増えていて、実体はnews.grets.storeというサイトのようである。実際にはそのサイトには接続できず(トップ画面のみ表示されて中身が無かった)、謎である。
Pythonスクリプトをデーモン化する
Discord Botをデーモン化したい。
手順
discord_daemon.pyとする。
- 以下のようなシェルスクリプトを作成。chmod a+xで実行権限を付加しておく。
discord_daemon.py
#!/bin/bash export DISCORD_TOKEN="YOUR DISCORD TOKEN" /usr/bin/python3 /home/shohei/app/discord_daemon.py
- /usr/local/binに上記シェルのエイリアスを貼る
$ ls -l /usr/local/bin/discord_daemon lrwxrwxrwx 1 root root 79 2月 11 13:55 /usr/local/bin/discord_daemon -> /home/shohei/app/discord_daemon.sh
- serviceファイルを追加。
/usr/lib/systemd/system/discord_daemon.service
[Unit] Description = Nakuja Discord Bot Daemon [Install] WantedBy = multi-user.target [Service] User=shohei WorkingDirectory=/home/shohei/ ExecStart = /usr/local/bin/discord_daemon Restart = always Type = simple RestartSec = 5
- デーモンを起動する
$ sudo systemctl start discord_daemon $ sudo systemctl status discord_daemon
起動していないときは以下を実行して原因を探る
$ sudo journalctl -u discord_daemon.service
CentOSにInfluxDBをインストール
Install InfluxDB OSS | InfluxDB OSS v1 Documentation
Troubleshoot systemd errors | InfluxDB OSS v1 Documentation
$ cat <<EOF | sudo tee /etc/yum.repos.d/influxdb.repo [influxdb] name = InfluxDB Repository - RHEL \$releasever baseurl = https://repos.influxdata.com/rhel/\$releasever/\$basearch/stable enabled = 1 gpgcheck = 1 gpgkey = https://repos.influxdata.com/influxdata-archive_compat.key EOF $ sudo yum install influxdb $ sudo service influxdb start $ influxd -config /etc/influxdb/influxdb.conf $ sudo chown -R influxdb:influxdb /var/lib/influxdb/* $ influxd -config /etc/influxdb/influxdb.conf
~/.bashrc
export INFLUXDB_CONFIG_PATH="/etc/influxdb/influxdb.conf"
HTTPのポートを開ける
sudo firewall-cmd --permanent --add-port=8086/tcp sudo firewall-cmd --reload
/etc/influxdb/influxdb.conf
[http] # Determines whether HTTP endpoint is enabled. enabled = true # Determines whether the Flux query endpoint is enabled. # flux-enabled = false # Determines whether the Flux query logging is enabled. # flux-log-enabled = false # The bind address used by the HTTP service. bind-address = ":8086" # Determines whether user authentication is enabled over HTTP/HTTPS. auth-enabled = false
sudo service influxdb restart
グラムシュミットの直交化
dora.bk.tsukuba.ac.jp
Matlabでの実装
clear; close all; a1 = [1 1 0]'; a2 = [0 -1 1]'; a3 = [1 1 1]'; e1 = a1/norm(a1) e2 = a2 - dot(a2,e1)*e1; e2 = e2/norm(e2) e3 = a3 - dot(a3,e1)*e1 - dot(a3,e2)*e2; e3 = e3/norm(e3) % dot(e1,e2) % dot(e1,e3) % dot(e2,e3) es = gram_schmidt([a1 a2 a3]); es function es = gram_schmidt(vectors) a1 = vectors(:,1); dim = size(vectors); m = dim(1); n = dim(2); as = zeros(m,n); es = zeros(m,n); e1 = a1/norm(a1); as(:,1) = a1; es(:,1) = e1; for idx=2:length(vectors) ai = vectors(:,idx); as(:,idx) = ai; ei = ai; for jdx = 1:idx ei = ei - dot(as(:,idx),es(:,jdx))*es(:,jdx); end ei = ei/norm(ei); es(:,idx) = ei; end end
実行結果
e1 = 0.7071 0.7071 0 e2 = 0.4082 -0.4082 0.8165 e3 = -0.5774 0.5774 0.5774 es = 0.7071 0.4082 -0.5774 0.7071 -0.4082 0.5774 0 0.8165 0.5774
DiscordのBotのテスト
Message content intentを有効にしておく必要がある
import discord import os intents = discord.Intents.default() intents.message_content = True client = discord.Client(intents=intents) @client.event async def on_ready(): print('We have logged in as {0.user}'.format(client)) @client.event async def on_message(message): if message.author == client.user: return if message.content.startswith('$hello'): await message.channel.send('Hello!') client.run(os.getenv('DISCORD_TOKEN'))