202205

shell scriptのあたまにこれはかいておけ

set -euo pipefail
set -o pipefail
set -o nounset
set -o errexit

おもしろ近似式

spectralでOpenAPIをlintする

    name: Run Spectral on Pull Requests
    on:
      - pull_request
    jobs:
      build:
        name: Run Spectral
        runs-on: ubuntu-latest
        steps:
          # Check out the repository
          - uses: actions/checkout@v2
          # Run Spectral
          - uses: stoplightio/spectral-action@v0.8.1
            with:
              file_glob: 'apispec/*.yml'
的な感じでworkflowを書くだけでいける. `.spectral.json` は多分別途用意する必要がある.

DB backup

  • 基本dump commandを使うのが楽そう.
  • scpとかで別hostに退避しておくとか.
#!/bin/sh

sudo -u postgres pg_dumpall > ${DB_DUMP_FILE_PATH}
scp -i ~/.ssh/id_rsa ${DB_DUMP_FILE_PATH} ${BACKUP_USER}@${BACKUP_SERVER}:${BACKUP_ROOT}/backup/
rm -rf ${DB_DUMP_FILE_PATH}

nfs mount

jp7fkf@docker01:~$ sudo mount x.x.x.x:/ /mnt/nas
mount: /mnt/nas: bad option; for several filesystems (e.g. nfs, cifs) you might need a /sbin/mount.<type> helper program.

jp7fkf@docker01:~$ sudo mount -t nfs x.x.x.x:/ /mnt/nas
mount: /mnt/nas: bad option; for several filesystems (e.g. nfs, cifs) you might need a /sbin/mount.<type> helper program.

jp7fkf@docker01:~$ sudo apt install nfs-common
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  keyutils libnfsidmap2 libtirpc1 rpcbind
Suggested packages:
  watchdog
The following NEW packages will be installed:
  keyutils libnfsidmap2 libtirpc1 nfs-common rpcbind
0 upgraded, 5 newly installed, 0 to remove and 54 not upgraded.
Need to get 399 kB of archives.
After this operation, 1,364 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 keyutils amd64 1.5.9-9.2ubuntu2.1 [48.1 kB]
Get:2 http://archive.ubuntu.com/ubuntu bionic/main amd64 libnfsidmap2 amd64 0.25-5.1 [27.2 kB]
Get:3 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libtirpc1 amd64 0.2.5-1.2ubuntu0.1 [75.7 kB]
Get:4 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 rpcbind amd64 0.2.3-0.6ubuntu0.18.04.4 [42.1 kB]
Get:5 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 nfs-common amd64 1:1.3.4-2.1ubuntu5.5 [206 kB]
Fetched 399 kB in 2s (176 kB/s)
Selecting previously unselected package keyutils.
(Reading database ... 140202 files and directories currently installed.)
Preparing to unpack .../keyutils_1.5.9-9.2ubuntu2.1_amd64.deb ...
Unpacking keyutils (1.5.9-9.2ubuntu2.1) ...
Selecting previously unselected package libnfsidmap2:amd64.
Preparing to unpack .../libnfsidmap2_0.25-5.1_amd64.deb ...
Unpacking libnfsidmap2:amd64 (0.25-5.1) ...
Selecting previously unselected package libtirpc1:amd64.
Preparing to unpack .../libtirpc1_0.2.5-1.2ubuntu0.1_amd64.deb ...
Unpacking libtirpc1:amd64 (0.2.5-1.2ubuntu0.1) ...
Selecting previously unselected package rpcbind.
Preparing to unpack .../rpcbind_0.2.3-0.6ubuntu0.18.04.4_amd64.deb ...
Unpacking rpcbind (0.2.3-0.6ubuntu0.18.04.4) ...
Selecting previously unselected package nfs-common.
Preparing to unpack .../nfs-common_1%3a1.3.4-2.1ubuntu5.5_amd64.deb ...
Unpacking nfs-common (1:1.3.4-2.1ubuntu5.5) ...
Setting up libnfsidmap2:amd64 (0.25-5.1) ...
Setting up keyutils (1.5.9-9.2ubuntu2.1) ...
Setting up libtirpc1:amd64 (0.2.5-1.2ubuntu0.1) ...
Setting up rpcbind (0.2.3-0.6ubuntu0.18.04.4) ...
Created symlink /etc/systemd/system/multi-user.target.wants/rpcbind.service → /lib/systemd/system/rpcbind.service.
Created symlink /etc/systemd/system/sockets.target.wants/rpcbind.socket → /lib/systemd/system/rpcbind.socket.
Setting up nfs-common (1:1.3.4-2.1ubuntu5.5) ...

Creating config file /etc/idmapd.conf with new version
Adding system user `statd' (UID 111) ...
Adding new user `statd' (UID 111) with group `nogroup' ...
Not creating home directory `/var/lib/nfs'.
Created symlink /etc/systemd/system/multi-user.target.wants/nfs-client.target → /lib/systemd/system/nfs-client.target.
Created symlink /etc/systemd/system/remote-fs.target.wants/nfs-client.target → /lib/systemd/system/nfs-client.target.
nfs-utils.service is a disabled or a static unit, not starting it.
Processing triggers for systemd (237-3ubuntu10.50) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for ureadahead (0.100.0-21) ...
Processing triggers for libc-bin (2.27-3ubuntu1.5) ...

jp7fkf@docker01:~$ which mount.nfs
/sbin/mount.nfs

jp7fkf@docker01:~$ sudo mount x.x.x.x:/ /mnt/nas
mount.nfs: access denied by server while mounting x.x.x.x:/

jp7fkf@docker01:~$ sudo mount -t nfs x.x.x.x:/hogehoge /mnt/nas/
jp7fkf@docker01:~$ sudo umount /mnt/nas/

ghostscriptでpdf sizeをreduceする

  • gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf

Scrum master memo

  • フィードバックが大事なのでちゃんとフィードバックしよう.
    • 気に入った/気に入らないでも質問でもフィードバック
  • タイムボックスを守る
    • 時間内におわらせる
    • 早いならok
  • バックログの項目は"一列"に並べる(キモ)
  • バックログの項目は具体的にする
  • デイリーはお昼前がおすすめ.朝一はやめたほうがいい.
  • レトロスペクティブの方法はいっぱいあるので手持ちにしておくとよい.
  • どういうフィードバックを得たい?
  • ステークホルダは具体的な人(xxさん)
  • インパクトのあるところからつくる