2020年2月29日土曜日

Gpg で ASCII 形式で分離署名

以下を実行するだけで file.asc が出来る (出力を file.asc にリダイレクトする必要なし)

gpg --detach-sign --armor file

2020年2月25日火曜日

Ansible で apt update, full-upgrade, install

- hosts: localhost
  tasks:
    - apt:
        update_cache: yes
    - apt:
        update_cache: no
        upgrade: full
        # full-upgrade 後、システム再起動
    - apt:
        update_cache: no
        state: present
        pkg:
          - vim
          - byobu

Ansible をローカルで実行するサンプル

palybook.yaml:

- hosts: localhost
  environment:
    http_proxy:  http://proxy-server:3128/
    https_proxy: http://proxy-server:3128/
  connection: local
  gather_facts: no
  become: true
  tasks:
    - apt:
        update_cache: yes

playbook を実行

$ ansible-playbook \
--inventory localhost, \
playbook.yaml

2020年2月12日水曜日

Git でベアリポジトリとしてリモートを Clone

こんな感じで clone

$ git clone \
--bare \
https://github.com/nezuppo/montyscad.git

clone 後の確認

$ ls -aF | cat
./
../
montyscad.git/
$ ls -aF montyscad.git/ | cat
./
../
HEAD
branches/
config
description
hooks/
info/
objects/
packed-refs
refs/

ベアリポジトリなのでワークツリーはないです。

diff で改行文字が CRLF のファイルと LF のファイルで改行文字を無視して比較

$ diff \
-u \
--strip-trailing-cr \
file0 \
file1

NTP を使わずに HTTP で時刻同期

NTP を使わずに HTTP で時刻同期するやりかたがあったので試したらうまくいきました
https://qiita.com/pankona/items/258fed78c168918a8ad2

$ sudo date --set @"$(https_proxy=http://some.where:3128/ wget -q https://ntp-a1.nict.go.jp/cgi-bin/jst -O - | sed -n 4p | cut -d. -f1)"