農家SEの覚書き

忘れっぽいので、自分用の備忘録です。

Windowsのキーボード ショートカット

良く使うもの

Windows ロゴ キー + e

エクスプローラーを開く。

Windows ロゴ キー + m

すべてのウィンドウを最小化する。

Windows ロゴ キー + shift + m

最小化されたウィンドウをデスクトップに復元する。

最近知ったもの

Windows ロゴ キー + shift + s

画面の一部のスクリーン ショットを撮影します。

※エリア指定で画像のキャプチャがすぐ取れるので便利

Windows ロゴ キー + .ピリオド(もしくは ; セミコロン)

絵文字パネルを開く。

マイクロソフトのページ

support.microsoft.com

PostgreSQLのリンク

■日本PostgreSQLユーザー会

https://www.postgresql.jp/

■pgAdmin

PostgreSQLの管理ツールです。 pdAdmin3を利用していたけれど、最新版のpgAdmin4に乗換。 pgAdmin4からブラウザベースに変更になりました。 https://www.pgadmin.org/

■PGTune

PostgresSQLの設定値をサーバのスペックなどを入力すると 教えてくれるサイト

https://pgtune.leopard.in.ua/#/

Googleのサイト翻訳機能

Google 翻訳でWEBサイトまるごと翻訳できる機能が 普通に利用できることを知らなかったのでメモ。

Google 翻訳

f:id:pkpenguin:20211027111057p:plain

例えばヤフーを翻訳するときは左側にURLを入力 https://www.yahoo.com/

右側に翻訳結果が表示されるので(翻訳されていないけど) 赤枠のリンクをクリック

f:id:pkpenguin:20211027111524p:plain

ヘッダにある切替を「英語」→「日本語」に変更

f:id:pkpenguin:20211027111817p:plain

英語版Yahooを日本語表示

Yahoo | Mail, Weather, Search, Politics, News, Finance, Sports & Videos

Yahoo Japanを英語表示

Yahoo! JAPAN

流石に画像の文字は翻訳されないですね。

今週のお題「爆発」

今週のお題「爆発」

電子レンジで温めてはいけない物

卵、ウィンナー、飲み物

卵が爆発したときに、電子レンジの中が汚れてしまい 綺麗に掃除が出来ていなかったようで妻の怒りも大爆発!

CentOS7にmuninノードのインストール(apache監視)

EPELのリポジトリを追加

yum install -y epel-release

EPELのリポジトリは通常時は利用しないように無効化

yum-config-manager --disable epel

EPELのリポジトリから muninノードをインストール

yum --enablerepo=epel install munin-node

apacheサーバ監視の為、設定ファイルを追加

vi etc/httpd/conf.d/status.conf

↓以下をコピーして保存

# 拡張ステータスの有効化
ExtendedStatus On
<Location /server-status>
  # server-statusハンドラーの有効化
  SetHandler server-status
  # アクセス制御
  Require ip 127.0.0.1
</Location>

apacheの設定をロード

systemctl reload httpd

apache監視用のプラグインを追加

cd /etc/munin/plugins
ln -s /usr/share/munin/plugins/apache_accesses
ln -s /usr/share/munin/plugins/apache_processes
ln -s /usr/share/munin/plugins/apache_volume

munin(親)のIPを許可

vi /etc/munin/munin-node.conf

# A list of addresses that are allowed to connect.  This must be a
# regular expression, since Net::Server does not understand CIDR-style
# network notation unless the perl module Net::CIDR is installed.  You
# may repeat the allow line as many times as you'd like

allow ^127\.0\.0\.1$
allow ^192\.168\.1\.10$ # ←ここにIPを追加
allow ^::1$

munin-nodeの起動と自動起動設定

systemctl start munin-node
systemctl enable munin-node

GAS(Google Apps Script)からのクロール拒否

ユーザーエージェントがMozilla/5.0 (compatible; Google-Apps-Script)からのアクセス数が急増。 原因を調べたら欠品中の在庫を定期的に調べているみたい。

.htaccess に以下を追加しアクセス禁止(403-Forbidden)に設定

RewriteEngine On

# User Agent でアクセス拒否
SetEnvIfNoCase User-Agent "Google-Apps-Script" ua_key=on
RewriteCond %{ENV:ua_key} on
RewriteRule ^(.*)$ - [F,L]

GASってクローラー代わりに使えるようですね。 しかもアクセス元が複数ありました。

Google Apps ScriptのIP調査(拒否設定の為)

参考にさせて頂いたページ

