Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
CLIでWebカレン ダー(WebDAV)を 表示したい
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Kenichiro MATOHARA
May 01, 2021
Technology
360
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
CLIでWebカレン ダー(WebDAV)を 表示したい
Kenichiro MATOHARA
May 01, 2021
More Decks by Kenichiro MATOHARA
See All by Kenichiro MATOHARA
ファイル共有ソフトウェアのOpenCloud 8.0.0を試す
matoken
0
13
ターミナルグラフィックウェブブラウザ!?
matoken
0
54
軽量ウェブブラウザDilloのPlugin
matoken
0
55
今更LLMを触り始める(ローカルLLM bonsai)
matoken
0
220
念願のNDLOCR-Lite を試す
matoken
0
130
Nextcloud と互換性のある軽量WebDAV server のKaraDAV を試す
matoken
0
150
ActivityPub Server の snac その3
matoken
0
93
ActivityPub Server の snac その2
matoken
0
64
端末録画再生共有アプリ asciinema 3.0 リリース
matoken
0
110
Other Decks in Technology
See All in Technology
Datadog の学び方 - あるいは、オブザーバビリティを学ぶとは何か
mananyuki
1
490
メルペイ 会計システム概要と歴史
mewuto
0
190
AI時代に必要な脅威モデリング― 変化の速度に負けない理解とリスク判断
masakane55
4
1.1k
DWH の限界突破! AI エージェント向け爆速リアルタイムデータ基盤 ClickHouse
jozono
1
210
ビジネスを止めない技術的負債の返済のための戦略とその手法 - 技術的負債と向き合う / Complexity and Simplicity
soudai
PRO
3
650
OSC2026on_the-world-is-waiting-for-your-voice.pdf
naruoga
0
360
[2026-09-30]ロックンロールは鳴り止まないっ - 信頼性かまってちゃん - 「データ駆動を投げ捨ててまで。」追いかける信頼性改善に向けた取り組みの話
tosite
0
210
SDDの運用にめげずに向き合った話
sansantech
PRO
1
130
転んだ話が背中を預ける理由になる / A_story_about_falling_down_gives_you_a_reason_to_watch_each_other_s_backs.pdf
pauli
3
320
Execution in the Kingdom of Agents: Reflections on Abstraction and Complexity
bcantrill
0
870
Deep Data Security 機能解説
oracle4engineer
PRO
2
710
事業活動を AI Ready にする攻めと守りのデータエンジニアリング / data-engineering-for-ai-ready-business
pei0804
3
1.6k
Featured
See All Featured
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
270
Faster Mobile Websites
deanohume
310
32k
Building AI with AI
inesmontani
PRO
1
1.3k
Believing is Seeing
oripsolob
1
240
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
2.2k
Java REST API Framework Comparison - PWX 2021
mraible
34
9.7k
Un-Boring Meetings
codingconduct
0
440
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.4k
GraphQLとの向き合い方2022年版
quramy
50
15k
Embracing the Ebb and Flow
colly
88
5.2k
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
470
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
290
Transcript
CLIでWebカレン CLIでWebカレン ダー(WebDAV)を ダー(WebDAV)を 表示したい 表示したい Kenichiro Matohara(matoken) <
[email protected]
> 1
/ 26
大隅半島から参加(鹿児島の右下) 好きなLinuxディストリビューションはDebian お仕事募集 mailto:work@matohara.org Kenichiro Matohara(matoken) Kenichiro Matohara(matoken) https://matoken.org https://matoken.org
© OpenStreetMap contributors 2 / 26
最近の発表 最近の発表 「Nextcloudでスライドをウェブに埋め込みたい」小江戸らぐ 04/10 「xxfetchコマンドを集めてみた」 OSUNC21SP 04/17 「Linux Chromiumでビデオのハードウェアエンコード・デコードし たい」
東海道らぐ 04/24 「ShellCheckでShellScriptを少しまともに」 鹿児島らぐ 04/25 https://speakerdeck.com/matoken/ 3 / 26
鹿児島らぐ 鹿児島らぐ 次回05/23(日) 14:00〜 Discordにて(Win/mac/Linux/mobileアプリやウェ ブブラウザで参加可能) https://kagolug.org/ https://kagolug.org/ 鹿児島Linux勉強会 2021.05(オンライン開催)
4 / 26
ウェブカレンダーをcliで見たい ウェブカレンダーをcliで見たい カレンダーの内容を見ながら予定を決めたい みんなで参照したいけどうまいこと見せる方法が見当たらない 今はEtherPadに手動でコピペ とても面倒 cliで期間を指定してダンプできると良さそう 5 / 26
ウェブカレンダー ウェブカレンダー CalDAV WebDAVのカレンダー拡張 インターネットに公開してみんなで購読したり編集できる Googleカレンダー等でも利用できる Serverは radicale, Nextcloud等 Clientは
Evolution, Thunderbiad(Lightning), DACx5(Android) 6 / 26
それらしいものを探す それらしいものを探す apt-cache search とかで探す コマンドで取ってくるものは見当たらない CalDAV同期ソフトの +cliのカレンダーソフトウェの で 試してみた
vdirsyncer khal 7 / 26
今回の環境 今回の環境 Debian buster amd64 Debian sid amd64/Raspberry Pi buster
armhf でも動作するのを確認 8 / 26
vdirsyncerの導入と設定をしてカ vdirsyncerの導入と設定をしてカ レンダーをローカルに レンダーをローカルに リモートのCalDAVをローカルに.ics形式のファイルに保存 ローカルでの変更はリモートに反映しない $ sudo apt install
vdirsyncer $ mkdir ~/.config/vdirsyncer $ vi ~/.config/vdirsyncer/config 9 / 26
~/.config/vdirsyncer/config [general] status_path = "~/.vdirsyncer/status/" [pair my_calendars] a = "my_calendars_local"
b = "my_calendars_remote" collections = null metadata = ["color"] [storage my_calendars_local] type = "filesystem" path = "~/.calendars/" fileext = ".ics" [storage my_calendars_remote] type = "caldav" url = "https://files.matoken.org/remote.php/dav/public-calendars/YW5gc6gMG8tC63AH?export" 10 / 26
カレンダー同期 カレンダー同期 1 初回のみ 2 同期実行 $ vdirsyncer discover my_calendars
Discovering collections for pair my_calendars my_calendars_local: my_calendars_remote: - "YW5gc6gMG8tC63AH" ("onlin_event (matoken)") warning: No collection "YW5gc6gMG8tC63AH" found for storage my_calendars_local. Should vdirsyncer attempt to create it? [y/N]: y Saved for my_calendars: collections = ["YW5gc6gMG8tC63AH"] $ vdirsyncer sync Syncing my_calendars/YW5gc6gMG8tC63AH Copying (uploading) item 05f764a4-8c30-46ed-a0fe-62c67d3975a8 to my_calendars_local/YW5gc6gMG8 Copying (uploading) item 1acc3691-a12b-4534-a4e2-6ee6213ecff1 to my_calendars_local/YW5gc6gMG8 Copying (uploading) item 202e727b-0431-40b5-8008-9ada1269c7c8 to my_calendars_local/YW5gc6gMG8 Copying (uploading) item 2312a403-b2e6-4716-9c6f-45aa94519654 to my_calendars_local/YW5gc6gMG8 : 1 2 11 / 26
crontabでカレンダー自動同期 crontabでカレンダー自動同期 crontabで vdirsyncer sync を定期的に実行して同期 (chronicは から) moreutils $
crontab -l | grep 'vdirsyncer sync' 4 4 * * * chronic vdirsyncer sync 12 / 26
khalの導入と設定をしてカレンダ khalの導入と設定をしてカレンダ ーを表示 ーを表示 vdirsyncerでローカルに同期したカレンダーを で表示する khal $ sudo sudo
apt install khal $ mkdir ~/.config/khal $ vi ~/.config/khal/config 13 / 26
~/.config/khal/config 1 .ical のパスを指定 [calendars] [[event]] path = ~/.calendars/YW5gc6gMG8tC63AH/ readonly
= True [locale] timeformat = %H:%M dateformat = %Y-%m-%d longdateformat = %Y-%m-%d datetimeformat = %Y-%m-%d %H:%M longdatetimeformat = %Y-%m-%d %H:%M 1 14 / 26
カレンダーの表示 カレンダーの表示 khal コマンドでカレンダーがダンプされる(崩れる?) 冗長なので --format "{title}" でタイトルだけ表示 今日だけや,今日から7日間,指定日〜指定日など範囲指定も URLの表示もしたいけどフィールドがなく面倒なので今回はや
っていない ikhal コマンドでTUIのカレンダーが利用できる TUI カレンダーには のほうが便利かも calcurse 15 / 26
khal khal 16 / 26
ikhal(TUI版) ikhal(TUI版) 17 / 26
exmple exmple 1 今日から今日まで表示 2 今日から7日間表示 3 03/01〜03/31まで表示 4 LC_TIMEでローカライズ(曜日など)
5 faketimeで05/03としてkhalを実行 $ khal list --format "{title}" today today $ khal list --format "{title}" today 7days $ khal list --format "{title}" 2021-05-01 2021-05-31 $ LC_TIME=ja_JP.UTF-8 khal list --format "{title}" 2021-05-01 2021-05-31 $ faketime 2021-05-03 khal list --format "{title}" today 1 2 3 4 5 18 / 26
目的の1月分くらいのカレンダ 目的の1月分くらいのカレンダ ーを出力 ーを出力 $ LC_TIME=ja_JP.UTF-8 khal list --format "{title}"
today 31days Tomorrow, 2021-05-01 LILO&東海道らぐオンラインミーティング 2021-05-01 月曜日, 2021-05-03 憲法記念日 火曜日, 2021-05-04 みどりの日 水曜日, 2021-05-05 こどもの日 土曜日, 2021-05-08 TLUG technical meeting(online) 小江戸らぐ 5月のオフな集まり(第226回) 金曜日, 2021-05-14 第74回FreeBSDワークショップ(オンライン) 土曜日, 2021-05-15 東京エリア・関西合同 Debian 勉強会 (予定) 低レベル勉強会2021年05月 日曜日, 2021-05-16 秋葉原ロボット部 2021年5月 第104回勉強会 月曜日, 2021-05-17 OSC2021 Online/Hokkaido 申込締切 木曜日, 2021-05-20 第87回FreeBSD勉強会 日曜日, 2021-05-23 鹿児島Linux勉強会 2021.05(TBD) 土曜日, 2021-05-29 Open Source Conference 2021 Online Nagoya 日曜日, 2021-05-30 ディストリビューション開発もくもく会 2021年5月 19 / 26
余禄)カレンダーをWebhooksで 余禄)カレンダーをWebhooksで Discordに投稿 Discordに投稿 せっかくなのでDIscordのチャンネルに今日のイベントを投稿して みる DiscordはWebhooksを使ってかんたんにメッセージを投稿すること が出来る 投稿したいチャンネルの⚙アイコン「チャンネルの編集」から 「連携サービス」→「ウェブフック」から新しいウェブフック
を作成し,投稿チャンネルを確認して「ウェブフックURLをコ ピー」 Webhooks URL例 https://ptb.discord.com/api/webhooks/826777625053495306/ 20 / 26
curlで投稿テスト curlで投稿テスト $ curl -X POST -H "Content-Type: application/json" \
-d '{"username": "ボット", "content": "こんにちは 🤖 "}' \ 'https://ptb.discord.com/api/webhooks/826777625053495306/QZoG2LLZOFlsKO_Auf1IQcXHVFozlgU37EGO 21 / 26
今日のカレンダー投稿script 今日のカレンダー投稿script $ cat /home/matoken/bin/calpost.sh #!/bin/sh # khal # list
-> 一覧表示 # --format "{title}" -> タイトルだけ表示 # today -> 今日から # today -> 今日まで # sed -> jsonの改行形式に変換 CAL=$(khal list --format "{title}" today today | grep -v ^Today,\ | sed -z -e "s/\n/\\\\r/g") echo "${CAL}" # イベントのない日は投稿せず終了 if [ "${CAL}" = 'No events\r' ] then echo "${CAL}" exit fi # https://qiita.com/Eai/items/1165d08dce9f183eac74 MSG=$(printf '{"username": "今日のイベント 📅 ", "content": "%s"}' "${CAL}") echo "$MSG" # Discord WebHock でKagolug の#random へpost curl -X POST -H "Content-Type: application/json" \ -d "${MSG}" \ 'https://ptb.discord.com/api/webhooks/826777625053495306/QZoG2LLZOFlsKO_Auf1IQcXHVFozlg 22 / 26
crontabに登録して毎日投稿 crontabに登録して毎日投稿 $ crontab -l | grep calpost 58 4
* * * /home/matoken/bin/calpost.sh 2>&1 > /home/matoken/tmp/cron/calpost.sh.log 23 / 26
投稿例 投稿例 24 / 26
まとめ まとめ + でWebDAVのカレンダーを同期&コマンドラインに表 示できるようになった はじめの設定が少し面倒だけど一度設定してしまうと便利 ついでにDiscordへ自動投稿するようにした 第三者からのカレンダー投稿も考えたい vdirsyncer khal
25 / 26
奥付 奥付 発表 発表者 公開URL , , 利用ソフトウェア ライセンス CC
BY-NC-SA 4.0 LILO&東海道らぐオンラインミーティング 2021-05-01 Kenichiro Matohara(matoken) SpeakerDeck pdf pdf-sig source Asciidoctor Reveal.js 26 / 26