かすみん日記

暇なときに何か喋ります

シェルの再起動

シェルの設定ファイル(例えば~/.zshrc)を編集した後、それを反映させるにはsource ~/.zshrcを実行すればいいとある。

しかし、それは単にもう一度~/.zshrcファイルを読み直しているだけで、例えば~/.zshrcに書いていたエイリアスコメントアウトした後source ~/.zshrcを実行しても、始めに書いていたエイリアスは解除されない。

エイリアスを解除するにはunaliasコマンドを使う必要がある。

シェルを再起動すれば、一旦設定を全部忘れてから~/.zshrcを読むので、当然コメントアウトしたエイリアスは解除されている。

つまり、設定ファイルの再読み込みと言ったときには、シェルを再起動してから~/.zshrcの設定を改めて反映するのが本質的である。

ということで、シェルを再起動するコマンドを下に置いておく;

exec $SHELL -l

シェルの設定ファイルの再読み込みには、source ~/.zshrcではなくexec $SHELL -lを使った方がいいという話でした。

再起動コマンドの解説は下の参考サイトに書いてあります。

以上。

参考

qiita.com

MacのQuicklookでmkv動画を再生したい(無理)

MacのQuicklookでmkv動画を再生したいと思って調べたけど無理っぽい。

できそうなら教えてください。

蛇足

QLVideo

サムネを表示するくらいだったらqlvideoというプラグインをインストールすればできるようになる。

Homebrewでインストール;

brew install --cask qlvideo

インストール途中にターミナルでパスワードの入力を求められた。

プラグインのインストールではおなじみの、環境設定のセキュリティとプライバシーで許可して、、、とかはやらなくて大丈夫だった。

VLC

とにかく再生できればいいのであればVLCを使えばいい。

Homebrewでインストール;

brew install --cask vlc

FFmpeg

あとは、mkvをmp4とかに変換してしまえばいいかと。

動画や音声ファイルのフォーマット変換はffmpegを使えばいいらしい。

Homebrewでインストール;

brew install ffmpeg

変換であれば、例えば以下のようにして使う;

ffmpeg -i input.mkv output.mp4

動画から音声を抽出したりいろいろできるらしい。

mpv

mpvというプレイヤーもある。

Homebrewでインストール;

brew install mpv

使い方は再生したいファイルを指定するだけ;

mpv input.mkv

プレイヤーのウインドウが開いて、再生が終わると自動で閉じる。

以上。

即日発行できるクレカ(セゾン・イオン・三井住友)の紹介

即日発行できるクレカのご紹介です。

セゾン・イオン・三井住友の3つのカードブランドしか見つけられませんでしたが、他にも即日発行できるクレカがあれば教えてください。

あとクレカ情報の更新頻度がどの程度なのかは存じ上げませんが、一応ここに書いた情報は2021年9月現在の情報であることを断っておきます。

即日発行できるクレカ

セゾン・イオン・三井住友の3つのカードブランドに最短即日発行できるクレカがあるみたいです。

クレカは物理なんだから審査は即日でもカードの発行は無理じゃね?と思うかも知れませんが、実際の仕組みとしては、審査が終わると即時にWebやアプリでクレカ番号などの情報が見れるようになるというものです(デジタル発行と言うみたいです)。

物理クレカ(プラスチックカード)は後日発送されます。

さらに言えば、セゾンのDigitalや三井住友のNLなどは、プラスチックカードに番号や3桁のセキュリティコードが印字されていません!

そういったカードの情報はWebやアプリからしか確認できない仕様になっているみたいです。

では早速ですが、各カードブランドごとに即日発行可能なクレカを簡単にまとめたいと思います。

セゾンカード

即日発行可能なクレカ一覧(公式サイト):

www.saisoncard.co.jp

結構種類がありますね。

何でもいいんだったらSAISON CARD Digitalでいいんじゃないかなと思います。

実際、私はこれを作りました。 その経験談はあとで述べます。

イオンカード

ページ下の方に即日発行可能なカードの一覧があります:

www.aeon.co.jp

こちらもいろいろ種類があります。

SKEのやつが(自分は全くSKE知らないが)カードデザインかっこよくてほしいです。