GoogleAppsScript(GAS)のIPアドレス範囲を調べる

# nslookup -q=TXT _cloud-netblocks.googleusercontent.com 8.8.8.8
Server:         8.8.8.8
Address:        8.8.8.8#53

Non-authoritative answer:
_cloud-netblocks.googleusercontent.com  text = "v=spf1 include:_cloud-netblocks1.googleusercontent.com include:_cloud-netblocks2.googleusercontent.com include:_cloud-netblocks3.googleusercontent.com include:_cloud-netblocks4.googleusercontent.com include:_cloud-netblocks5.googleusercontent.com ?all"

Authoritative answers can be found from:

include:cloud-netblocks1.googleusercontent.com include:cloud-netblocks2.googleusercontent.com include:cloud-netblocks3.googleusercontent.com include:cloud-netblocks4.googleusercontent.com include:_cloud-netblocks5.googleusercontent.com

# nslookup -q=TXT _cloud-netblocks1.googleusercontent.com 8.8.8.8
Server:         8.8.8.8
Address:        8.8.8.8#53

Non-authoritative answer:
_cloud-netblocks1.googleusercontent.com text = "v=spf1 include:_cloud-netblocks6.googleusercontent.com include:_cloud-netblocks7.googleusercontent.com ip6:2600:1900::/35 ip4:8.34.208.0/20 ip4:8.35.192.0/21 ip4:8.35.200.0/23 ip4:23.236.48.0/20 ip4:23.251.128.0/19 ip4:34.64.0.0/11 ip4:34.96.0.0/14 ?all"

Authoritative answers can be found from:

1~5(6~7)について繰り返し、アドレスの範囲がわかってのWAFの拒否設定に追加

34.100.0.0/16
34.102.0.0/15
34.104.0.0/14
34.124.0.0/18
34.124.64.0/20
34.124.80.0/23
34.124.84.0/22
34.124.88.0/23
34.124.92.0/22
34.125.0.0/16
35.184.0.0/14
35.188.0.0/15
35.190.0.0/17
34.100.0.0/16
34.102.0.0/15
34.104.0.0/14
34.124.0.0/18
34.124.64.0/20
34.124.80.0/23
34.124.84.0/22
34.124.88.0/23
34.124.92.0/22
34.125.0.0/16
35.184.0.0/14
35.188.0.0/15
35.190.0.0/17
35.190.128.0/18
35.190.192.0/19
35.190.224.0/20
35.190.240.0/22
35.192.0.0/14
35.196.0.0/15
35.198.0.0/16
35.199.0.0/17
35.199.128.0/18
35.200.0.0/13
35.208.0.0/13
35.216.0.0/15
35.219.192.0/24
35.220.0.0/14
35.224.0.0/13
35.232.0.0/15
35.234.0.0/16
35.235.0.0/17
35.235.192.0/20
35.235.216.0/21
35.235.224.0/20
35.236.0.0/14
35.240.0.0/13
104.154.0.0/15
104.196.0.0/14
107.167.160.0/19
107.178.192.0/18
108.59.80.0/20
108.170.192.0/20
108.170.208.0/21
108.170.216.0/22
108.170.220.0/23
108.170.222.0/24
130.211.4.0/22
130.211.8.0/21
130.211.16.0/20
130.211.32.0/19
130.211.64.0/18
130.211.128.0/17
146.148.2.0/23
146.148.4.0/22
146.148.8.0/21
146.148.16.0/20
146.148.32.0/19
146.148.64.0/18
162.216.148.0/22
162.222.176.0/21
173.255.112.0/20
192.158.28.0/22
199.192.112.0/22
199.223.232.0/22
199.223.236.0/23
208.68.108.0/23

アップロードは成功しましたが、タイムスタンプの更新に失敗しました。

WinSCPでファイルをアップロードしたところ、以下のエラーが発生。

f:id:pkpenguin:20210616083548p:plain

ファイルは更新されているので問題はないけど 気持ちが悪いのでWinSCPの設定を変更。

メニューの「オプション」から「環境設定」をクリック。

f:id:pkpenguin:20210616083911p:plain

ツリーから「転送」を選択し、転送設定のプリセットで「デフォルト」を選んだ状態で 「編集」ボタンをクリック。

f:id:pkpenguin:20210616084017p:plain

共通設定の「タイムスタンプを保存する」のチェックを外し、「OK」ボタンをクリック。

f:id:pkpenguin:20210616084233p:plain

以上で設定完了。

ファイルの作成者とアップロードするユーザーが異なっている場合に 発生するみたい。