Git の履歴を変えたいときに使うコマンド

git

履歴の全ての author, committer を変更 git filter-branch -f --env-filter "GIT_AUTHOR_NAME='yourname'; GIT_AUTHOR_EMAIL='your@email.com'; GIT_COMMITTER_NAME='yourname'; GIT_COMMITTER_EMAIL='your@email.com';" HEAD 履歴から特定のファイルを削除…

外部機関の脆弱性診断を受けて対応した

ssh hoge ディレクトリリスティング無効化 cp /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.orig vim /etc/httpd/conf/httpd.conf # Directory Listing Denied Alias /icons/ "/var/www/icons/" <Directory "/var/www/icons"> # Options MultiViews Indexes FollowSymLinks Op</directory>…

MySQLのバージョン確認

mysql --version とかで確認できるのは MySQL のコマンドラインクライアントのバージョン。 DB 自体のバージョンは、DB に接続すると確認できる。 mysql -hhostname -uusername -p Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL con…

macのカーソル移動速度を早くする

mac

よく忘れるのでメモ defaults write -g InitialKeyRepeat -int 12 # normal minimum is 15 (225 ms) defaults write -g KeyRepeat -int 1 # normal minimum is 2 (30 ms) Alacritty!iTermより早いよ! - Qiita

MariaDB(MySQL)で変数確認

例えばタイムゾーンを確認するとき MariaDB [(none)]> show variables like '%time_zone%'; +------------------+------------+ | Variable_name | Value | +------------------+------------+ | system_time_zone | JST | | time_zone | Asia/Tokyo | +----…

Djangoの環境構築(ディレクトリ作って、拡張入れるまで)

MacOS上で作業 プロジェクトディレクトリ作成 mkdir -p ~/workspace/django-demo cd ~/workspace/django-demo pythonのバージョン切り替え pyenv install 3.7.2 pyenv local 3.7.2 python仮想環境作成 python -m venv .venv source .venv/bin/activate pip i…

Bitbucket用の.ssh/config設定

Host bitbucket.org HostName bitbucket.org Port 22 User git IdentityFile /path/to/id_rsa SSHキーペアはいつものように サーバー内で ssh-keygen -t rsa -b 2048 -C "hoge" して作る。

PhpStormでリフォーマット

Command + Alt + L

MacでXAMPP

/Applications/XAMPP/etc/httpd.conf /Applications/XAMPP/etc/extra/httpd-vhosts.conf /Applications/XAMPP/etc/php.ini 辺りを弄っていけばそれっぽい環境になるんじゃないか XAMPPの文字化けをphp.iniの設定で直す方法【初心者向け】 | TechAcademyマガ…

MAMPのApacheが起動しない

MAMPで Apache couldn't be started. Please check your MAMP installation and configuration. となる場合、Mac標準のapacheと干渉している場合がある。 apachectl status apachectl stop

Githubに接続する際のSSH秘密鍵の指定

vi ~/.ssh/config Host github.com HostName github.com Port 22 User git IdentityFile ~/.ssh/id_rsa.example

Macでスクリーンショット

# 画面全体 cmd + shift + 3 # 選択範囲 cmd + shift + 4 # 選択ウィンドウ cmd + shift + 4 => space # 保存場所変更 defaults write com.apple.screencapture location ~/gd/screencapture/ killall SystemUIServer # ファイルの接頭辞変更 defaults write…

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

macOSをMojaveにアップグレードした直後あたりから、terminal上でタイトルのエラーが発生するようになった。 xcode-select --install でエラーが出なくなった。 Mac OS Sierraにしたらgitコマンド、ターミナル上にエラーが出てしまった。

Bitbucketからgit clone(SSH接続)

数年ぶりにbitbucketにリポジトリを作る用事ができた。 公開鍵はユーザーページのSettings => SSH keysから登録する。 いつもの公開鍵を登録後、早速リポジトリを作りクローンしようとしてみたら git@bitbucket.org: Permission denied (publickey). fatal: …

Homebrewでインストールされるrenameコマンド

こんな感じで使う。 brew install rename rename 's/^foo/bar/' *.txt rename // plasmasturm.org

SureServer証明書(.cer)が発行されてからサーバーに反映させるまでの流れ。

ssl