裏面に推しメンを印刷できるみたいです(最初このカード作ろうと思ったけどメンバー知らないのでやめた)。

三井住友

即日発行可能なカードは3種類:

www.smbc-card.com

三井住友カード(NL)」が無難だとは思いますが、学生だと「デビュープラス」の方が審査通りやすいのかも知れないです。知らんけど。

私は既にAmazon MasterCardのクラシックを使っていて、アプリが一緒になるので三井住友でもう一枚作れば便利かなと思ってNLを申し込もうと思ったが、本人確認書類に運転免許証が必要と書いていて、代わりにマイナンバーでもいいのかわかんなかったので作るのをやめました。

あとクレカでググったら三井住友の記事ばっか出てきて宣伝すげぇなと思いました。

SAISON CARD Digitalを作った感想

3つのブランドを紹介しましたが、私が実際に作ったのはSAISON CARD Digitalだけです。

申し込みはここからで、スマホからでも入力に苦労せず申し込めます。

実際私はiPhoneから申し込みました。

必要な情報としては名前や住所、年収や家族構成などで、それらの入力と同時にリボ払いの設定もしました。

本人確認は、私は銀行口座登録によって行ったので、運転免許証やマイナンバーカードなどの写真を撮って送るみたいな面倒なことはやらずに済みました。

(口座登録で本人確認できるなら、今まで証明書の写メ送ったりしていたのは一体何だったんだ。。。)

口座登録による本人確認が終了して、審査状況を確認しようとページ遷移したら既に審査完了していました(爆速)。

さすがの爆速具合ですから、多分全部機械的に処理しているんだと思います。

余談ですが、今回の私の場合、なんと利用可能額の上限が20万円でした!

即時発行で、しかも無職のニートもとい学生なのに、そんなに使えていいのか(学生は普通だと上限10万?)。

与太話

なんで即日発行できるクレカが必要になったのかという与太話です。

先日のApple Eventを観て(多分全人類が)終了直後にiPad miniをポチったが、クレカ決済に失敗してしまった。

理由はシンプルにクレカの利用限度額を超過してしまったからだ。

Appleの場合は決済に失敗してもすぐに注文キャンセルとなるのではなく、1週間以内に支払い方法を改めれば注文はそのまま認められる。

注文したiPad miniは9万円くらいで、当時は上限額10万のクレカ2枚しかもっておらず、どちらも利用可能額の残りが9万円もなかった。

普段(?)なら現金でのコンビニ支払いなども用意されているはずだが、予約注文(?)の場合はクレカでしか決済できない模様。

予約も兼ねた注文だったので、ここでキャンセルすると最短発送日の24日にはもう届かなくなってしまう;;

クレカ会社に電話すれば、一時的に利用可能な上限額を上げられるが、それが適用されるのは審査が降りた後1週間ぐらいかかるらしい。

ということで、あとは親のクレカ借りるしかないかぁと思ったところで閃いた: 爆速で新しいクレカを作ればいいのではないかと!

ところが普通はクレカ作るのにも早くて1週間ぐらいかかる。 即日発行できるクレカはないのか?!と思って調べたら普通にあった。

ということで、上の記事に戻ります。

セゾンのSAISON CARD Digitalを即時発行してこの決済に使いました。

あとどうでもいいけど、ひろゆきが「JCB以外使ってるやつは非国民」と言っていたので、カードの国際ブランドはJCBにしました。 まあとくにこだわり無いしね。

以上です。

クレカは特にアフィカス多いので、情報を得るのが難しいですね。

というか数多のアフィカスをすり抜けてこの記事にたどり着く人はいるのだろうか。

タダより怖いものはないということで、決してリボなんかには手を出さないようにして、便利で楽しいショッピングライフを!

node.jsのバージョンを変更

前提

node.jsのバージョンはnodebrewで管理しています。

nodebrewのインストールは以下の記事を参照。

geniusium.hatenablog.com

環境

  • macOS big sur
  • nodebrew 1.0.1

node.jsのバージョン変更

現在使用しているnode.jsのバージョン;

 % node -v
v15.9.0

