2023 Jan. 29.
参照先 https://bitbucket.org/arsmus/shell-script-public/src/master/text-file/catFilesInsertEnptyLine.sh
UTF-8テキストファイル・POSTSCRIPTファイル・PDFファイル変換、コマンドラインでの印刷
2023 Jan. 29.
参照元 なにかやったら書くブログ: UTF-8で書かれた日本語テキスト, テキストファイルをPostScriptに変換する方法(2019/11)
utf-8テキストファイルをpostscriptファイルに変換するフィルターソフト paps
(Ubuntuでのインストール)
$ sudo apt update && sudo apt install paps
utf-8テキストファイルのpostscriptファイルへの変換
$ paps --header UTF-8TEXT-FILE > POSTSCRIPT-FILE headerオプションで日時、ファイル名、ページ番号が各ページのヘッダに挿入される
postscriptファイルのpdfファイルへの変換
$ cat POSTSCRIPT-FILE | ps2pdf - > PDF-FILE
utf-8テキストファイルのpdfファイルへの変換
$ paps --header UTF-8TEXT-FILE | ps2pdf - > PDF-FILE
utf-8テキストファイルの印刷
postscriptファイルに変換して印刷する
出力先プリンター確認
/etc/printcapに書かれている
下記例では Brother_DCP_J562N
$ cat /etc/printcap # This file was automatically generated by cupsd(8) from the # /etc/cups/printers.conf file. All changes to this file # will be lost. Brother_DCP_J562N|Brother DCP-J562N:rm=pc17:rp=Brother_DCP_J562N:
印刷コマンド実行
(postscriptファイルの印刷)
lpr -P プリンター POSTSCRIPTファイル
あるいは
cat POSTSCRIPT-FILE | lpr -P プリンター
(片面印刷) $ paps --header UTF-8TEXT-FILE | lpr -P Brother_DCP_J562N (両面印刷) $ paps --header UTF-8TEXT-FILE | lpr -P Brother_DCP_J562N -o Duplex=DuplexNoTumble (プリンター取得自動化) $ MyPrinter=$(grep -m 1 "^[^#]" /etc/printcap | sed "s/|.*//") $ paps --header UTF-8TEXT-FILE | lpr -P "$MyPrinter" -o Duplex=DuplexNoTumble
mixcloud(音声版youtube)からのダウンロード
2023 Jan. 22.
出典 MixCloudから音楽をダウンロードする方法まとめ
- https://www.mixcloud.com から 対象の音声ページを開く。
- 開いているページのURLをコピーする。(ブラウザ上部のURL欄)
- https://www.dlmixcloud.com/ を開く。
- [Enter Mixcloud URL]欄にwww.mixcloud.comページでコピーしたURLをペーストし、[DOWNLOAD FROM MIXCLOUD]ボタンをクリックする。
- しばらくすると[DOWNLOAD FROM MIXCLOUD]ボタンの下に当該音声がバナー表示される。
- そのバナー内の[DOWNLOAD MIX]ボタンをクリックする。
- 表示された画面内の[DOWNLOAD MIX]ボタンをマウス右クリックし、「名前を付けてリンク先を保存」を選択する。(Firefoxの場合)
android開発 Intentでのファイラー起動
2023 Jan. 15.
環境
compileSdk 33 minSdk 30 targetSdk 33
ファイラーを起動できるIntent
Intent.ACTION_GET_CONTENT
Intent.ACTION_OPEN_DOCUMENT
Intent.ACTION_OPEN_DOCUMENT_TREE
"Intent.ACTION_OPEN_DOCUMENT"、"Intent.ACTION_GET_CONTENT"ではIntent#setType()を指定しないといけない。すべてのファイルならsetType("*/*")。
Storage Access Frameworkの制約を考慮すること。
ファイルストレージの読み込み権限を取得しておくこと。
Intentリスト
サンプルコード
ACTION_GET_CONTENTモードでデフォルトファイラーが起動
val intent = Intent(Intent.ACTION_GET_CONTENT) intent.setType("*/*") try { startActivity(intent) } catch (e: ActivityNotFoundException) { // Define what to be done if no activity can handle the intent. }
ACTION_OPEN_DOCUMENTモードでデフォルトファイラーが起動
val intent = Intent(Intent.ACTION_OPEN_DOCUMENT) intent.setType("*/*") try { startActivity(intent) } catch (e: ActivityNotFoundException) { // Define what to be done if no activity can handle the intent. }
ACTION_OPEN_DOCUMENT_TREEモードでデフォルトファイラーが起動
val intent = Intent(Intent.ACTION_OPEN_DOCUMENT_TREE).apply { flags = Intent.FLAG_GRANT_READ_URI_PERMISSION } try { startActivity(intent) } catch (e: ActivityNotFoundException) { // Define what to be done if no activity can handle the intent. }
ACTION_GET_CONTENTモードでX-ploreが起動
val intent = Intent(Intent.ACTION_GET_CONTENT) intent.setPackage("com.lonelycatgames.Xplore") intent.setType("/") try { startActivity(intent) } catch (e: ActivityNotFoundException) { // Define what to be done if no activity can handle the intent. }
ACTION_GET_CONTENTモードで複数ファイラーアプリ選択画面を期待するも、デフォルトファイラーが起動する
val title = resources.getString(R.string.chooser_title) val intent = Intent(Intent.ACTION_GET_CONTENT) intent.setType("*/*") val chooser = Intent.createChooser(intent, title) try { startActivity(chooser) } catch (e: ActivityNotFoundException) { // Define what your app should do if no activity can handle the intent. }
ACTION_GET_CONTENTモードでX-ploreが起動する
val title = resources.getString(R.string.chooser_title) val intent = Intent(Intent.ACTION_GET_CONTENT) intent.setType("*/*") intent.setPackage("com.lonelycatgames.Xplore") val chooser = Intent.createChooser(intent, title) try { startActivity(chooser) } catch (e: ActivityNotFoundException) { // Define what your app should do if no activity can handle the intent. }
ACTION_OPEN_DOCUMENT_TREEモードでX-plore起動を期待するも、何も起動しない
val intent = Intent(Intent.ACTION_OPEN_DOCUMENT_TREE).apply { flags = Intent.FLAG_GRANT_READ_URI_PERMISSION } intent.setPackage("com.lonelycatgames.Xplore") try { startActivity(intent) } catch (e: ActivityNotFoundException) { // Define what your app should do if no activity can handle the intent. }
NHKラジオ聴き逃し配信の録音
2023 Jan. 10.
出典 VLCを使ったNHKラジオ 「らじる・らじる」聞き逃し放送の高速録音 | falconblog
Firefoxブラウザの場合
聞き逃しプレーヤー画面の右上メニューで「その他のツール」をクリック -> 「ウェブ開発ツール」をクリック -> 「インスペクター・タブ」を選択 -> 「HTMLを検索」欄あるいは「Ctrl + f」で文字列「m3u8」を検索- > ハイライトされた部分でマウス右クリックし「コピー」を選択 -> 「outerHTML」を選択 -> コピーされたテキストをエディターに貼り付ける -> 文字列「https://nhks-vh.akamaihd.net***.m3u8」をVLCの「ネットワークストリームを開く」の「ネットワーク」タブのネットワークURL欄に貼り付け、下部の「再生」となっているプルダウンを「変換」にし、表示されるダイアログにてプロファイルを「Audio-MP3」にし、出力ファイルを設定し、下部の「開始」ボタンをクリックする。
findコマンド 指定期間内に更新されたファイルの検索
2022 Dec. 25.
# 過去48時間未満、かつ、過去1時間以上前に更新されたファイルの検索 MyDir="${1%/}" // シェルスクリプトの第1引数に検索対象ディレクトリを指定した場合 find "${MyDir}"/ -type f -mmin -2880 -and -mmin +60 -print0 | xargs -0 ls -trl