【CT対応】SureServer EV[SHA-2] 1年 証明書発行のお知らせ SureServer証明書(.cer)が発行されてからサーバーに反映させるまでの流れ。 Cybertrustの場合 SureServer EVなので、ルート・中間CA証明書のダウンロード|Cybertrust.ne.jpに移動し、設定方法を…

GitでSSH秘密鍵を指定してcloneする

.ssh/configでHostを設定した上で、 Host foo HostName 12.34.56.789 Port 2222 User bar IdentityFile path/to/secret_key そのHost名を指定してcloneする。 git clone ssh://bar@foo/path/to/repos.git

Laravel Debugbarの使い方

barryvdh/laravel-debugbar: Laravel Debugbar (Integrates PHP Debug Bar) Debugbar::info($object); Debugbar::startMeasure('render','Time for rendering'); Debugbar::stopMeasure('render'); Debugbar::addMeasure('now', LARAVEL_START, microtime(tr…

SSL更新するのでCSRください!

ssl

とか言われたら、 /etc/httpd/conf.d/ssl.confを確認して、大体の当たりをつけてCSRっぽいファイルを探す。 確認はCheck your CSR | Symantec CryptoReportとか適当なWebサイトで行う。 コマンドでもできる。 内容確認したら、そのままコピペして送る。 CSR…

SSL証明書の期限確認

ssl

対象のURLにおいて、Chromeのディベロッパーツールで確認するだけ。 SSL証明書の内容と確認する方法|GMOグローバルサイン【公式】

/var/log/secure

sshのlogなどはここを確認すれば良い。 /var/log/secure /var/log/secureとは|「分かりそう」で「分からない」でも「分かった」気になれるIT用語辞典

グローバルIPをCLIで確認

curl ifconfig.io Global IPの確認方法

CentOSのversion確認

ssh hostA [root@hostA ~]# cat /etc/redhat-release CentOS release 6.5 (Final) ssh hostB [root@hostB ~]# cat /etc/redhat-release CentOS Linux release 7.5.1804 (Core)

SCM Breezeを久しぶりにgit pullしたらおかしくなりかけた?

scmbreeze/scm_breezeを更新した後くらいから、git-credential-osxkeychainがパスワード入力を求めるようになった。 パスワード入力して、常に許可をクリックしたら表示されなくなった。 (そりゃそうか) それと同時期に、 /Users/i/.scm_breeze/lib/git/al…

Address in mailbox given [] does not comply with RFC 2822, 3.6.2.

Laravelでメール送信しようとしたらタイトルのエラーが発生。 宛先に''があったことが原因。 文字列を宛先にすると、その文字列をメールアドレスとして扱い、 そのアドレスに送信しようと試みる。 なので、空配列[]にしたら直った。

PHPのandとorの間違った使い方

php

php artisan tinkerにて >>> $t = true; >>> $f = false; >>> $res = $t and $f; return $res; => true /** false かと思ってた。*/ >>> $res = $f and $t; return $res; => false >>> $res = $t or $f; return $res; => true >>> $res = $f or $t; return $…

Trait 'Hoge' not found

なんとなくtrait使ってみたら、 Trait 'Hoge' not found とかなってしまった。 どうやら、Hoge.phpでnamespaceを設定していなかったことが原因の模様。 このあたりは、IDEに任せっきりだったからちゃんと勉強せねば。

PHPの関数の引数のアンド

php

関数の引数にアンド(アンパサンド、&)をつけると、参照渡しとなる。 function inc($int) { $int++; } $one = 1; inc($one); echo $one; // => 1 function ninc(&$int) { $int++; } $two = 2; ninc($two); echo $two; // => 3

ファイル、ディレクトリの所有権変更

chown -hR foo:foo /hoge/fuga # -h シンボリックリンクのみ所有権変更 # -R 再帰的に変更 Ref Linuxコマンド【 chown 】ファイルの所有者やグループを変更 - Linux入門 - Webkaru

failed to open stream permission denied

Laravelでタイトルのようなエラーが出た。 サーバー内のディレクトリの権限に問題があるので、 chmod 777などで権限変更する。 shellscript 作っておくと便利かも。 #!/bin/bash chmod 777 $FULLPATH'bootstrap/cache' chmod 666 bootstrap/cache/services.p…