インストールしているnode.jsのバージョンのリストを確認;

% nodebrew list
Use of uninitialized value $a1 in numeric comparison (<=>) at /Users/unko/.nodebrew/current/bin/nodebrew line 678.
.DS_Store
v15.9.0

current: v15.9.0

リモートにあるバージョンリストを確認;

% nodebrew ls-remote

# たくさん出てくる

今回はv12.22.6をインストールしてみる;

% nodebrew install v12.22.6
Fetching: https://nodejs.org/dist/v12.22.6/node-v12.22.6-darwin-x64.tar.gz
######################################################################### 100.0%
Installed successfully

使用するnode.jsのバージョンをv12.22.6に設定;

% nodebrew use v12.22.6
Use of uninitialized value $a1 in numeric comparison (<=>) at /Users/unko/.nodebrew/current/bin/nodebrew line 678.
Use of uninitialized value $a1 in numeric comparison (<=>) at /Users/unko/.nodebrew/current/bin/nodebrew line 678.
use v12.22.6

ちゃんと設定できたか確認;

% node -v
v12.22.6

ちゃんと設定できた!

以上。

和文におけるコロンとセミコロンの用法

和文におけるコロンとセミコロンの用法の例を挙げてみようと思います。

まずはコロンもセミコロンも使用せずに文章を書いてみます。

Pythonをインストールするには、コマンド

pip install python

を実行します。

以下で、これと(ほぼ)同じ意味になるような文章を、コロン、セミコロンを使って書いてみます。

コロンを使用する例:

Pythonをインストールするには、以下のコマンドを実行します:

pip install python

セミコロンを使用する例:

Pythonをインストールします;そのためにコマンド

pip install python

を実行します。

あるいは簡潔に

Pythonをインストールします;

pip install python

これら3つの例では、コロンやセミコロンを句点に置き換えても正しい文章であると思います。

Pythonをインストールするには、以下のコマンドを実行します。

pip install python


Pythonをインストールします。そのためにコマンド

pip install python

を実行します。


Pythonをインストールします。

pip install python

単に句点で書くより、コロンやセミコロンを用いた方が文章が明解な気がします。

一方で、以下のような用例は誤りであると思います。

(1) Pythonをインストールするには、以下のコマンドを実行します;

pip install python


(2) Pythonをインストールします:そのためにコマンド

pip install python

を実行します。


(3) Pythonをインストールします:

pip install python

(1)はセミコロンの後の語句が前の文の補足(代名詞が指すものの説明)であるので、コロンの方が適切かと思います。

(2)は関連した2つの文の接続なのでセミコロンの方が適切かと思います。

(3)は(2)と同じことですが、コロン後の語句が前の文を説明しているわけではないので、セミコロンの方が適切かと思います。

以上の議論は正しいと納得していただけるでしょうか。 私はあまり自信を持って言えません。

最後に挙げた(3)の用例はよく見かけますし、実際誤ってはいないのではないかとも思ったりします。

また、セミコロンは和文ではあまり見かけません。 記号は便利なのであるなら使いたいと思うのですが。

コメントで意見を聞かせてもらえれば幸いです。

作業ログ:brew install youtube-dl

Homebrewでyoutube-dlをインストールしたときの作業ログ。

いくつかエラーが出たので。

% brew install youtube-dl

...

Error: python@3.9: the bottle needs the Apple Command Line Tools to be installed.
  You can install them, if desired, with:
    xcode-select --install

You can try to install from source with:
  brew install --build-from-source python@3.9
Please note building from source is unsupported. You will encounter build
failures with some formulae. If you experience any issues please create pull
requests instead of asking for help on Homebrew's GitHub, Twitter or any other
official channels.

言われた通り実行;

xcode-select --install

ポップアップウインドウであれこれしてインストール。

もう一度試す;

% brew install youtube-dl

...

Error: pango is already installed from dersimn/craft!
Please `brew uninstall pango` first."

アンインストールする;

brew uninstall pango

youtube-dlのインストール自体はもう済んでいたらしい。

バージョンを確認;

% youtube-dl --version

2021.06.06

公式サイトに書かれているバージョンと一致しているのでOKかと。

使い方はREADMEこの記事などを参照。

以上。

作業ログ:本日のbrew doctor

brew doctorの警告を消していく作業ログになります。

環境

  • macOS big sur v11.5.1
  • Homebrew 3.2.11
  • zsh

警告

たくさん警告が出ちゃった;

% brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: Some installed kegs have no formulae!
This means they were either deleted or installed with `brew diy`.
You should find replacements for the following formulae:
  protobuf@3.7

Warning: You have the following deprecated, cask taps tapped:
  caskroom/cask
Untap them with `brew untap`.

Warning: Some installed formulae are deprecated or disabled.
You should find replacements for the following formulae:
  sdl
  sdl_image
  sdl_ttf
  sshfs

Warning: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and which additional flags to use when
compiling and linking.

Having additional scripts in your path can confuse software installed via
Homebrew if the config script overrides a system or Homebrew-provided
script of the same name. We found the following "config" scripts:
  /Users/hoge/.rbenv/shims/passenger-config

Warning: Unbrewed header files were found in /usr/local/include.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected header files:
  /usr/local/include/python3.6m/pygame/_camera.h
  /usr/local/include/python3.6m/pygame/_pygame.h
  /usr/local/include/python3.6m/pygame/_surface.h
  /usr/local/include/python3.6m/pygame/bitmask.h
  /usr/local/include/python3.6m/pygame/camera.h
  /usr/local/include/python3.6m/pygame/fastevents.h
  /usr/local/include/python3.6m/pygame/font.h
  /usr/local/include/python3.6m/pygame/freetype.h
  /usr/local/include/python3.6m/pygame/mask.h
  /usr/local/include/python3.6m/pygame/mixer.h
  /usr/local/include/python3.6m/pygame/pgarrinter.h
  /usr/local/include/python3.6m/pygame/pgbufferproxy.h
  /usr/local/include/python3.6m/pygame/pgcompat.h
  /usr/local/include/python3.6m/pygame/pgopengl.h
  /usr/local/include/python3.6m/pygame/pygame.h
  /usr/local/include/python3.6m/pygame/scrap.h
  /usr/local/include/python3.6m/pygame/surface.h

Warning: You have unlinked kegs in your Cellar.
Leaving kegs unlinked can lead to build-trouble and cause formulae that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
  qt

ひとつずつ対処していきます!

1つめ:deleted formulae

Warning: Some installed kegs have no formulae!
This means they were either deleted or installed with `brew diy`.
You should find replacements for the following formulae:
  protobuf@3.7

protobuf@3.7はもう削除されたformulaらしい。

特に思い出もないのでアンインストールしようとしたけどダメだった;

% brew uninstall protobuf@3.7
Error: Refusing to uninstall /usr/local/Cellar/protobuf@3.7/3.7.1_1
because it is required by mysql, which is currently installed.
You can override this and force removal with:
  brew uninstall --ignore-dependencies protobuf@3.7

mysqlがこれに依存しているらしい。

mysqlはもう使ってないのでアンインストールする;

brew uninstall mysql

これは成功。 このあとbrew doctorしても先の警告は消えてなかった。

改めてprotobuf@3.7をアンインストール;

brew uninstall protobuf@3.7

普通に成功。brew doctorを確認すると警告は消えた。

2つめ:deprecated cask taps

Warning: You have the following deprecated, cask taps tapped:
  caskroom/cask
Untap them with `brew untap`.

cask tapsというのは、

brew tapとは公式以外のリポジトリをフォーミュラとしてHomebrewに追加するもので、brewのもとでinstall,uninstall,updateなどが行えます。

とのこと(参考)らしい。

実際、cask tapsを見てみるといくつか表示された;

% brew tap  
caskroom/cask
dersimn/craft
heroku/brew
homebrew/cask
homebrew/core
homebrew/services
ie-developers/ie

そのうちのcaskroom/caskがオワコンなのでuntapしろということらしい。

brew caskコマンドが使えなくなったのと関係があると思う。

とにかくuntap;

brew untap caskroom/cask

brew tapcaskroom/caskが消えていることが確認でき、brew doctorの警告も消えていた。

3つめ:deprecated formulae

Warning: Some installed formulae are deprecated or disabled.
You should find replacements for the following formulae:
  sdl
  sdl_image
  sdl_ttf
  sshfs

sdlが何なのかはわからないが、新しいsdl2に置き換わったっぽい。

多分もう不要なのでアンインストールする;

brew uninstall sdl_image
brew uninstall sdl_ttf
brew uninstall sdl

同様にsshfsもアンインストール;

brew uninstall sshfs

4つめ:Homebrew管轄外のconfigファイル

Warning: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and which additional flags to use when
compiling and linking.

Having additional scripts in your path can confuse software installed via
Homebrew if the config script overrides a system or Homebrew-provided
script of the same name. We found the following "config" scripts:
  /Users/hoge/.rbenv/shims/passenger-config

PATHの中にHomebrewが管轄外の*-configという名前のファイルがあると衝突を起こすかもみたいな理由で警告が出ているようです。

対処法としては、brewコマンドを実行する際には管轄外の*-configファイルがあるディレクトリをPATHから消してやればよいとのことです。

brewコマンド実行時にPATHを設定し直すようなエイリアスを設定します。

zshなら~/.zshrcに、bashなら~/.bash_profileエイリアスを設定する;

# zsh
echo 'alias brew="env PATH=${PATH/\/Users\/hoge\/\.rbenv\/shims:/} brew"' >> ~/.zshrc

# bash
echo 'alias brew="env PATH=${PATH/\/Users\/hoge\/\.rbenv\/shims:/} brew"' >> ~/.bash_profile

${A//B/C}の部分は、変数Aをその中でパターンBにマッチした部分を文字列Cに置き換えて展開するというものです(シェルの変数展開)。

パターンの書き方は、*-configファイルのあるディレクトリが/Users/hoge/.rbenv/shims/であれば、スラッシュ/とドット.の前にバックスラッシュ\をおいてエスケープします。

今回は置換後の文字列が省略されているので、パターンにマッチした部分が消去されます。

エイリアスを設定したら、設定ファイルを際読み込みします;

source ~/.zshrc

(この後変な操作しちゃって因果関係が不明になっちゃったけど、多分これで直ったんだと思います)

参考:【Homebrew】brew doctorのWarning対処方法 (その3) + envコマンドについて - TASK NOTES

5つめ:Unbrewed header files

Warning: Unbrewed header files were found in /usr/local/include.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected header files:
  /usr/local/include/python3.6m/pygame/_camera.h
  /usr/local/include/python3.6m/pygame/_pygame.h
  /usr/local/include/python3.6m/pygame/_surface.h
  /usr/local/include/python3.6m/pygame/bitmask.h
  /usr/local/include/python3.6m/pygame/camera.h
  /usr/local/include/python3.6m/pygame/fastevents.h
  /usr/local/include/python3.6m/pygame/font.h
  /usr/local/include/python3.6m/pygame/freetype.h
  /usr/local/include/python3.6m/pygame/mask.h
  /usr/local/include/python3.6m/pygame/mixer.h
  /usr/local/include/python3.6m/pygame/pgarrinter.h
  /usr/local/include/python3.6m/pygame/pgbufferproxy.h
  /usr/local/include/python3.6m/pygame/pgcompat.h
  /usr/local/include/python3.6m/pygame/pgopengl.h
  /usr/local/include/python3.6m/pygame/pygame.h
  /usr/local/include/python3.6m/pygame/scrap.h
  /usr/local/include/python3.6m/pygame/surface.h

Homebrew管轄外のheaderファイルがあって衝突するかもという警告。

身に覚えがなければ消していいと思う。

消す;

rm /usr/local/include/python3.6m/pygame/*.h

これで警告は消えた。

6つめ:

Warning: You have unlinked kegs in your Cellar.
Leaving kegs unlinked can lead to build-trouble and cause formulae that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
  qt

リンクする;

% brew link qt
Linking /usr/local/Cellar/qt/5.15.1... 510 symlinks created.

終わり。

以上

最期にbrew doctorすると、もう警告は出なくなった;

% brew doctor 
Your system is ready to brew.

お疲れさまでした。